Example #1
0
void
redraw_drawn_rectangle (struct drawn_rectangle *dr, struct pos *p,
                        enum em em, enum vm vm)
{
  if (dr->w <= 0 || dr->h <= 0) return;

  push_clipping_rectangle (dr->bitmap, dr->x, dr->y, dr->w, dr->h);

  struct coord tl, br;
  new_coord (&tl, &global_level, room_view, dr->x, dr->y);
  new_coord (&br, &global_level, room_view, dr->x + dr->w - 1,
             dr->y + dr->h - 1);

  struct pos ptl, pbr;
  posf (&tl, &ptl);
  posf (&br, &pbr);

  pos2room (&ptl, room_view, &ptl);
  pos2room (&pbr, room_view, &pbr);
  struct pos p0 = ptl;
  for (p0.floor = pbr.floor; p0.floor >= ptl.floor; p0.floor--)
    for (p0.place = ptl.place; p0.place <= pbr.place; p0.place++)
      if (! peq (&p0, p)) draw_confg (dr->bitmap, &p0, em, vm);

  pop_clipping_rectangle ();
}
Example #2
0
struct coord *
p_spikes_right_01_coord (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * (p->place + 1),
               PLACE_HEIGHT * p->floor + 44);
}
Example #3
0
struct coord *
d_spikes_left_00_coord (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * p->place,
               PLACE_HEIGHT * p->floor + 51);
}
Example #4
0
struct coord *
mirror_reflex_coord (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * p->place + 3,
               PLACE_HEIGHT * p->floor + 6);
}
Example #5
0
struct coord *
floor_reflex_coord (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * (p->place + 1) + 2,
               PLACE_HEIGHT * p->floor + 50);
}
Example #6
0
struct coord *
blood_05_coord (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * p->place + 12,
               PLACE_HEIGHT * p->floor + 52);
}
Example #7
0
struct coord *
pressed_closer_floor_left_coord (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * p->place,
               PLACE_HEIGHT * p->floor + 51);
}
Example #8
0
struct coord *
sword_coord (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * p->place,
               PLACE_HEIGHT * p->floor + 50);
}
Example #9
0
struct coord *
arch_top_left_end_coord (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * (p->place + 1),
               PLACE_HEIGHT * p->floor + 3);
}
Example #10
0
struct coord *
arch_top_coord (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * p->place,
               PLACE_HEIGHT * p->floor + 10);
}
Example #11
0
struct coord *
p_spikes_fg_01_coord (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * p->place,
               PLACE_HEIGHT * p->floor + 48);
}
Example #12
0
struct coord *
unpressed_opener_floor_right_coord (struct pos *p, struct coord *c)
{
    return
        new_coord (c, p->l, p->room,
                   PLACE_WIDTH * (p->place + 1),
                   PLACE_HEIGHT * p->floor + 50 - 1);
}
Example #13
0
static struct coord *
guard_life_coord (int i, struct coord *c)
{
    return
        new_coord (c, NULL, room_view,
                   ORIGINAL_WIDTH - 7 * (i + 1) + 1,
                   194);
}
Example #14
0
struct coord *
box_coord (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * p->place,
               PLACE_HEIGHT * p->floor - 13);
}
Example #15
0
struct coord *
door_left_coord (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * p->place,
               PLACE_HEIGHT * p->floor + 3);
}
Example #16
0
struct coord *
door_top_coord (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * (p->place + 1),
               PLACE_HEIGHT * p->floor - 10);
}
Example #17
0
struct coord *
door_grid_coord_base (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * (p->place + 1),
               PLACE_HEIGHT * p->floor - 6);
}
Example #18
0
struct coord *
door_pole_base_coord (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * p->place + 24,
               PLACE_HEIGHT * (p->floor + 1) - 1);
}
Example #19
0
struct rect *
new_rect (struct rect *r, int room, int x, int y, int w, int h)
{
  new_coord (&r->c, &global_level, room, x, y);
  r->w = w;
  r->h = h;
  return r;
}
Example #20
0
struct coord *
broken_floor_front_coord (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * p->place,
               PLACE_HEIGHT * p->floor + 54);
}
Example #21
0
struct coord *
broken_floor_right_coord (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * (p->place + 1),
               PLACE_HEIGHT * p->floor + 49);
}
Example #22
0
struct coord *
con_m (struct pos *p, struct coord *c)
{
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * p->place + 15 + PLACE_WIDTH / 2,
               PLACE_HEIGHT * p->floor + 3 + PLACE_HEIGHT / 2);
}
Example #23
0
struct coord *
_bf (struct frame *f, struct coord *c)
{
  struct dim d; dim (f, &d);
  return
    new_coord (c, f->c.l, f->c.room,
               d.fx,
               d.y + d.h - 1);
}
Example #24
0
struct coord *
door_grid_coord (struct pos *p, struct coord *c, int j, int i)
{
  int r = i % 8;
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * (p->place + 1),
               PLACE_HEIGHT * p->floor - 6 + j * 8 + r + 1);
}
Example #25
0
struct coord *
_tr (struct frame *f, struct coord *c)
{
  struct dim d; dim (f, &d);
  return
    new_coord (c, f->c.l, f->c.room,
               d.x + d.w - 1,
               d.y);
}
Example #26
0
struct coord *
_mba (struct frame *f, struct coord *c)
{
  struct dim d; dim (f, &d);
  return
    new_coord (c, f->c.l, f->c.room,
               d.bx,
               d.y + d.h / 2);
}
Example #27
0
struct coord *
_mbo (struct frame *f, struct coord *c)
{
  struct dim d; dim (f, &d);
  return
    new_coord (c, f->c.l, f->c.room,
               d.x + d.w / 2,
               d.y + d.h - 1);
}
Example #28
0
struct coord *
door_grid_tip_coord (struct pos *p, struct coord *c, int i)
{
  int r = i % 8;
  int q = i / 8;
  return
    new_coord (c, p->l, p->room,
               PLACE_WIDTH * (p->place + 1),
               PLACE_HEIGHT * p->floor + 2 + q * 8 + r + 1);
}
Example #29
0
struct frame *
place_frame (struct frame *f, struct frame *nf, ALLEGRO_BITMAP *b,
             struct pos *p, int dx, int dy)
{
  struct pos pv;
  *nf = *f;
  pos2room (p, f->c.room, &pv);
  nf->b = b;
  new_coord (&nf->c, pv.l, pv.room,
             PLACE_WIDTH * pv.place + dx,
             PLACE_HEIGHT * pv.floor + dy);
  return nf;
}
Example #30
0
void print_success(latin_grid square) {
  if (square == square_B) {
    bool new_result = false;
    int row_repeats_A = repeat_count(diff_used_A);
    int row_repeats_B = repeat_count(diff_used_B);
    int AB_repeats = repeat_count(diff_used_diagonal_AB);
    int total_diagonal_repeats =
      AB_repeats + repeat_count(diff_used_diagonal_BA);
    if (row_repeats_A < least_row_repeats_A) {
      least_row_repeats_A = row_repeats_A;
      new_result = true;
    }
    if (row_repeats_B < least_row_repeats_B) {
      least_row_repeats_B = row_repeats_B;
      new_result = true;
    }
    if (AB_repeats < least_AB_repeats &&
        least_row_repeats_A == row_repeats_A &&
        least_row_repeats_B == row_repeats_B) {
      least_AB_repeats = AB_repeats;
      new_result = true;
    }
    if (total_diagonal_repeats < least_diagonal_repeats &&
        least_row_repeats_A == row_repeats_A &&
        least_row_repeats_B == row_repeats_B) {
      least_diagonal_repeats = total_diagonal_repeats;
      new_result = true;
    }
    
    if (verbose && new_result) {
      fill_in_square(square_A);
      fill_in_square(square_B);
      report2(square_A, square_B);
    }
    
    total_found++;
  } else {
    coord position = new_coord();
    position->row = 0;
    position->col = 1;
    backtrack(square_B, position);
  }
}