예제 #1
0
파일: seg004.c 프로젝트: kees/SDLPoP
// seg004:08C3
void __pascal far check_guard_bumped() {
	short var_2;
	if (
		word_1F950 == 0 &&
		Char.action == actions_1_run_jump &&
		Char.alive < 0 &&
		Char.sword >= sword_2_drawn
	) {
		if (
			get_tile_at_char() == tiles_20_wall ||
			curr_tile2 == tiles_7_doortop_with_floor ||
			(curr_tile2 == tiles_4_gate && can_bump_into_gate()) ||
			(Char.direction >= dir_0_right && (
				get_tile(curr_room, --tile_col, tile_row) == tiles_7_doortop_with_floor ||
				(curr_tile2 == tiles_4_gate && can_bump_into_gate())
			))
		) {
			load_frame_to_obj();
			set_char_collision();
			if (is_obstacle()) {
				var_2 = dist_from_wall_behind(curr_tile2);
				if (var_2 < 0 && var_2 > -13) {
					Char.x = char_dx_forward(-var_2);
					seqtbl_offset_char(65); // pushed to wall with sword (Guard)
					play_seq();
					load_fram_det_col();
				}
			}
		}
	}
}
예제 #2
0
파일: seg002.c 프로젝트: mfn/SDLPoP
// seg002:03C7
void __pascal far exit_room() {
	word leave;
	word kid_room_m1;
	leave = 0;
	if (exit_room_timer != 0) {
		--exit_room_timer;
		return;
	}
	loadkid();
	load_frame_to_obj();
	set_char_collision();
	roomleave_result = leave_room();
	if (roomleave_result < 0) {
		return;
	}
	savekid();
	next_room = Char.room;
	if (Guard.direction == dir_56_none) return;
	if (Guard.alive < 0 && Guard.sword == sword_2_drawn) {
		kid_room_m1 = Kid.room - 1;
		if (level.guards_tile[kid_room_m1] >= 30 ||
			level.guards_seq_hi[kid_room_m1] != 0
		) {
			if (roomleave_result == 0) {
				// left
				if (Guard.x >= 91) leave = 1;
				#ifdef FIX_GUARD_FOLLOWING_THROUGH_CLOSED_GATES
				else if (options.fix_guard_following_through_closed_gates && can_guard_see_kid != 2 &&
						Kid.sword != sword_2_drawn) {
					leave = 1;
				}
				#endif
			} else if (roomleave_result == 1) {
				// right
				if (Guard.x < 165) leave = 1;
				#ifdef FIX_GUARD_FOLLOWING_THROUGH_CLOSED_GATES
				else if (options.fix_guard_following_through_closed_gates && can_guard_see_kid != 2 &&
						 Kid.sword != sword_2_drawn) {
					leave = 1;
				}
				#endif
			} else if (roomleave_result == 2) {
				// up
				if (Guard.curr_row >= 0) leave = 1;
			} else {
				// down
				if (Guard.curr_row < 3) leave = 1;
			}
		} else {
			leave = 1;
		}
	} else {
		leave = 1;
	}
	if (leave) {
		leave_guard();
	} else {
		follow_guard();
	}
}
예제 #3
0
파일: seg000.c 프로젝트: diddledan/SDLPoP
// seg000:0EA8
// returns 1 if level is restarted, 0 otherwise
int __pascal far play_kid_frame() {
	loadkid_and_opp();
	load_fram_det_col();
	check_killed_shadow();
	play_kid();
	if (upside_down && Char.alive >= 0) {
		upside_down = 0;
		need_redraw_because_flipped = 1;
	}
	if (is_restart_level) {
		return 1;
	}
	if (Char.room != 0) {
		play_seq();
		fall_accel();
		fall_speed();
		load_frame_to_obj();
		load_fram_det_col();
		set_char_collision();
		bump_into_opponent();
		check_collisions();
		check_bumped();
		check_gate_push();
		check_action();
		check_press();
		check_spike_below();
		if (resurrect_time == 0) {
			check_spiked();
			check_chomped_kid();
		}
		check_knock();
	}
	savekid();
	return 0;
}
예제 #4
0
파일: seg000.c 프로젝트: diddledan/SDLPoP
// seg000:0F48
void __pascal far play_guard_frame() {
	if (Guard.direction != dir_56_none) {
		loadshad_and_opp();
		load_fram_det_col();
		check_killed_shadow();
		play_guard();
		if (Char.room == drawn_room) {
			play_seq();
			if (Char.x >= 44 && Char.x < 211) {
				fall_accel();
				fall_speed();
				load_frame_to_obj();
				load_fram_det_col();
				set_char_collision();
				check_guard_bumped();
				check_action();
				check_press();
				check_spike_below();
				check_spiked();
				check_chomped_guard();
			}
		}
		saveshad();
	}
}
예제 #5
0
파일: seg001.c 프로젝트: ecalot/SDLPoP
// seg001:0156
void __pascal far draw_princess_room_bg() {
	memset_near(table_counts, 0, sizeof(table_counts));
	loadkid();
	if (Char.frame) {
		load_frame_to_obj();
		obj_tilepos = 30;
		add_objtable(0);
	}
	loadshad();
	if (Char.frame) {
		load_frame_to_obj();
		obj_tilepos = 30;
		add_objtable(0);
	}
	redraw_needed_tiles();
	add_foretable(id_chtab_8_princessroom, 2 /*pillar piece*/, 30, 0, 167, blitters_10h_transp, 0);
	princess_room_torch();
	draw_hourglass();
	draw_tables();
}
예제 #6
0
파일: seg004.c 프로젝트: Falcury/SDLPoP
// seg004:08C3
void __pascal far check_guard_bumped() {
	if (
		Char.action == actions_1_run_jump &&
		Char.alive < 0 &&
		Char.sword >= sword_2_drawn
	) {
		if (

			#ifdef FIX_PUSH_GUARD_INTO_WALL
			// Should also check for a wall BEHIND the guard, instead of only the current tile
			(fixes->fix_push_guard_into_wall && get_tile_behind_char() == tiles_20_wall) ||
			#endif

			get_tile_at_char() == tiles_20_wall ||
			curr_tile2 == tiles_7_doortop_with_floor ||
			(curr_tile2 == tiles_4_gate && can_bump_into_gate()) ||
			(Char.direction >= dir_0_right && (
				get_tile(curr_room, --tile_col, tile_row) == tiles_7_doortop_with_floor ||
				(curr_tile2 == tiles_4_gate && can_bump_into_gate())
			))
		) {
			load_frame_to_obj();
			set_char_collision();
			if (is_obstacle()) {
				short delta_x;
				delta_x = dist_from_wall_behind(curr_tile2);
				if (delta_x < 0 && delta_x > -13) {
					Char.x = char_dx_forward(-delta_x);
					seqtbl_offset_char(seq_65_bump_forward_with_sword); // pushed to wall with sword (Guard)
					play_seq();
					load_fram_det_col();
				}
			}
		}
	}
}
예제 #7
0
파일: seg004.c 프로젝트: kees/SDLPoP
// 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;
}