Пример #1
0
void
draw_right_mark (ALLEGRO_BITMAP *bitmap, struct pos *p, int r,
                 enum vm vm)
{
  ALLEGRO_BITMAP *wall_mark_top_right = NULL,
    *wall_mark_bottom_right = NULL;

  if (vm == VGA) {
    wall_mark_top_right = apply_hue_palette (dv_wall_mark_top_right);
    wall_mark_bottom_right = apply_hue_palette (dv_wall_mark_bottom_right);
  } else {
    wall_mark_top_right = de_wall_mark_top_right;
    wall_mark_bottom_right = de_wall_mark_bottom_right;
  }

  if (peq (p, &mouse_pos)) {
    wall_mark_top_right = apply_palette (wall_mark_top_right, selection_palette);
    wall_mark_bottom_right = apply_palette (wall_mark_bottom_right, selection_palette);
  }

  ALLEGRO_BITMAP *wall_mark;
  const int floor_offset[4] = {52, 42, 31, 21};

  if (r % 2) wall_mark = wall_mark_bottom_right;
  else wall_mark = wall_mark_top_right;

  struct coord c;
  c.room = p->room;
  c.x = 32 * p->place + 8 * ((r > 1) ? 1 : 0)
    + ((r < 2) ? 24 : r1 - 3);
  c.y = 63 * p->floor + 56 - floor_offset[r];
  draw_bitmapc (wall_mark, bitmap, &c, 0);
}
Пример #2
0
void
draw_floor_reflex (ALLEGRO_BITMAP *bitmap, struct pos *p,
                   enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *floor_right = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: floor_right = dc_floor_right; break;
    case EGA: floor_right = de_floor_right; break;
    case VGA: floor_right = dv_floor_right; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: floor_right = pc_floor_right; break;
    case EGA: floor_right = pe_floor_right; break;
    case VGA: floor_right = pv_floor_right; break;
    }
    break;
  }

  if (vm == VGA) floor_right = apply_hue_palette (floor_right);
  if (hgc) floor_right = apply_palette (floor_right, hgc_palette);
  if (peq (p, &mouse_pos))
    floor_right = apply_palette (floor_right, selection_palette);

  struct pos pl; prel (p, &pl, +0, -1);
  struct coord c;
  int h = al_get_bitmap_height (floor_right);
  draw_bitmap_regionc (floor_right, bitmap, 0, 2, 17, h - 9,
                       floor_reflex_coord (&pl, &c), 0);
}
Пример #3
0
void
draw_skeleton_floor_right (ALLEGRO_BITMAP *bitmap, struct pos *p,
                           enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *skeleton_floor_right = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: skeleton_floor_right = dc_skeleton_floor_right; break;
    case EGA: skeleton_floor_right = de_skeleton_floor_right; break;
    case VGA: skeleton_floor_right = dv_skeleton_floor_right; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: skeleton_floor_right = pc_skeleton_floor_right; break;
    case EGA: skeleton_floor_right = pe_skeleton_floor_right; break;
    case VGA: skeleton_floor_right = pv_skeleton_floor_right; break;
    }
    break;
  }

  if (vm == VGA) skeleton_floor_right = apply_hue_palette (skeleton_floor_right);
  if (hgc) skeleton_floor_right = apply_palette (skeleton_floor_right, hgc_palette);
  if (peq (p, &mouse_pos))
    skeleton_floor_right = apply_palette (skeleton_floor_right, selection_palette);

  struct coord c;
  draw_bitmapc (skeleton_floor_right, bitmap, skeleton_floor_right_coord (p, &c), 0);
}
Пример #4
0
void
draw_spikes_fg_01 (ALLEGRO_BITMAP *bitmap, struct pos *p,
                   enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *spikes_fg_01 = NULL;
  pos2coord_f spikes_fg_01_coord = NULL;

  switch (em) {
  case DUNGEON:
    spikes_fg_01_coord = d_spikes_fg_01_coord;
    switch (vm) {
    case CGA: spikes_fg_01 = dc_spikes_fg_01; break;
    case EGA: spikes_fg_01 = de_spikes_fg_01; break;
    case VGA: spikes_fg_01 = dv_spikes_fg_01; break;
    }
    break;
  case PALACE:
    spikes_fg_01_coord = p_spikes_fg_01_coord;
    switch (vm) {
    case CGA: spikes_fg_01 = pc_spikes_fg_01; break;
    case EGA: spikes_fg_01 = pe_spikes_fg_01; break;
    case VGA: spikes_fg_01 = pv_spikes_fg_01; break;
    }
    break;
  }

  if (vm == VGA) spikes_fg_01 = apply_hue_palette (spikes_fg_01);
  if (hgc) spikes_fg_01 = apply_palette (spikes_fg_01, hgc_palette);
  if (peq (p, &mouse_pos))
    spikes_fg_01 = apply_palette (spikes_fg_01, selection_palette);

  struct coord c;
  draw_bitmapc (spikes_fg_01, bitmap, spikes_fg_01_coord (p, &c), 0);
}
Пример #5
0
void
draw_floor_corner_02 (ALLEGRO_BITMAP *bitmap, struct pos *p,
                      enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *floor_corner_02 = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: floor_corner_02 = dc_floor_corner_02; break;
    case EGA: floor_corner_02 = de_floor_corner_02; break;
    case VGA: floor_corner_02 = dv_floor_corner_02; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: floor_corner_02 = pc_floor_corner_02; break;
    case EGA: floor_corner_02 = pe_floor_corner_02; break;
    case VGA: floor_corner_02 = pv_floor_corner_02; break;
    }
    break;
  }

  if (vm == VGA) floor_corner_02 = apply_hue_palette (floor_corner_02);
  if (hgc) floor_corner_02 = apply_palette (floor_corner_02, hgc_palette);
  if (peq (p, &mouse_pos))
    floor_corner_02 = apply_palette (floor_corner_02, selection_palette);

  struct coord c; floor_corner_02_coord (p, &c);
  if (con (p)->fg == CLOSER_FLOOR) c.y += 1;
  draw_bitmapc (floor_corner_02, bitmap, &c, 0);
}
Пример #6
0
void
draw_door_pole_base (ALLEGRO_BITMAP *bitmap, struct pos *p,
                     enum em em, enum vm vm)
{
  struct coord c;

