Ejemplo n.º 1
0
static inline void draw_back()
{
    using enigma_user::background_x;
    using enigma_user::background_y;
    using enigma_user::background_visible;
    using enigma_user::background_alpha;
    using enigma_user::background_xscale;
    using enigma_user::background_yscale;
    using enigma_user::background_htiled;
    using enigma_user::background_vtiled;
    using enigma_user::background_index;
    using enigma_user::background_coloring;
    using enigma_user::draw_background_tiled_ext;
    using enigma_user::draw_background_ext;
    //Draw backgrounds
    for (int back_current=0; back_current<7; back_current++)
    {
        if (background_visible[back_current] == 1)
        {
            if (background_htiled[back_current] || background_vtiled[back_current])
                draw_background_tiled_ext(background_index[back_current], background_x[back_current], background_y[back_current], background_xscale[back_current], background_xscale[back_current], background_coloring[back_current], background_alpha[back_current]);
            else
                draw_background_ext(background_index[back_current], background_x[back_current], background_y[back_current], background_xscale[back_current], background_xscale[back_current], 0, background_coloring[back_current], background_alpha[back_current]);
        }
    }
}
Ejemplo n.º 2
0
static inline void draw_back()
{
  using enigma_user::background_x;
  using enigma_user::background_y;
  using enigma_user::background_visible;
  using enigma_user::background_alpha;
  using enigma_user::background_xscale;
  using enigma_user::background_yscale;
  using enigma_user::background_htiled;
  using enigma_user::background_vtiled;
  using enigma_user::background_hspeed;
  using enigma_user::background_vspeed;
  using enigma_user::background_index;
  using enigma_user::background_coloring;
  using enigma_user::draw_background_tiled_ext;
  using enigma_user::draw_background_ext;
  // Draw the rooms backgrounds
  for (int back_current = 0; back_current < 8; back_current++) {
    if (background_visible[back_current] == 1) {
      //NOTE: This has been double checked with Game Maker 8.1 to work exactly the same, the background_x/y is modified just as object locals are
      //and also just as one would assume the system to work.
      //TODO: This should probably be moved to room system.
      background_x[back_current] += background_hspeed[back_current];
      background_y[back_current] += background_vspeed[back_current];
      if (background_htiled[back_current] || background_vtiled[back_current]) {
        draw_background_tiled_ext(background_index[back_current], background_x[back_current], background_y[back_current], background_xscale[back_current],
          background_xscale[back_current], background_coloring[back_current], background_alpha[back_current], background_htiled[back_current], background_vtiled[back_current]);
      } else {
        draw_background_ext(background_index[back_current], background_x[back_current], background_y[back_current], background_xscale[back_current], background_xscale[back_current], 0, background_coloring[back_current], background_alpha[back_current]);
      }
    }
  }
}
Ejemplo n.º 3
0
void move_random(const cs_scalar snapHor, const cs_scalar snapVer)
{
    enigma::object_planar* const inst = ((enigma::object_planar*)enigma::instance_event_iterator->inst);
    const int mask_ind = ((enigma::object_collisions*)enigma::instance_event_iterator->inst)->mask_index;
    const int spr_ind = ((enigma::object_graphics*)enigma::instance_event_iterator->inst)->sprite_index;
    cs_scalar x1, y1, x2, y2;
    if (spr_ind == -1 && (mask_ind == -1))
    {
        x1 = 0; y1 = 0; x2 = room_width; y2 = room_height;
    }
    else
    {
        const int mask = (mask_ind >= 0) ? mask_ind : spr_ind;
        x1 = sprite_get_xoffset(mask); y1 = sprite_get_yoffset(mask); x2 = room_width - sprite_get_width(mask) + sprite_get_xoffset(mask); y2 = room_height - sprite_get_height(mask) + sprite_get_yoffset(mask);
    }
    using enigma_user::random;
    inst->x = x1 + (fnzero(snapHor) ? floor(random(x2 - x1)/snapHor)*snapHor : random(x2 - x1));
    inst->y = y1 + (fnzero(snapVer) ? floor(random(y2 - y1)/snapVer)*snapVer : random(y2 - y1));
}