Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Olimar Bugfixes #2259

Merged
merged 2 commits into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions dynamic/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,12 @@ pub mod vars {
// flags
pub const SPECIAL_HI_CANCEL_ESCAPE_AIR: i32 = 0x0100;
}
pub mod status {
// flags
pub const SPECIAL_S_PIKMIN_DETONATE_IS_ATTACK_LAST_FRAME: i32 = 0x1100;
// ints
pub const SPECIAL_S_PIKMIN_DETONATE_TIMER: i32 = 0x1101;
}
}

pub mod ptrainer {
Expand Down
12 changes: 6 additions & 6 deletions fighters/pikmin/src/pikmin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ impl From<i32> for PikminInfo {
fn from(other: i32) -> Self {
match other {
0 => PikminInfo { // Red
dmg: 1.0,
dmg: 1.05,
shield_dmg: 0.25,
angle: 0,
hitlag: 1.0,
attr: Hash40::new("collision_attr_fire"),
attr_special: Hash40::new("collision_attr_fire"),
sound: *COLLISION_SOUND_ATTR_FIRE,
color: Vector3f{x: 1.0, y: 0.05, z: 0.0},
cling_frame: 30 * 4
cling_frame: 5
},
1 => PikminInfo { // yellow
dmg: 0.94,
Expand All @@ -38,7 +38,7 @@ impl From<i32> for PikminInfo {
attr_special: Hash40::new("collision_attr_paralyze"),
sound: *COLLISION_SOUND_ATTR_ELEC,
color: Vector3f{x: 1.0, y: 1.0, z: 0.14},
cling_frame: 30 * 6
cling_frame: 7
},
2 => PikminInfo { // Blue
dmg: 1.0,
Expand All @@ -49,7 +49,7 @@ impl From<i32> for PikminInfo {
attr_special: Hash40::new("collision_attr_water"),
sound: *COLLISION_SOUND_ATTR_WATER,
color: Vector3f{x: 0.1, y: 0.4, z: 1.0},
cling_frame: 30 * 4
cling_frame: 5
},
3 => PikminInfo { // White
dmg: 0.75,
Expand All @@ -60,7 +60,7 @@ impl From<i32> for PikminInfo {
attr_special: Hash40::new("collision_attr_flower"),
sound: *COLLISION_SOUND_ATTR_FIRE,
color: Vector3f{x: 1.0, y: 1.0, z: 1.0},
cling_frame: 30 * 2
cling_frame: 3
},
_ => PikminInfo { // Violet (Rock), also default
dmg: 1.2,
Expand All @@ -71,7 +71,7 @@ impl From<i32> for PikminInfo {
attr_special: Hash40::new("collision_attr_normal"),
sound: *COLLISION_SOUND_ATTR_KICK,
color: Vector3f{x: 0.36, y: 0.0, z: 1.0},
cling_frame: 30 * 999
cling_frame: 999
},
}
}
Expand Down
16 changes: 14 additions & 2 deletions fighters/pikmin/src/pikmin/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ pub unsafe fn special_s_cling_main(fighter: &mut L2CFighterCommon) -> L2CValue {
let founder_power_mul_status = AttackModule::power_mul_status(founder_module_accessor);
AttackModule::set_power_mul_status(fighter.module_accessor, founder_power_mul_status);
}

let variation = fighter.get_int(*WEAPON_PIKMIN_PIKMIN_INSTANCE_WORK_ID_INT_VARIATION);
let p = PikminInfo::from(variation);
VarModule::set_int(fighter.battle_object, vars::pikmin::status::SPECIAL_S_PIKMIN_DETONATE_TIMER, 0);
VarModule::off_flag(fighter.battle_object, vars::pikmin::status::SPECIAL_S_PIKMIN_DETONATE_IS_ATTACK_LAST_FRAME);

fighter.fastshift(L2CValue::Ptr(special_s_cling_main_loop as *const () as _))
}

Expand All @@ -40,8 +46,14 @@ unsafe extern "C" fn special_s_cling_main_loop(fighter: &mut L2CFighterCommon) -
fighter.set_int(clatter_time as i32, *WEAPON_PIKMIN_PIKMIN_STATUS_SPECIAL_S_WORK_INT_CLATTER_TIME);
let variation = fighter.get_int(*WEAPON_PIKMIN_PIKMIN_INSTANCE_WORK_ID_INT_VARIATION);
let p = PikminInfo::from(variation);
if fighter.status_frame() >= p.cling_frame
&& frame >= 17.0 {

let is_attack = AttackModule::is_attack(fighter.module_accessor, 0, false);
if is_attack && !VarModule::is_flag(fighter.battle_object, vars::pikmin::status::SPECIAL_S_PIKMIN_DETONATE_IS_ATTACK_LAST_FRAME) {
VarModule::inc_int(fighter.battle_object, vars::pikmin::status::SPECIAL_S_PIKMIN_DETONATE_TIMER);
}
VarModule::set_flag(fighter.battle_object, vars::pikmin::status::SPECIAL_S_PIKMIN_DETONATE_IS_ATTACK_LAST_FRAME, is_attack);

if VarModule::get_int(fighter.battle_object, vars::pikmin::status::SPECIAL_S_PIKMIN_DETONATE_TIMER) >= p.cling_frame{
fighter.change_status(WEAPON_PIKMIN_PIKMIN_STATUS_KIND_SPECIAL_S_CLING_REMOVE.into(), false.into());
return 1.into();
}
Expand Down
2 changes: 1 addition & 1 deletion romfs/source/fighter/pikmin/param/vl.prcxml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<hash40 index="2">dummy</hash40>
<hash40 index="3">dummy</hash40>
</list>
<list hash="param_pikmin_particular">
<list hash="param_pikmin">
<struct index="0">
<int hash="special_s_lever_clatter_frame">0</int>
<int hash="special_s_damage_remove_rate">0</int>
Expand Down
Loading