  ALLEGRO_BITMAP *door_pole_base = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: door_pole_base = dc_door_pole_base; break;
    case EGA: door_pole_base = de_door_pole_base; break;
    case VGA: door_pole_base = dv_door_pole_base; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: door_pole_base = pc_door_pole_base; break;
    case EGA: door_pole_base = pe_door_pole_base; break;
    case VGA: door_pole_base = pv_door_pole_base; break;
    }
    break;
  }

  if (vm == VGA) door_pole_base = apply_hue_palette (door_pole_base);
  if (hgc) door_pole_base = apply_palette (door_pole_base, hgc_palette);
  if (peq (p, &mouse_pos))
    door_pole_base = apply_palette (door_pole_base, selection_palette);

  draw_bitmapc (door_pole_base, bitmap, door_pole_base_coord (p, &c), 0);
}
Пример #7
0
void
draw_door_grid (ALLEGRO_BITMAP *bitmap, struct pos *p, int i,
                enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *door_grid = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: door_grid = dc_door_grid_cache[i]; break;
    case EGA: door_grid = de_door_grid_cache[i]; break;
    case VGA: door_grid = dv_door_grid_cache[i]; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: door_grid = pc_door_grid_cache[i]; break;
    case EGA: door_grid = pe_door_grid_cache[i]; break;
    case VGA: door_grid = pv_door_grid_cache[i]; break;
    }
    break;
  }

  if (vm == VGA) door_grid = apply_hue_palette (door_grid);

  if (hgc) door_grid = apply_palette (door_grid, hgc_palette);

  if (peq (p, &mouse_pos))
    door_grid = apply_palette (door_grid, selection_palette);

  struct coord c;
  draw_bitmapc (door_grid, bitmap, door_grid_coord_base (p, &c), 0);
}
Пример #8
0
void
draw_unpressed_closer_floor_base (ALLEGRO_BITMAP *bitmap, struct pos *p,
                                  enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *unpressed_closer_floor_base = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: unpressed_closer_floor_base = dc_unpressed_closer_floor_base; break;
    case EGA: unpressed_closer_floor_base = de_unpressed_closer_floor_base; break;
    case VGA: unpressed_closer_floor_base = dv_unpressed_closer_floor_base; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: unpressed_closer_floor_base = pc_unpressed_closer_floor_base; break;
    case EGA: unpressed_closer_floor_base = pe_unpressed_closer_floor_base; break;
    case VGA: unpressed_closer_floor_base = pv_unpressed_closer_floor_base; break;
    }
    break;
  }

  if (vm == VGA) unpressed_closer_floor_base = apply_hue_palette (unpressed_closer_floor_base);
  if (hgc) unpressed_closer_floor_base = apply_palette (unpressed_closer_floor_base, hgc_palette);
  if (peq (p, &mouse_pos)) unpressed_closer_floor_base = apply_palette (unpressed_closer_floor_base, selection_palette);

  struct coord c;
  draw_bitmapc (unpressed_closer_floor_base, bitmap,
                floor_base_coord (p, &c), 0);
}
Пример #9
0
void
draw_broken_floor_left (ALLEGRO_BITMAP *bitmap, struct pos *p,
                        enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *broken_floor_left = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: broken_floor_left = dc_broken_floor_left; break;
    case EGA: broken_floor_left = de_broken_floor_left; break;
    case VGA: broken_floor_left = dv_broken_floor_left; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: broken_floor_left = pc_broken_floor_left; break;
    case EGA: broken_floor_left = pe_broken_floor_left; break;
    case VGA: broken_floor_left = pv_broken_floor_left; break;
    }
    break;
  }

  if (vm == VGA) broken_floor_left = apply_hue_palette (broken_floor_left);
  if (hgc) broken_floor_left = apply_palette (broken_floor_left, hgc_palette);
  if (peq (p, &mouse_pos))
    broken_floor_left = apply_palette (broken_floor_left, selection_palette);

  struct coord c;
  draw_bitmapc (broken_floor_left, bitmap, floor_left_coord (p, &c), 0);
}
Пример #10
0
void
draw_pillar_fg (ALLEGRO_BITMAP *bitmap, struct pos *p,
                enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *pillar_fg = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: pillar_fg = dc_pillar_fg; break;
    case EGA: pillar_fg = de_pillar_fg; break;
    case VGA: pillar_fg = dv_pillar_fg; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: pillar_fg = pc_pillar_fg; break;
    case EGA: pillar_fg = pe_pillar_fg; break;
    case VGA: pillar_fg = pv_pillar_fg; break;
    }
    break;
  }

  if (vm == VGA) pillar_fg = apply_hue_palette (pillar_fg);
  if (hgc) pillar_fg = apply_palette (pillar_fg, hgc_palette);
  if (peq (p, &mouse_pos))
    pillar_fg = apply_palette (pillar_fg, selection_palette);

  struct coord c;
  draw_bitmapc (pillar_fg, bitmap, pillar_coord (p, &c), 0);
}
Пример #11
0
void
draw_arch_top_top (ALLEGRO_BITMAP *bitmap, struct pos *p,
                   enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *arch_top_top = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: arch_top_top = dc_arch_top_top; break;
    case EGA: arch_top_top = de_arch_top_top; break;
    case VGA: arch_top_top = dv_arch_top_top; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: arch_top_top = pc_arch_top_top; break;
    case EGA: arch_top_top = pe_arch_top_top; break;
    case VGA: arch_top_top = pv_arch_top_top; break;
    }
    break;
  }

  if (vm == VGA) arch_top_top = apply_hue_palette (arch_top_top);
  if (hgc) arch_top_top = apply_palette (arch_top_top, hgc_palette);
  if (peq (p, &mouse_pos))
    arch_top_top = apply_palette (arch_top_top, selection_palette);

  struct coord c;
  draw_bitmapc (arch_top_top, bitmap, arch_top_top_coord (p, &c), 0);
}
Пример #12
0
void
draw_left_mark (ALLEGRO_BITMAP *bitmap, struct pos *p, int r,
                enum vm vm)
{
  ALLEGRO_BITMAP *wall_mark_top_left = NULL,
    *wall_mark_bottom_left = NULL;

