Drowning fixes

This commit is contained in:
dawnDus 2022-02-14 20:03:24 -05:00
parent 38efa5ded9
commit e6632a845d
No known key found for this signature in database
GPG Key ID: 972AABDE81848F21
4 changed files with 19 additions and 2 deletions

View File

@ -170,8 +170,11 @@ impl Player {
} else if state.get_flag(4000) {
state.textscript_vm.start_script(1100);
} else {
self.cond.set_hidden(true);
state.create_caret(self.x, self.y, CaretType::DrownedQuote, self.direction);
// Switch uses player sprite for drowned effect
if !state.constants.is_switch {
self.cond.set_hidden(true);
state.create_caret(self.x, self.y, CaretType::DrownedQuote, self.direction);
}
state.textscript_vm.start_script(41);
}
} else {
@ -778,6 +781,12 @@ impl Player {
} else {
PlayerAppearanceState::Default
});
if state.constants.is_switch && self.air == 0 && self.flags.in_water() && !state.get_flag(4000) {
self.skin.set_appearance(PlayerAppearanceState::Default);
self.skin.set_state(PlayerAnimationState::Drowned);
}
self.anim_rect = self.skin.animation_frame();
self.tick = self.tick.wrapping_add(1);

View File

@ -138,6 +138,7 @@ impl PlayerSkin for BasicPlayerSkin {
PlayerAnimationState::FallingLookingUp => 4,
PlayerAnimationState::FallingLookingDown => 6,
PlayerAnimationState::FallingUpsideDown => 10,
PlayerAnimationState::Drowned => 11,
};
let y_offset = if direction == Direction::Left { 0 } else { self.metadata.frame_size_height }

View File

@ -28,6 +28,7 @@ pub enum PlayerAnimationState {
FallingLookingUp,
FallingLookingDown,
FallingUpsideDown,
Drowned,
}
/// Represents an alternative appearance of player eg. wearing a Mimiga Mask

View File

@ -1587,6 +1587,9 @@ impl TextScriptVM {
exec_state = TextScriptExecutionState::Running(event, cursor.position() as u32);
}
TSCOpCode::INI => {
game_scene.player1.flags.0 = 0;
game_scene.player2.flags.0 = 0;
exec_state = TextScriptExecutionState::Reset;
}
TSCOpCode::ESC => {
@ -1601,6 +1604,9 @@ impl TextScriptVM {
exec_state = TextScriptExecutionState::SaveProfile(event, cursor.position() as u32);
}
TSCOpCode::LDP => {
game_scene.player1.flags.0 = 0;
game_scene.player2.flags.0 = 0;
state.control_flags.set_tick_world(false);
state.control_flags.set_control_enabled(false);
state.control_flags.set_interactions_disabled(true);