Skip to content

Commit 5c3bbdc

Browse files
committed
Update special_s.rs
1 parent 04cf667 commit 5c3bbdc

File tree

1 file changed

+30
-17
lines changed

1 file changed

+30
-17
lines changed

fighters/koopa/src/status/special_s.rs

+30-17
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
11
use super::*;
22
use globals::*;
33

4+
5+
pub const SPECIAL_S_KIND_F: i32 = 1;
6+
pub const SPECIAL_S_KIND_B: i32 = 2;
7+
pub const SPECIAL_S_KIND_LW_G: i32 = 3;
8+
pub const SPECIAL_S_KIND_LW_A: i32 = 4;
9+
410
unsafe extern "C" fn specials_situation_helper(fighter: &mut L2CFighterCommon, is_start: bool) {
511
let motion_g;
612
let motion_a;
713
let throw_input = VarModule::get_int(fighter.battle_object, vars::koopa::instance::SPECIAL_S_THROW_TYPE);
8-
let is_Ground = StatusModule::situation_kind(fighter.module_accessor) == *SITUATION_KIND_GROUND;
14+
let is_Ground = fighter.is_situation(*SITUATION_KIND_GROUND);
915

10-
if throw_input == -2 {
11-
motion_g = Hash40::new("special_s_throwlw");
16+
if throw_input == SPECIAL_S_KIND_LW_A {
17+
motion_g = Hash40::new("special_air_s_squat");
1218
motion_a = Hash40::new("special_air_s_squat");
1319
}
14-
else if throw_input > 0 {
20+
else if throw_input == SPECIAL_S_KIND_LW_G {
21+
motion_g = Hash40::new("special_s_throwlw");
22+
motion_a = Hash40::new("special_s_throwlw");
23+
}
24+
else if throw_input == SPECIAL_S_KIND_F {
1525
motion_g = Hash40::new("special_s_throwf");
1626
motion_a = Hash40::new("special_air_s_throwf");
1727
}
18-
else if throw_input < 0 {
28+
else if throw_input == SPECIAL_S_KIND_B {
1929
motion_g = Hash40::new("special_s_throwb");
2030
motion_a = Hash40::new("special_air_s_throwb");
2131
}
@@ -88,7 +98,7 @@ unsafe extern "C" fn specials_situation_helper(fighter: &mut L2CFighterCommon, i
8898

8999
unsafe extern "C" fn special_s_kinetic_exec(fighter: &mut L2CFighterCommon) {
90100
let is_Ground = StatusModule::situation_kind(fighter.module_accessor) == *SITUATION_KIND_GROUND;
91-
let is_Landing = VarModule::get_int(fighter.battle_object, vars::koopa::instance::SPECIAL_S_THROW_TYPE) == -2;
101+
let is_Landing = VarModule::get_int(fighter.battle_object, vars::koopa::instance::SPECIAL_S_THROW_TYPE) == SPECIAL_S_KIND_LW_A;
92102
if is_Ground || is_Landing {
93103
if !KineticModule::is_enable_energy(fighter.module_accessor, *FIGHTER_KINETIC_ENERGY_ID_GRAVITY) {
94104
KineticModule::unable_energy(fighter.module_accessor, *FIGHTER_KINETIC_ENERGY_ID_GRAVITY);
@@ -201,18 +211,21 @@ unsafe extern "C" fn specials_squat_main_loop(fighter: &mut L2CFighterCommon) ->
201211
let throw_Lw = ControlModule::get_stick_y(fighter.module_accessor) < WorkModule::get_param_float(fighter.module_accessor,hash40("common"), hash40("attack_lw4_stick_y"));
202212

203213
let mut throw_input = 1;
204-
if throw_Lw {
205-
throw_input = -2;
206-
fighter.change_status(FIGHTER_KOOPA_STATUS_KIND_SPECIAL_S_JUMP.into(),false.into());
214+
let mut next_status = FIGHTER_KOOPA_STATUS_KIND_SPECIAL_S_LANDING;
215+
if throw_Lw && fighter.is_situation(*SITUATION_KIND_AIR) {
216+
throw_input = SPECIAL_S_KIND_LW_A;
217+
next_status = FIGHTER_KOOPA_STATUS_KIND_SPECIAL_S_JUMP;
218+
}
219+
else if throw_Lw {
220+
throw_input = SPECIAL_S_KIND_LW_G;
207221
}
208222
else {
209223
let throw_F = PostureModule::lr(fighter.module_accessor).signum() == ControlModule::get_stick_x(fighter.module_accessor).signum()
210224
|| ControlModule::get_stick_x(fighter.module_accessor).abs() < 0.2;
211-
throw_input = if throw_F {1} else {-1};
225+
throw_input = if throw_F {SPECIAL_S_KIND_F} else {SPECIAL_S_KIND_B};
212226
}
213227

214228
VarModule::set_int(fighter.battle_object, vars::koopa::instance::SPECIAL_S_THROW_TYPE,throw_input);
215-
let next_status = if throw_Lw {FIGHTER_KOOPA_STATUS_KIND_SPECIAL_S_JUMP} else {FIGHTER_KOOPA_STATUS_KIND_SPECIAL_S_LANDING};
216229
fighter.change_status(next_status.into(),false.into());
217230
return 0.into();
218231
}
@@ -336,7 +349,7 @@ unsafe fn specials_landing_init(fighter: &mut L2CFighterCommon) -> L2CValue {
336349

337350
#[status_script(agent = "koopa", status = FIGHTER_KOOPA_STATUS_KIND_SPECIAL_S_LANDING, condition = LUA_SCRIPT_STATUS_FUNC_STATUS_PRE)]
338351
unsafe fn specials_landing_pre(fighter: &mut L2CFighterCommon) -> L2CValue {
339-
if VarModule::get_int(fighter.battle_object, vars::koopa::instance::SPECIAL_S_THROW_TYPE) == -2 {
352+
if VarModule::get_int(fighter.battle_object, vars::koopa::instance::SPECIAL_S_THROW_TYPE) == SPECIAL_S_KIND_LW_A {
340353
return original!(fighter);
341354
}
342355
let kinetic = KineticModule::get_kinetic_type(fighter.module_accessor);
@@ -372,7 +385,7 @@ unsafe fn specials_landing_pre(fighter: &mut L2CFighterCommon) -> L2CValue {
372385
unsafe fn specials_landing_main(fighter: &mut L2CFighterCommon) -> L2CValue {
373386
let throw_input = VarModule::get_int(fighter.battle_object, vars::koopa::instance::SPECIAL_S_THROW_TYPE);
374387

375-
if throw_input == -2 {
388+
if throw_input == SPECIAL_S_KIND_LW_A {
376389
let start_y = WorkModule::get_float(fighter.module_accessor, *FIGHTER_KOOPA_STATUS_SPECIAL_S_WORK_FLOAT_START_Y);
377390
let mut max_dist = WorkModule::get_param_float(fighter.module_accessor, hash40("param_special_s"), hash40("special_s_attack_power_max_dist"));
378391
max_dist*=10.0;
@@ -388,14 +401,14 @@ unsafe fn specials_landing_main(fighter: &mut L2CFighterCommon) -> L2CValue {
388401
return fighter.sub_shift_status_main(L2CValue::Ptr(specials_landing_main_loop as *const () as _));
389402
}
390403

391-
let throw_F = throw_input == 1;
404+
let throw_B = throw_input == SPECIAL_S_KIND_B;
392405
let capture_id = LinkModule::get_node_object_id(fighter.module_accessor, *LINK_NO_CAPTURE);
393406
if capture_id != 0x50000000 {
394407
let capture_boma = sv_battle_object::module_accessor(capture_id as u32);
395408

396409
let motion_share = WorkModule::get_param_int(fighter.module_accessor, 0xad2ee25eu64, 0x7d88ea0u64);
397-
let throw_motion = if throw_F {36603360558 as u64} else {36554879287 as u64}; //39642420386 lw 41418534085 hi 36603360558 f 36554879287 b
398-
let throw_rate = if throw_F {1.7} else {1.0};
410+
let throw_motion = if !throw_B {36603360558 as u64} else {36554879287 as u64}; //39642420386 lw 41418534085 hi 36603360558 f 36554879287 b
411+
let throw_rate = if !throw_B {1.7} else {1.0};
399412

400413
let mut share_type = 0;
401414
if motion_share == *FIGHTER_MOTION_SHARE_TYPE_TARO {
@@ -437,7 +450,7 @@ unsafe extern "C" fn specials_landing_main_loop(fighter: &mut L2CFighterCommon)
437450

438451
if !StatusModule::is_changing(fighter.module_accessor)
439452
&& StatusModule::is_situation_changed(fighter.module_accessor) {
440-
if VarModule::get_int(fighter.battle_object, vars::koopa::instance::SPECIAL_S_THROW_TYPE) != -2
453+
if VarModule::get_int(fighter.battle_object, vars::koopa::instance::SPECIAL_S_THROW_TYPE) != SPECIAL_S_KIND_LW_A
441454
{
442455
specials_situation_helper(fighter,false);
443456
}

0 commit comments

Comments
 (0)