Exemplo n.º 1
0
        ////////////////////////////////////////////////////////////////////////////////
        int brush_in_fixture(Brush b, bool solid_only)
        {
            //int fix = point_in_fixture (b.x + (b.width / 2), b.y + (b.length / 2), b.z);
              //if (fix == -1) fix = point_in_fixture (b.x + 1, b.y + 1, b.z);
              //if (fix == -1) fix = point_in_fixture (b.x + b.width - 1, b.y + 1, b.z);
              //if (fix == -1) fix = point_in_fixture (b.x + 1, b.y + b.length - 1, b.z);
              //if (fix == -1) fix = point_in_fixture (b.x + b.width - 1, b.y + b.length - 1, b.z);

              //if (fix == -1) fix = point_in_fixture (b.x + (b.width / 2), b.y + (b.length / 2), b.z + (b.height / 2));
              //if (fix == -1) fix = point_in_fixture (b.x + 1, b.y + 1, b.z + (b.height / 2));
              //if (fix == -1) fix = point_in_fixture (b.x + b.width - 1, b.y + 1, b.z + (b.height / 2));
              //if (fix == -1) fix = point_in_fixture (b.x + 1, b.y + b.length - 1, b.z + (b.height / 2));
              //if (fix == -1) fix = point_in_fixture (b.x + b.width - 1, b.y + b.length - 1, b.z + (b.height / 2));

              //if (fix == -1) fix = point_in_fixture (b.x + (b.width / 2), b.y + (b.length / 2), b.z + b.height - 1);
              //if (fix == -1) fix = point_in_fixture (b.x + 1, b.y + 1, b.z + b.height - 1);
              //if (fix == -1) fix = point_in_fixture (b.x + b.width - 1, b.y + 1, b.z + b.height - 1);
              //if (fix == -1) fix = point_in_fixture (b.x + 1, b.y + b.length - 1, b.z + b.height - 1);
              //if (fix == -1) fix = point_in_fixture (b.x + b.width - 1, b.y + b.length - 1, b.z + b.height - 1);

              //return fix;

              int f = 0;
              int clip = -1;

              while (clip == -1 && f < total_fixtures)
            {
            if (b.x + b.width >= fixture[f].x && b.x <= fixture[f].x + fixture[f].width
            && b.y + b.length >= fixture[f].y && b.y <= fixture[f].y + fixture[f].length
            && b.z + b.height >= fixture[f].z && b.z <= fixture[f].z + fixture[f].height - 1)
              {
              if (solid_only == true && fixture[f].solid == false)
            {
            clip = -1;
            //if (fixture[f].type == (int) F.LASER_HORIZONTAL_GREEN_TEST) fixture[f].powered = true;
            }
              else clip = f;
              }
            f += 1;
            }

              return clip;
        }
Exemplo n.º 2
0
        ////////////////////////////////////////////////////////////////////////////////
        int brush_on_fixture(Brush b)
        {
            //int fixture_below = point_in_fixture (1008, 528, 48);//b.x + (b.width / 2), 528, 48);//b.y + (b.length / 2), 48);//b.z - (tilesize / 4));
              int fixture_below = point_in_fixture (b.x + (b.width / 2), b.y + (b.length / 2), b.z - 1);
              if (fixture_below == -1) fixture_below = point_in_fixture (b.x + 1, b.y + 1, b.z - 1);
              if (fixture_below == -1) fixture_below = point_in_fixture (b.x + b.width - 1, b.y + 1, b.z - 1);
              if (fixture_below == -1) fixture_below = point_in_fixture (b.x + 1, b.y + b.length - 1, b.z - 1);
              if (fixture_below == -1) fixture_below = point_in_fixture (b.x + b.width - 1, b.y + b.length - 1, b.z - 1);

              return fixture_below;
        }
Exemplo n.º 3
0
    ////////////////////////////////////////////////////////////////////////////////

    protected override void Initialize()
      {
      base.Initialize();
      this.IsMouseVisible = true;

      graphics.PreferredBackBufferWidth = screen_width;
      graphics.PreferredBackBufferHeight = screen_height;
      graphics.IsFullScreen = false;//true;
      graphics.ApplyChanges();

      light_buffer = new RenderTarget2D (GraphicsDevice, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);

      // initialize class arrays
      for (int i = 0; i < max_effects;    i += 1) particle_effect[i] = new ParticleEffect ();
      for (int b = 0; b < max_brushes;    b += 1) brush[b] = new Brush ();
      for (int f = 0; f < max_fixtures;   f += 1) fixture[f] = new Fixture ();
      for (int o = 0; o < max_objects;    o += 1) obj[o] = new Object ();
      for (int c = 0; c < max_characters; c += 1) character[c] = new Character ();

      player_level = 2;  // starting level, default 0

      load_map();

      if (player_added_to_map == false)
        {
        add_character ("Richard", (int) C.RICHARD, 64, 64, 256);
        }

      // scroll border is inside box of screen (non-scrolling part)
      scroll_border.X = Convert.ToInt32 (screen_width * 2 / 5);
      scroll_border.Y = Convert.ToInt32 (screen_height * 2 / 5);
      scroll_border.Width = Convert.ToInt32 (screen_width * 1/5);
      scroll_border.Height = Convert.ToInt32 (screen_height * 1/5);

      // menu
      menu_width = Convert.ToInt32 (screen_width * .75);
      menu_height = Convert.ToInt32 (screen_height * .75);
      menu_x = (screen_width - menu_width) / 2;
      menu_y = (screen_height - menu_height) / 2;
      menu_exit_v.X = menu_x + 20;
      menu_exit_v.Y = menu_y + 20;
      }