  if (vm == VGA) {
    wall_mark_top_left = apply_hue_palette (dv_wall_mark_top_left);
    wall_mark_bottom_left = apply_hue_palette (dv_wall_mark_bottom_left);
  } else {
    wall_mark_top_left = de_wall_mark_top_left;
    wall_mark_bottom_left = de_wall_mark_bottom_left;
  }

  if (peq (p, &mouse_pos)) {
    wall_mark_top_left = apply_palette (wall_mark_top_left, selection_palette);
    wall_mark_bottom_left = apply_palette (wall_mark_bottom_left, selection_palette);
  }

  ALLEGRO_BITMAP *wall_mark = wall_mark_top_left;
  const int floor_offset[5] = {58, 41, 37, 20, 16};
  int place_offset = 0;

  if (r % 2) wall_mark = wall_mark_bottom_left;
  if (r > 3) place_offset = r3 - r2 + 6;
  else if (r > 1) place_offset = r1 - r0 + 6;

  struct coord c;
  c.room = p->room;
  c.x = 32 * p->place + place_offset +
    8 * (((r == 2) || (r == 3)) ? 1 : 0);
  c.y = 63 * p->floor + 61 - floor_offset[r];

  draw_bitmapc (wall_mark, bitmap, &c, 0);
}
Пример #13
0
void
draw_www_base (ALLEGRO_BITMAP *bitmap, struct pos *p,
               enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *wall_center_base = NULL;

  if (vm == VGA) wall_center_base = apply_hue_palette (dv_wall_center_base);
  else if (em == DUNGEON) wall_center_base = de_wall_center_base;
  else wall_center_base = pe_wall_center_base;

  if (peq (p, &mouse_pos))
    wall_center_base = apply_palette (wall_center_base, selection_palette);

  struct coord c;
  draw_bitmapc (wall_center_base, bitmap, wall_base_coord (p, &c), 0);
}
Пример #14
0
void
draw_random_block (ALLEGRO_BITMAP *bitmap, struct pos *p,
                   enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *wall_random_block = NULL;

  if (vm == VGA) wall_random_block = apply_hue_palette (dv_wall_random_block);
  else if (em == DUNGEON) wall_random_block = de_wall_random_block;
  else wall_random_block = pe_wall_random_block;

  if (peq (p, &mouse_pos))
    wall_random_block = apply_palette (wall_random_block, selection_palette);

  struct coord c;
  draw_bitmapc (wall_random_block, bitmap, wall_random_block_coord (p, &c), 0);
}
Пример #15
0
void
draw_wws_left (ALLEGRO_BITMAP *bitmap, struct pos *p,
               enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *wall_right = NULL;

  if (vm == VGA) wall_right = apply_hue_palette (dv_wall_right);
  else if (em == DUNGEON) wall_right = de_wall_right;
  else wall_right = pe_wall_right;

  if (peq (p, &mouse_pos))
    wall_right = apply_palette (wall_right, selection_palette);

  struct coord c;
  draw_bitmapc (wall_right, bitmap, wall_coord (p, &c), 0);
}
Пример #16
0
void
draw_mirror (ALLEGRO_BITMAP *bitmap, struct pos *p,
                 enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *mirror = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: mirror = dc_mirror; break;
    case EGA: mirror = de_mirror; break;
    case VGA: mirror = dv_mirror; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: mirror = pc_mirror; break;
    case EGA: mirror = pe_mirror; break;
    case VGA: mirror = pv_mirror; break;
    }
    break;
  }

  /* make mirror black */
  struct rect r;
  new_rect (&r, p->room, PLACE_WIDTH * p->place + 2,
            PLACE_HEIGHT * p->floor + 3,
            PLACE_WIDTH - 10, PLACE_HEIGHT - 16);
  draw_filled_rect (bitmap, &r, BLACK);

  /* draw floor reflex */
  draw_floor_reflex (bitmap, p, em, vm);

  /* draw mirror properly */
  if (vm == VGA) mirror = apply_hue_palette (mirror);
  if (hgc) mirror = apply_palette (mirror, hgc_palette);
  if (peq (p, &mouse_pos))
    mirror = apply_palette (mirror, selection_palette);

  struct coord c;
  draw_bitmapc (mirror, bitmap, mirror_coord (p, &c), 0);
}
Пример #17
0
void
draw_broken_floor_fg (ALLEGRO_BITMAP *bitmap, struct pos *p,
                      enum em em, enum vm vm)
{
  struct coord c;
  int i;
  for (i = 0; i < anima_nmemb; i++) {
    struct anim *a = &anima[i];
    struct pos pmt;
    survey (_mt, pos, &a->f, NULL, &pmt, NULL);
    if (peq (&pmt, p) && is_anim_dead (&a->f)) return;
  }

