// seg004:0004 void __pascal far check_collisions() { short column; bump_col_left_of_wall = bump_col_right_of_wall = -1; if (Char.action == actions_7_turn) return; collision_row = Char.curr_row; move_coll_to_prev(); prev_collision_row = collision_row; right_checked_col = MIN(get_tile_div_mod_m7(char_x_right_coll) + 2, 11); left_checked_col = get_tile_div_mod_m7(char_x_left_coll) - 1; get_row_collision_data(collision_row , curr_row_coll_room, curr_row_coll_flags); get_row_collision_data(collision_row + 1, below_row_coll_room, below_row_coll_flags); get_row_collision_data(collision_row - 1, above_row_coll_room, above_row_coll_flags); for (column = 9; column >= 0; --column) { if (curr_row_coll_room[column] >= 0 && prev_coll_room[column] == curr_row_coll_room[column] ) { // char bumps into left of wall if ( (prev_coll_flags[column] & 0x0F) == 0 && (curr_row_coll_flags[column] & 0x0F) != 0 ) { bump_col_left_of_wall = column; } // char bumps into right of wall if ( (prev_coll_flags[column] & 0xF0) == 0 && (curr_row_coll_flags[column] & 0xF0) != 0 ) { bump_col_right_of_wall = column; } } } }
// seg002:0112 void __pascal far enter_guard() { word room_minus_1; word guard_tile; word frame; byte seq_hi; // arrays are indexed 0..23 instead of 1..24 room_minus_1 = drawn_room - 1; frame = Char.frame; // hm? guard_tile = level.guards_tile[room_minus_1]; if (guard_tile >= 30) return; Char.room = drawn_room; Char.curr_row = guard_tile / 10; Char.y = y_land[Char.curr_row + 1]; Char.x = level.guards_x[room_minus_1]; Char.curr_col = get_tile_div_mod_m7(Char.x); Char.direction = level.guards_dir[room_minus_1]; // only regular guards have different colors (and only on VGA) if (graphics_mode == gmMcgaVga && tbl_guard_type[current_level] == 0) { curr_guard_color = level.guards_color[room_minus_1]; } else { curr_guard_color = 0; } #ifdef REMEMBER_GUARD_HP int remembered_hp = (curr_guard_color & 0xF0) >> 4; #endif curr_guard_color &= 0x0F; // added; only least significant 4 bits are used for guard color // level 3 has skeletons with infinite lives if (current_level == 3) { Char.charid = charid_4_skeleton; } else { Char.charid = charid_2_guard; } seq_hi = level.guards_seq_hi[room_minus_1]; if (seq_hi == 0) { if (Char.charid == charid_4_skeleton) { Char.sword = sword_2_drawn; seqtbl_offset_char(seq_63_guard_stand_active); // stand active (when entering room) (skeleton) } else { Char.sword = sword_0_sheathed; seqtbl_offset_char(seq_77_guard_stand_inactive); // stand inactive (when entering room) } } else { Char.curr_seq = level.guards_seq_lo[room_minus_1] + (seq_hi << 8); } play_seq(); guard_skill = level.guards_skill[room_minus_1]; if (guard_skill >= 12) { guard_skill = 3; } frame = Char.frame; if (frame == frame_185_dead || frame == frame_177_spiked || frame == frame_178_chomped) { Char.alive = 1; draw_guard_hp(0, guardhp_curr); guardhp_curr = 0; } else { Char.alive = -1; justblocked = 0; guard_refrac = 0; is_guard_notice = 0; get_guard_hp(); #ifdef REMEMBER_GUARD_HP if (options.enable_remember_guard_hp && remembered_hp > 0) guardhp_delta = guardhp_curr = (word) remembered_hp; #endif } Char.fall_y = 0; Char.fall_x = 0; Char.action = actions_1_run_jump; saveshad(); }