Ejemplo n.º 1
0
Archivo: seg004.c Proyecto: kees/SDLPoP
// seg004:0989
void __pascal far check_chomped_guard() {
	get_tile_at_char();
	if ( ! check_chomped_here()) {
		get_tile(curr_room, ++tile_col, tile_row);
		check_chomped_here();
	}
}
Ejemplo n.º 2
0
Archivo: seg004.c Proyecto: 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();
				}
			}
		}
	}
}
Ejemplo n.º 3
0
Archivo: seg002.c Proyecto: mfn/SDLPoP
// seg002:0BCD
void __pascal far hurt_by_sword() {
	short distance;
	if (Char.alive >= 0) return;
	if (Char.sword != sword_2_drawn) {
		// Being hurt when not in fighting pose means death.
		take_hp(100);
		seqtbl_offset_char(seq_85_stabbed_to_death); // dying (stabbed unarmed)
		loc_4276:
		if (get_tile_behind_char() != 0 ||
			(distance = distance_to_edge_weight()) < 4
		) {
			seqtbl_offset_char(seq_85_stabbed_to_death); // dying (stabbed)
			if (Char.charid != charid_0_kid &&
				Char.direction < dir_0_right && // looking left
				(curr_tile2 == tiles_4_gate || get_tile_at_char() == tiles_4_gate)
			) {
				Char.x = x_bump[tile_col - (curr_tile2 != tiles_4_gate) + 5] + 7;
				Char.x = char_dx_forward(10);
			}
			Char.y = y_land[Char.curr_row + 1];
			Char.fall_y = 0;
		} else {
			Char.x = char_dx_forward(distance - 20);
			load_fram_det_col();
			inc_curr_row();
			seqtbl_offset_char(seq_81_kid_pushed_off_ledge); // Kid/Guard is killed and pushed off the ledge
		}
	} else {
		// You can't hurt skeletons
		if (Char.charid != charid_4_skeleton) {
			if (take_hp(1)) goto loc_4276;
		}
		seqtbl_offset_char(seq_74_hit_by_sword); // being hit with sword
		Char.y = y_land[Char.curr_row + 1];
		Char.fall_y = 0;
	}
	// sound 13: Kid hurt (by sword), sound 12: Guard hurt (by sword)
	play_sound(Char.charid == charid_0_kid ? sound_13_kid_hurt : sound_12_guard_hurt);
	play_seq();
}
Ejemplo n.º 4
0
Archivo: seg004.c Proyecto: 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;
		}
	}
}
Ejemplo n.º 5
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();
				}
			}
		}
	}
}
Ejemplo n.º 6
0
Archivo: seg004.c Proyecto: 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;
}