  ALLEGRO_BITMAP *broken_floor_front = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: broken_floor_front = dc_broken_floor_front; break;
    case EGA: broken_floor_front = de_broken_floor_front; break;
    case VGA: broken_floor_front = dv_broken_floor_front; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: broken_floor_front = pc_broken_floor_front; break;
    case EGA: broken_floor_front = pe_broken_floor_front; break;
    case VGA: broken_floor_front = pv_broken_floor_front; break;
    }
    break;
  }

  if (vm == VGA) broken_floor_front = apply_hue_palette (broken_floor_front);
  if (hgc) broken_floor_front = apply_palette (broken_floor_front, hgc_palette);
  if (peq (p, &mouse_pos))
    broken_floor_front = apply_palette (broken_floor_front, selection_palette);

  draw_bitmapc (broken_floor_front, bitmap,
                broken_floor_front_coord (p, &c), 0);
}
Пример #18
0
static void
draw_left_01 (ALLEGRO_BITMAP *bitmap, struct pos *p, struct chopper *ch,
              enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *chopper = NULL;
  palette blood_palette = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: chopper = dc_chopper_00; break;
    case EGA: chopper = de_chopper_00; break;
    case VGA: chopper = dv_chopper_00; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: chopper = pc_chopper_00; break;
    case EGA: chopper = pe_chopper_00; break;
    case VGA: chopper = pv_chopper_00; break;
    }
    break;
  }

  if (vm == VGA) chopper = apply_hue_palette (chopper);
  if (hgc) chopper = apply_palette (chopper, hgc_palette);
  if (peq (p, &mouse_pos)) chopper = apply_palette (chopper, selection_palette);

  struct coord c;
  draw_bitmapc (chopper, bitmap, chopper_coord (p, &c), 0);
  if (ch->blood) {
    blood_palette = get_blood_palette (vm);
    ALLEGRO_BITMAP *blood = apply_palette (chopper_blood_00, blood_palette);
    if (hgc) blood = apply_palette (blood, hgc_palette);
    draw_bitmapc (blood, bitmap, blood_01_coord (p, &c), 0);
  }
}
Пример #19
0
static void
draw_fg_05 (ALLEGRO_BITMAP *bitmap, struct pos *p, struct chopper *ch,
                    enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *fg = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: fg = dc_chopper_fg_04; break;
    case EGA: fg = de_chopper_fg_04; break;
    case VGA: fg = dv_chopper_fg_04; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: fg = pc_chopper_fg_04; break;
    case EGA: fg = pe_chopper_fg_04; break;
    case VGA: fg = pv_chopper_fg_04; break;
    }
    break;
  }

  if (vm == VGA) fg = apply_hue_palette (fg);
  if (hgc) fg = apply_palette (fg, hgc_palette);
  if (peq (p, &mouse_pos)) fg = apply_palette (fg, selection_palette);

  struct coord c;
  draw_bitmapc (fg, bitmap, chopper_coord (p, &c), 0);
  if (ch->blood) {
    int h = al_get_bitmap_height (chopper_blood_04);
    palette blood_palette = get_blood_palette (vm);
    ALLEGRO_BITMAP *blood = apply_palette (chopper_blood_04, blood_palette);
    if (hgc) blood = apply_palette (blood, hgc_palette);
    draw_bitmap_regionc (blood, bitmap, 0, 0, 2, h, blood_05_coord (p, &c), 0);
  }
}
Пример #20
0
void
draw_randomization (ALLEGRO_BITMAP *bitmap, struct pos *p,
                    enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *wall_narrow_divider = NULL,
    *wall_wide_divider = NULL;

  if (vm == VGA) {
    wall_narrow_divider = apply_hue_palette (dv_wall_narrow_divider);
    wall_wide_divider = apply_hue_palette (dv_wall_wide_divider);
  } else if (em == DUNGEON) {
    wall_narrow_divider = de_wall_narrow_divider;
    wall_wide_divider = de_wall_wide_divider;
  } else {
    wall_narrow_divider = pe_wall_narrow_divider;
    wall_wide_divider = pe_wall_wide_divider;
  }

  if (peq (p, &mouse_pos)) {
    wall_narrow_divider = apply_palette (wall_narrow_divider, selection_palette);
    wall_wide_divider = apply_palette (wall_wide_divider, selection_palette);
  }

  seedp (p);
  prandom (1);
  r0 = prandom(1);
  r1 = prandom(4);
  r2 = prandom(1);
  r3 = prandom(4);

  wall_divider_00 = r2 ? wall_narrow_divider : wall_wide_divider;
  wall_divider_01 = r0 ? wall_narrow_divider : wall_wide_divider;

  enum wall_correlation wc = wall_correlation (p);

  switch (wc) {
  case WWW:
    if (prandom (4) == 0) draw_random_block (bitmap, p, em, vm);
    draw_divider_01 (bitmap, p, em, vm);
    draw_divider_00 (bitmap, p, em, vm);
    if (em == DUNGEON) {
      if (prandom(4) == 0)
        draw_right_mark (bitmap, p, prandom (3), vm);
      if (prandom(4) == 0)
        draw_left_mark (bitmap, p, prandom (4), vm);
    }
    break;
  case SWS:
    if (em == DUNGEON && prandom (6) == 0)
      draw_left_mark (bitmap, p, prandom (1), vm);
    break;
  case SWW:
    if (prandom (4) == 0)
      draw_random_block (bitmap, p, em, vm);
    draw_divider_01 (bitmap, p, em, vm);
    if (em == DUNGEON) {
      if (prandom(4) == 0)
        draw_right_mark (bitmap, p, prandom (3), vm);
      if (prandom(4) == 0)
        draw_left_mark (bitmap, p, prandom (3), vm);
    }
    break;
  case WWS:
    draw_divider_01 (bitmap, p, em, vm);
    draw_divider_00 (bitmap, p, em, vm);
    if (em == DUNGEON) {
      if (prandom(4) == 0)
        draw_right_mark (bitmap, p, prandom (1) + 2, vm);
      if (prandom(4) == 0)
        draw_left_mark (bitmap, p, prandom (4), vm);
    }
    break;
  default:
    error (-1, 0, "%s: unknown wall correlation (%i)", __func__, wc);
  }

  unseedp ();
}
Пример #21
0
void
draw_pressed_closer_floor_right (ALLEGRO_BITMAP *bitmap, struct pos *p,
                                 enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *floor_right = NULL,
    *pressed_closer_floor_right = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA:
      floor_right = dc_floor_right;
      pressed_closer_floor_right = dc_pressed_closer_floor_right;
      break;
    case EGA:
      floor_right = de_floor_right;
      pressed_closer_floor_right = de_pressed_closer_floor_right;
      break;
    case VGA:
      floor_right = dv_floor_right;
      pressed_closer_floor_right = dv_pressed_closer_floor_right;
      break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA:
      floor_right = pc_floor_right;
      pressed_closer_floor_right = pc_pressed_closer_floor_right;
      break;
    case EGA:
      floor_right = pe_floor_right;
      pressed_closer_floor_right = pe_pressed_closer_floor_right;
      break;
    case VGA:
      floor_right = pv_floor_right;
      pressed_closer_floor_right = pv_pressed_closer_floor_right;
      break;
    }
    break;
  }

  if (vm == VGA) {
    floor_right = apply_hue_palette (floor_right);
    pressed_closer_floor_right = apply_hue_palette (pressed_closer_floor_right);
  }

  if (hgc) {
    floor_right = apply_palette (floor_right, hgc_palette);
    pressed_closer_floor_right = apply_palette (pressed_closer_floor_right, hgc_palette);
  }

  if (peq (p, &mouse_pos)) {
    floor_right = apply_palette (floor_right, selection_palette);
    pressed_closer_floor_right = apply_palette (pressed_closer_floor_right, selection_palette);
  }

  struct coord c; struct pos np;
  draw_bitmapc (floor_right, bitmap,
                pressed_closer_floor_right_coord (p, &c), 0);
  if (! is_strictly_traversable (prel (p, &np, 0, +1)))
    draw_bitmapc (pressed_closer_floor_right, bitmap,
                  floor_right_coord (p, &c), 0);
}
Пример #22
0
void
xdraw_door_grid (ALLEGRO_BITMAP *bitmap, struct pos *p, int i,
                 enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *door_grid = NULL,
    *door_grid_tip = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA:
      door_grid = dc_door_grid;
      door_grid_tip = dc_door_grid_tip;
      break;
    case EGA:
      door_grid = de_door_grid;
      door_grid_tip = de_door_grid_tip;
      break;
    case VGA:
      door_grid = dv_door_grid;
      door_grid_tip = dv_door_grid_tip;
      break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA:
      door_grid = pc_door_grid;
      door_grid_tip = pc_door_grid_tip;
      break;
    case EGA:
      door_grid = pe_door_grid;
      door_grid_tip = pe_door_grid_tip;
      break;
    case VGA:
      door_grid = pv_door_grid;
      door_grid_tip = pv_door_grid_tip;
      break;
    }
    break;
  }

  if (vm == VGA) {
    door_grid = apply_hue_palette (door_grid);
    door_grid_tip = apply_hue_palette (door_grid_tip);
  }

  if (hgc) {
    door_grid = apply_palette (door_grid, hgc_palette);
    door_grid_tip = apply_palette (door_grid_tip, hgc_palette);
  }

  if (peq (p, &mouse_pos)) {
    door_grid = apply_palette (door_grid, selection_palette);
    door_grid_tip = apply_palette (door_grid_tip, selection_palette);
  }

  int q = i / 8;
  int r = i % 8;
  int w = al_get_bitmap_width (door_grid);
  int j;

  struct coord c;
  draw_bitmap_regionc (door_grid, bitmap, 0, 7 - r, w, r + 1,
                       door_grid_coord_base (p, &c), 0);
  for (j = 0; j <= q; j++)
    draw_bitmapc (door_grid, bitmap, door_grid_coord (p, &c, j, i), 0);
  draw_bitmapc (door_grid_tip, bitmap, door_grid_tip_coord (p, &c, i), 0);
}
Пример #23
0
void
draw_door_right (ALLEGRO_BITMAP *bitmap, struct pos *p,
                 enum em em, enum vm vm)
{
  struct coord c;
  struct door *d = door_at_pos (p);
  if (! d) return;

