mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2025-03-25 03:19:27 +00:00
Assorted Fixes
This commit is contained in:
parent
934df79f85
commit
e4ec69b6dc
|
@ -526,7 +526,15 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n046_hv_trigger(&mut self, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n046_hv_trigger(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
) -> GameResult {
|
||||
// Nicalis
|
||||
if state.constants.is_cs_plus && self.tsc_direction != 0 {
|
||||
self.direction = Direction::Right;
|
||||
}
|
||||
self.npc_flags.set_event_when_touched(true);
|
||||
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
|
|
@ -107,6 +107,11 @@ impl NPC {
|
|||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
) -> GameResult {
|
||||
// Nicalis
|
||||
if state.constants.is_cs_plus && self.tsc_direction != 0 {
|
||||
self.direction = Direction::Right;
|
||||
}
|
||||
|
||||
let player = self.get_closest_player_ref(&players);
|
||||
|
||||
match self.action_num {
|
||||
|
|
|
@ -288,7 +288,7 @@ impl GameEntity<([&mut Player; 2], &NPCList, &mut Stage, &mut BulletManager, &mu
|
|||
43 => self.tick_n043_chalkboard(state),
|
||||
44 => self.tick_n044_polish(state, npc_list),
|
||||
45 => self.tick_n045_baby(state),
|
||||
46 => self.tick_n046_hv_trigger(players),
|
||||
46 => self.tick_n046_hv_trigger(state, players),
|
||||
47 => self.tick_n047_sandcroc(state, players),
|
||||
48 => self.tick_n048_omega_projectiles(state),
|
||||
49 => self.tick_n049_skullhead(state, players, npc_list),
|
||||
|
|
|
@ -322,7 +322,8 @@ impl Player {
|
|||
if self.vel_y > 0x100 {
|
||||
self.vel_y /= 2;
|
||||
}
|
||||
} else if state.settings.infinite_booster || self.equip.has_booster_2_0() {
|
||||
}
|
||||
if state.settings.infinite_booster || self.equip.has_booster_2_0() {
|
||||
if self.controller.move_up() {
|
||||
self.booster_switch = BoosterSwitch::Up;
|
||||
self.vel_x = 0;
|
||||
|
@ -806,12 +807,14 @@ impl Player {
|
|||
self.anim_num = 0;
|
||||
self.anim_counter = 0;
|
||||
} else {
|
||||
self.skin.set_state(if self.vel_y > 0 {
|
||||
PlayerAnimationState::Jumping
|
||||
if self.vel_y > 0 {
|
||||
self.skin.set_state(PlayerAnimationState::Falling);
|
||||
self.anim_num = 1;
|
||||
} else {
|
||||
PlayerAnimationState::Falling
|
||||
});
|
||||
self.anim_num = 0;
|
||||
self.skin.set_state(PlayerAnimationState::Jumping);
|
||||
self.anim_num = 3;
|
||||
}
|
||||
self.anim_num = 1;
|
||||
self.anim_counter = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -142,8 +142,8 @@ impl PlayerSkin for BasicPlayerSkin {
|
|||
PlayerAnimationState::Examining => 7,
|
||||
PlayerAnimationState::Sitting => 8,
|
||||
PlayerAnimationState::Collapsed => 9,
|
||||
PlayerAnimationState::Jumping => 2,
|
||||
PlayerAnimationState::Falling => 1,
|
||||
PlayerAnimationState::Jumping => 1,
|
||||
PlayerAnimationState::Falling => 2,
|
||||
PlayerAnimationState::FallingLookingUp => 4,
|
||||
PlayerAnimationState::FallingLookingDown => 6,
|
||||
PlayerAnimationState::FallingUpsideDown => 10,
|
||||
|
|
|
@ -71,6 +71,7 @@ pub struct Weapon {
|
|||
pub experience: u16,
|
||||
pub ammo: u16,
|
||||
pub max_ammo: u16,
|
||||
refire_timer: u16,
|
||||
empty_counter: u16,
|
||||
counter1: u16,
|
||||
counter2: u16,
|
||||
|
@ -78,7 +79,7 @@ pub struct Weapon {
|
|||
|
||||
impl Weapon {
|
||||
pub fn new(wtype: WeaponType, level: WeaponLevel, experience: u16, ammo: u16, max_ammo: u16) -> Weapon {
|
||||
Weapon { wtype, level, experience, ammo, max_ammo, empty_counter: 0, counter1: 0, counter2: 0 }
|
||||
Weapon { wtype, level, experience, ammo, max_ammo, refire_timer: 0, empty_counter: 0, counter1: 0, counter2: 0 }
|
||||
}
|
||||
|
||||
/// Consume a specified amount of bullets, returns true if there was enough ammo.
|
||||
|
@ -105,6 +106,11 @@ impl Weapon {
|
|||
}
|
||||
}
|
||||
|
||||
/// Set refire timer
|
||||
pub fn set_refire_timer(&mut self) {
|
||||
self.refire_timer = 4;
|
||||
}
|
||||
|
||||
/// Refill a specified amount of bullets.
|
||||
pub fn refill_ammo(&mut self, amount: u16) {
|
||||
if self.max_ammo != 0 {
|
||||
|
@ -168,6 +174,13 @@ impl Weapon {
|
|||
}
|
||||
|
||||
self.empty_counter = self.empty_counter.saturating_sub(1);
|
||||
self.refire_timer = self.refire_timer.saturating_sub(1);
|
||||
|
||||
if self.refire_timer > 0 {
|
||||
return;
|
||||
} else if player.controller.trigger_shoot() {
|
||||
self.refire_timer = 4;
|
||||
}
|
||||
|
||||
// todo lua hook
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ impl Weapon {
|
|||
}
|
||||
Direction::Left => {
|
||||
bullet_manager.create_bullet(
|
||||
player.x - 0x1800,
|
||||
player.x - 0xC00,
|
||||
player.y + 0x600,
|
||||
btype,
|
||||
player_id,
|
||||
|
@ -139,7 +139,7 @@ impl Weapon {
|
|||
}
|
||||
Direction::Right => {
|
||||
bullet_manager.create_bullet(
|
||||
player.x + 0x1800,
|
||||
player.x + 0xC00,
|
||||
player.y + 0x600,
|
||||
btype,
|
||||
player_id,
|
||||
|
|
Loading…
Reference in a new issue