void break_spikes_floor (struct pos *p) { struct spikes_floor *s = spikes_floor_at_pos (p); if (! s) return; if (s->murdered_anim != -1) anim_die_suddenly (get_anim_by_id (s->murdered_anim)); remove_spikes_floor (s); }
void compute_loose_floor_fall (struct loose_floor *l) { int speed = 3 * ++l->i; if (speed > 29) speed = 29; struct frame nf; struct frame_offset fo; fo.b = l->f.b; fo.dx = 0; fo.dy = speed; next_frame (&l->f, &nf, &fo); struct coord mbo_f, mbo_nf; struct pos fpmbo_f, nfpmbo_f, fpmbo_nf, nfpmbo_nf; enum confg fcmbo_f; fcmbo_f = survey (_mbo, posf, &l->f, &mbo_f, &fpmbo_f, &nfpmbo_f)->fg; survey (_mbo, posf, &nf, &mbo_nf, &fpmbo_nf, &nfpmbo_nf); struct pos p; /* hit kid */ int i; for (i = 0; i < anima_nmemb; i++) { struct coord kmt, ambo_f, ambo_nf; struct pos np, kpmt; struct anim *a = &anima[i]; if (is_anim_dead (&a->f) || a->immortal || a->loose_floor_immune) continue; survey (_mt, pos, &a->f, &kmt, &kpmt, &np); coord2room (&mbo_f, kpmt.room, &ambo_f); coord2room (&mbo_nf, kpmt.room, &ambo_nf); if (peq (&nfpmbo_f, &kpmt) && ambo_f.y <= kmt.y && ambo_nf.y >= kmt.y && ! a->hit_by_loose_floor && ! is_kid_hang_or_climb (&a->f) && ! is_kid_fall (&a->f)) { a->hit_by_loose_floor = true; a->splash = true; a->current_lives--; a->uncouch_slowly = true; /* ensure kid doesn't couch in thin air (might occur when hit while jumping, for example) */ place_on_the_ground (&a->f, &a->f.c); play_sample (hit_wall_sample, kpmt.room); alert_guards (&kpmt); if (a->id == current_kid_id) { video_effect.color = get_flicker_blood_color (); start_video_effect (VIDEO_FLICKERING, SECS_TO_VCYCLES (0.1)); } if (a->current_lives <= 0) { a->p = kpmt; anim_die_suddenly (a); a->death_reason = LOOSE_FLOOR_DEATH; } else if (a->type == KID) kid_couch (a); } } /* fall */ if (is_strictly_traversable (&fpmbo_f) || peq (&fpmbo_f, &fpmbo_nf)) { /* the floor hit a rigid structure */ if (is_rigid_con (&fpmbo_nf)) prel (&fpmbo_nf, &p, -1, 0); /* the floor continue to fall */ else { l->f = nf; if (is_strictly_traversable (&fpmbo_nf)) l->p = fpmbo_nf; must_sort = true; return; } /* the floor hit the ground */ } else { struct loose_floor *m; p = fpmbo_f; switch (fcmbo_f) { case LOOSE_FLOOR: /* loose floor isn't ground */ m = loose_floor_at_pos (&fpmbo_f); if (m) m->p.room = -1; must_remove = true; l->f = nf; l->f.b = get_correct_falling_loose_floor_bitmap (dv_broken_floor); l->p = fpmbo_f; l->i = 0; con (&fpmbo_f)->fg = NO_FLOOR; must_sort = true; play_sample (broken_floor_sample, p.room); alert_guards (&p); return; case OPENER_FLOOR: break_opener_floor (&fpmbo_f); break; case CLOSER_FLOOR: break_closer_floor (&fpmbo_f); break; case SPIKES_FLOOR: break_spikes_floor (&fpmbo_f); break; case LEVEL_DOOR: break_level_door (&fpmbo_f); break; default: break; } } /* reach here only if the floor hit a rigid structure or the ground */ if (con (&p)->fg != LEVEL_DOOR) con (&p)->fg = BROKEN_FLOOR; shake_loose_floor_row (&p); l->p.room = -1; must_remove = true; must_sort = true; play_sample (broken_floor_sample, p.room); alert_guards (&p); }