Esempio n. 1
0
File: seg004.c Progetto: 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();
				}
			}
		}
	}
}
Esempio n. 2
0
// 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();
				}
			}
		}
	}
}
Esempio n. 3
0
File: seg004.c Progetto: kees/SDLPoP
// 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;
		}
	}
}
Esempio n. 4
0
File: seg004.c Progetto: kees/SDLPoP
// seg004:037E
int __pascal far is_obstacle() {
	if (curr_tile2 == tiles_10_potion) {
		return 0;
	} else if (curr_tile2 == tiles_4_gate) {
		if (! can_bump_into_gate()) return 0;
	} else if (curr_tile2 == tiles_18_chomper) {
		// is the chomper closed?
		if (curr_room_modif[curr_tilepos] != 2) return 0;
	} else if (
		curr_tile2 == tiles_13_mirror &&
		Char.charid == charid_0_kid &&
		Char.frame >= 39 && Char.frame < 44 && // run-jump
		Char.direction < dir_0_right // right-to-left only
	) {
		curr_room_modif[curr_tilepos] = 0x56; // broken mirror or what?
		jumped_through_mirror = -1;
		return 0;
	}
	coll_tile_left_xpos = xpos_in_drawn_room(x_bump[tile_col + 5]) + 7;
	return 1;
}
Esempio n. 5
0
File: seg004.c Progetto: kees/SDLPoP
// seg004:0833
void __pascal far check_gate_push() {
	// Closing gate pushes Kid
	short frame;
	short var_4;
	frame = Char.frame;
	if (Char.action == actions_7_turn ||
		frame == 15 || // stand
		(frame >= 108 && frame < 111) // crouch
	) {
		get_tile_at_char();
		var_4 = tile_col;
		if ((curr_tile2 == tiles_4_gate ||
			get_tile(curr_room, --tile_col, tile_row) == tiles_4_gate) &&
			(curr_row_coll_flags[tile_col] & prev_coll_flags[tile_col]) == 0xFF && 
			can_bump_into_gate()
		) {
			bumped_sound();
			// push Kid left if var_4 <= tile_col, gate at char's tile
			// push Kid right if var_4 > tile_col, gate is left from char's tile
			Char.x += 5 - (var_4 <= tile_col) * 10;
		}
	}
}