  ALLEGRO_BITMAP *door_right = NULL,
    *door_top = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA:
      door_right = dc_door_right;
      door_top = dc_door_top;
      break;
    case EGA:
      door_right = de_door_right;
      door_top = de_door_top;
      break;
    case VGA:
      door_right = dv_door_right;
      door_top = dv_door_top;
      break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA:
      door_right = pc_door_right;
      door_top = pc_door_top;
      break;
    case EGA:
      door_right = pe_door_right;
      door_top = pe_door_top;
      break;
    case VGA:
      door_right = pv_door_right;
      door_top = pv_door_top;
      break;
    }
    break;
  }

  if (vm == VGA) {
    door_right = apply_hue_palette (door_right);
    door_top = apply_hue_palette (door_top);
  }

  if (hgc) {
    door_right = apply_palette (door_right, hgc_palette);
    door_top = apply_palette (door_top, hgc_palette);
  }

  if (peq (p, &mouse_pos)) {
    door_right = apply_palette (door_right, selection_palette);
    door_top = apply_palette (door_top, selection_palette);
  }

  draw_bitmapc (door_right, bitmap, door_right_coord (p, &c), 0);
  draw_bitmapc (door_top, bitmap, door_top_coord (p, &c), 0);
  draw_door_grid (bitmap, p, d->i, em, vm);
}
Пример #24
0
void
draw_mirror_fg (ALLEGRO_BITMAP *bitmap, struct pos *p, struct frame *f,
                enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *mirror = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: mirror = dc_mirror; break;
    case EGA: mirror = de_mirror; break;
    case VGA: mirror = dv_mirror; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: mirror = pc_mirror; break;
    case EGA: mirror = pe_mirror; break;
    case VGA: mirror = pv_mirror; break;
    }
    break;
  }

  /* make mirror black */
  struct rect r;
  new_rect (&r, p->room, PLACE_WIDTH * p->place + 2,
            PLACE_HEIGHT * p->floor + 3,
            13, PLACE_HEIGHT - 16);
  draw_filled_rect (bitmap, &r, BLACK);

  /* draw floor reflex */
  draw_floor_reflex (bitmap, p, em, vm);

  ignore_clipping_rectangle_intersection = true;
  /* draw anim */
  if (f) {
    push_clipping_rectangle (bitmap, PLACE_WIDTH * p->place + 2,
                             PLACE_HEIGHT * p->floor + 3,
                             16, PLACE_HEIGHT - 9);
    struct anim *a = get_anim_by_id (f->parent_id);
    struct anim a0 = *a;
    invert_frame_dir (&a0.f, &a0.f);
    a0.f.c.x = (2 * PLACE_WIDTH * p->place + 36)
      - (a->f.c.x + al_get_bitmap_width (a->f.b));
    draw_anim_frame (bitmap, &a0, vm);
    pop_clipping_rectangle ();
  }

  /* draw mirror properly */
  if (vm == VGA) mirror = apply_hue_palette (mirror);
  if (hgc) mirror = apply_palette (mirror, hgc_palette);
  if (peq (p, &mouse_pos))
    mirror = apply_palette (mirror, selection_palette);

  struct coord c;
  int h = al_get_bitmap_height (mirror);
  push_reset_clipping_rectangle (bitmap);
  draw_bitmap_regionc (mirror, bitmap, 0, 0, 22, h, mirror_coord (p, &c), 0);
  pop_clipping_rectangle ();

  ignore_clipping_rectangle_intersection = false;
}
Пример #25
0
void
draw_pillar_right (ALLEGRO_BITMAP *bitmap, struct pos *p,
                   enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *pillar_right = NULL, *pillar_top = NULL;

  pos2coord_f pillar_top_coord = NULL;

  switch (em) {
  case DUNGEON:
    pillar_top_coord = d_pillar_top_coord;
    switch (vm) {
    case CGA:
      pillar_right = dc_pillar_right;
      pillar_top = dc_pillar_top;
      break;
    case EGA:
      pillar_right = de_pillar_right;
      pillar_top = de_pillar_top;
      break;
    case VGA:
      pillar_right = dv_pillar_right;
      pillar_top = dv_pillar_top;
      break;
    }
    break;
  case PALACE:
    pillar_top_coord = p_pillar_top_coord;
    switch (vm) {
    case CGA:
      pillar_right = pc_pillar_right;
      pillar_top = pc_pillar_top;
      break;
    case EGA:
      pillar_right = pe_pillar_right;
      pillar_top = pe_pillar_top;
      break;
    case VGA:
      pillar_right = pv_pillar_right;
      pillar_top = pv_pillar_top;
      break;
    }
    break;
  }

  if (vm == VGA) {
    pillar_right = apply_hue_palette (pillar_right);
    pillar_top = apply_hue_palette (pillar_top);
  }

  if (hgc) {
    pillar_right = apply_palette (pillar_right, hgc_palette);
    pillar_top = apply_palette (pillar_top, hgc_palette);
  }

  if (peq (p, &mouse_pos)) {
    pillar_right = apply_palette (pillar_right, selection_palette);
    pillar_top = apply_palette (pillar_top, selection_palette);
  }

  struct coord c;
  draw_bitmapc (pillar_right, bitmap, pillar_right_coord (p, &c), 0);
  draw_bitmapc (pillar_top, bitmap, pillar_top_coord (p, &c), 0);
}