struct opener_floor * opener_floor_by_event (struct pos *p, int event, int dir) { struct opener_floor *o; if (p) o = opener_floor_at_pos (p); else o = &opener_floor[0]; if (! o) { o = &opener_floor[0]; p = NULL; } int i; if (dir < 0) for (i = o - opener_floor - (p ? 1 : 0); i >= 0; i--) { if (opener_floor[i].event == event) return &opener_floor[i]; } else for (i = o - opener_floor + (p ? 1 : 0); i < opener_floor_nmemb; i++) { if (opener_floor[i].event == event) return &opener_floor[i]; } return NULL; }
void break_opener_floor (struct pos *p) { struct opener_floor *o = opener_floor_at_pos (p); if (! o) return; o->broken = true; }
void press_opener_floor (struct pos *p) { struct opener_floor *o = opener_floor_at_pos (p); if (! o) return; o->pressed = true; }
void draw_opener_floor_right (ALLEGRO_BITMAP *bitmap, struct pos *p, enum em em, enum vm vm) { struct opener_floor *o = opener_floor_at_pos (p); if (! o) return; if (o->broken) return; if (o->pressed) draw_floor_right (bitmap, p, em, vm); else draw_unpressed_opener_floor_right (bitmap, p, em, vm); }
void break_opener_floor (struct pos *p) { struct opener_floor *o = opener_floor_at_pos (p); if (! o) return; open_door (o->p.l, o->event, anim_cycle, true); register_con_undo (&undo, p, MIGNORE, MIGNORE, o->event + EVENTS, MIGNORE, NULL, false, "LOOSE FLOOR BREAKING"); o->broken = true; }
void draw_opener_floor_fg (ALLEGRO_BITMAP *bitmap, struct pos *p, enum em em, enum vm vm) { if (is_fake (p)) return; struct opener_floor *o = opener_floor_at_pos (p); if (! o) return; if (o->broken) { draw_broken_floor_fg (bitmap, p, em, vm); return; } }
void press_opener_floor (struct pos *p) { struct opener_floor *o = opener_floor_at_pos (p); if (! o) return; if (o->broken) return; o->pressed = true; if (! o->prev_pressed) { register_changed_pos (&o->p); o->prev_pressed = true; o->priority = anim_cycle; } }
void draw_opener_floor_left (ALLEGRO_BITMAP *bitmap, struct pos *p, enum em em, enum vm vm) { if (is_fake (p)) { draw_unpressed_opener_floor_left (bitmap, p, em, vm); return; } struct opener_floor *o = opener_floor_at_pos (p); if (! o) return; if (o->broken) { draw_broken_floor_left (bitmap, p, em, vm); return; } if (o->pressed) draw_floor_left (bitmap, p, em, vm); else draw_unpressed_opener_floor_left (bitmap, p, em, vm); }