// seg002:09F8 void __pascal far guard_follows_kid_down() { // This is called from autocontrol_guard_active, so char=Guard, Opp=Kid word opp_action; opp_action = Opp.action; if (opp_action == actions_2_hang_climb || opp_action == actions_6_hang_straight) { return; } if (// there is wall in front of Guard wall_type(get_tile_infrontof_char()) != 0 || (! tile_is_floor(curr_tile2) && ( (get_tile(curr_room, tile_col, ++tile_row) == tiles_2_spike || // Guard would fall on loose floor curr_tile2 == tiles_11_loose || // ... or wall (?) wall_type(curr_tile2) != 0 || // ... or into a chasm ! tile_is_floor(curr_tile2)) || // ... or Kid is not below Char.curr_row + 1 != Opp.curr_row )) ) { // don't follow droppedout = 0; move_2_backward(); } else { // follow move_1_forward(); } }
// seg004:025F int __pascal far get_right_wall_xpos(int room,int column,int row) { short type; type = wall_type(get_tile(room, column, row)); if (type) { return coll_tile_left_xpos - wall_dist_from_right[type] + 13; } else { return 0; } }
// seg004:0226 int __pascal far get_left_wall_xpos(int room,int column,int row) { short type; type = wall_type(get_tile(room, column, row)); if (type) { return wall_dist_from_left[type] + coll_tile_left_xpos; } else { return 0xFF; } }
// seg004:0A7B int __pascal far dist_from_wall_behind(byte tiletype) { short type; type = wall_type(tiletype); if (type == 0) { return 99; } else { if (Char.direction >= dir_0_right) { // looking right //return wall_dist_from_right[type] + char_x_left_coll - coll_tile_left_xpos - 13; return char_x_left_coll - (coll_tile_left_xpos + 13 - wall_dist_from_right[type]); } else { // looking left return wall_dist_from_left[type] + coll_tile_left_xpos - char_x_right_coll; } } }
// seg004:0A10 int __pascal far dist_from_wall_forward(byte tiletype) { short type; if (tiletype == tiles_4_gate && ! can_bump_into_gate()) { return -1; } else { coll_tile_left_xpos = x_bump[tile_col + 5] + 7; type = wall_type(tiletype); if (type == 0) return -1; if (Char.direction < dir_0_right) { // looking left //return wall_dist_from_right[type] + char_x_left_coll - coll_tile_left_xpos - 13; return char_x_left_coll - (coll_tile_left_xpos + 13 - wall_dist_from_right[type]); } else { // looking right return wall_dist_from_left[type] + coll_tile_left_xpos - char_x_right_coll; } } }
// seg004:067C int __pascal far get_edge_distance() { /* Possible results in edge_type: 0: closer/sword/potion 1: edge 2: floor (nothing near char) */ short distance; byte tiletype; determine_col(); load_frame_to_obj(); set_char_collision(); tiletype = get_tile_at_char(); if (wall_type(tiletype) != 0) { tile_col = Char.curr_col; distance = dist_from_wall_forward(tiletype); if (distance >= 0) { loc_59DD: if (distance < 14) { edge_type = 1; } else { edge_type = 2; distance = 11; } } else { goto loc_59E8; } } else { loc_59E8: tiletype = get_tile_infrontof_char(); if (tiletype == tiles_12_doortop && Char.direction >= dir_0_right) { loc_59FB: edge_type = 0; distance = distance_to_edge_weight(); } else { if (wall_type(tiletype) != 0) { tile_col = byte_20C62; distance = dist_from_wall_forward(tiletype); if (distance >= 0) goto loc_59DD; } if (tiletype == tiles_11_loose) goto loc_59FB; if ( tiletype == tiles_6_closer || tiletype == tiles_22_sword || tiletype == tiles_10_potion ) { distance = distance_to_edge_weight(); if (distance != 0) { edge_type = 0; } else { edge_type = 2; distance = 11; } } else { if (tile_is_floor(tiletype)) { edge_type = 2; distance = 11; } else { goto loc_59FB; } } } } curr_tile2 = tiletype; return distance; }