@@ -5,7 +5,7 @@ use globals::*;
5
5
pub fn install ( ) {
6
6
install_status_scripts ! (
7
7
init_specials,
8
- special_s_back
8
+ special_s4_main
9
9
) ;
10
10
}
11
11
@@ -16,40 +16,6 @@ pub fn set_gravity_delay_resume_frame(energy: *mut FighterKineticEnergyGravity,
16
16
}
17
17
}
18
18
19
- #[ status_script( agent = "roy" , status = FIGHTER_ROY_STATUS_KIND_SPECIAL_S4 , condition = LUA_SCRIPT_STATUS_FUNC_STATUS_MAIN ) ]
20
- pub unsafe fn special_s_back ( fighter : & mut L2CFighterCommon ) -> L2CValue {
21
- if VarModule :: is_flag ( fighter. battle_object , vars:: roy:: instance:: REVERSE_SIDEB ) {
22
- let lrc = PostureModule :: lr ( fighter. module_accessor ) ;
23
- let stick_x = ControlModule :: get_stick_x ( fighter. module_accessor ) ;
24
-
25
- if fighter. global_table [ SITUATION_KIND ] == SITUATION_KIND_GROUND {
26
- MotionModule :: change_motion_inherit_frame ( fighter. module_accessor , Hash40 :: new ( "special_s4_back" ) , 0.0 , 1.0 , 0.0 , false , false ) ;
27
- VarModule :: off_flag ( fighter. battle_object , vars:: roy:: instance:: REVERSE_SIDEB ) ;
28
-
29
- if lrc == 1.0 && stick_x < 0.0 {
30
- PostureModule :: set_lr ( fighter. module_accessor , -1.0 ) ;
31
- } else if lrc == -1.0 && stick_x > 0.0 {
32
- PostureModule :: set_lr ( fighter. module_accessor , 1.0 ) ;
33
- }
34
-
35
- return 0 . into ( ) ;
36
- } else {
37
- MotionModule :: change_motion_inherit_frame ( fighter. module_accessor , Hash40 :: new ( "special_air_s4_back" ) , 0.0 , 1.0 , 0.0 , false , false ) ;
38
- VarModule :: off_flag ( fighter. battle_object , vars:: roy:: instance:: REVERSE_SIDEB ) ;
39
-
40
- if lrc == 1.0 && stick_x < 0.0 {
41
- PostureModule :: set_lr ( fighter. module_accessor , -1.0 ) ;
42
- } else if lrc == -1.0 && stick_x > 0.0 {
43
- PostureModule :: set_lr ( fighter. module_accessor , 1.0 ) ;
44
- }
45
-
46
- return 0 . into ( ) ;
47
- }
48
- }
49
-
50
- original ! ( fighter)
51
- }
52
-
53
19
#[ status_script( agent = "roy" , status = FIGHTER_STATUS_KIND_SPECIAL_S , condition = LUA_SCRIPT_STATUS_FUNC_INIT_STATUS ) ]
54
20
pub unsafe fn init_specials ( fighter : & mut L2CFighterCommon , arg : u64 ) -> L2CValue {
55
21
let fighter_kind = WorkModule :: get_int ( fighter. module_accessor , * FIGHTER_INSTANCE_WORK_ID_INT_KIND ) ;
@@ -111,10 +77,6 @@ pub unsafe fn init_specials(fighter: &mut L2CFighterCommon, arg: u64) -> L2CValu
111
77
smash:: app:: lua_bind:: KineticEnergy :: enable ( motion_energy) ;
112
78
smash:: app:: lua_bind:: KineticModule :: unable_energy ( fighter. module_accessor , * FIGHTER_KINETIC_ENERGY_ID_STOP ) ;
113
79
smash:: app:: lua_bind:: KineticModule :: unable_energy ( fighter. module_accessor , * FIGHTER_KINETIC_ENERGY_ID_GRAVITY ) ;
114
-
115
- if VarModule :: is_flag ( fighter. battle_object , vars:: roy:: instance:: REVERSE_SIDEB ) {
116
- MotionModule :: change_motion ( fighter. module_accessor , Hash40 :: new ( "special_s4_back" ) , 0.0 , 1.0 , false , 0.0 , false , false ) ;
117
- }
118
80
}
119
81
else if current_situation_kind == * SITUATION_KIND_AIR {
120
82
let reset_speed_2f = smash:: phx:: Vector2f { x : 0.0 , y : 0.0 } ;
@@ -123,13 +85,98 @@ pub unsafe fn init_specials(fighter: &mut L2CFighterCommon, arg: u64) -> L2CValu
123
85
smash:: app:: lua_bind:: KineticEnergy :: reset_energy ( gravity_energy, * ENERGY_GRAVITY_RESET_TYPE_GRAVITY , & reset_speed_2f, & reset_speed_3f, fighter. module_accessor ) ;
124
86
smash:: app:: lua_bind:: KineticEnergy :: enable ( stop_energy) ;
125
87
smash:: app:: lua_bind:: KineticEnergy :: enable ( gravity_energy) ;
126
-
127
- if VarModule :: is_flag ( fighter. battle_object , vars:: roy:: instance:: REVERSE_SIDEB ) {
128
- MotionModule :: change_motion ( fighter. module_accessor , Hash40 :: new ( "special_air_s4_back" ) , 0.0 , 1.0 , false , 0.0 , false , false ) ;
129
- }
130
88
}
131
89
}
132
90
KineticModule :: unable_energy ( fighter. module_accessor , * FIGHTER_KINETIC_ENERGY_ID_CONTROL ) ;
133
91
134
92
0 . into ( )
135
- }
93
+ }
94
+
95
+ #[ status_script( agent = "roy" , status = FIGHTER_ROY_STATUS_KIND_SPECIAL_S4 , condition = LUA_SCRIPT_STATUS_FUNC_STATUS_MAIN ) ]
96
+ pub unsafe fn special_s4_main ( fighter : & mut L2CFighterCommon , arg : u64 ) -> L2CValue {
97
+ WorkModule :: off_flag ( fighter. module_accessor , * FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_CONTINUE_MOT ) ;
98
+ let mot = if VarModule :: is_flag ( fighter. battle_object , vars:: roy:: status:: SIDE_B_REVERSE ) {
99
+ ( hash40 ( "special_s4_back" ) as i64 , hash40 ( "special_air_s4_back" ) as i64 )
100
+ }
101
+ else if WorkModule :: is_flag ( fighter. module_accessor , * FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_LW ) {
102
+ ( hash40 ( "special_s4_lw" ) as i64 , hash40 ( "special_air_s4_lw" ) as i64 )
103
+ }
104
+ else if WorkModule :: is_flag ( fighter. module_accessor , * FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_HI ) {
105
+ ( hash40 ( "special_s4_hi" ) as i64 , hash40 ( "special_air_s4_hi" ) as i64 )
106
+ }
107
+ else {
108
+ ( hash40 ( "special_s4_s" ) as i64 , hash40 ( "special_air_s4_s" ) as i64 )
109
+ } ;
110
+ WorkModule :: set_int64 ( fighter. module_accessor , mot. 0 , * FIGHTER_ROY_STATUS_SPECIAL_S_WORK_INT_MOTION_KIND ) ;
111
+ WorkModule :: set_int64 ( fighter. module_accessor , mot. 1 , * FIGHTER_ROY_STATUS_SPECIAL_S_WORK_INT_MOTION_KIND_AIR ) ;
112
+ VarModule :: off_flag ( fighter. battle_object , vars:: roy:: status:: SIDE_B_REVERSE ) ;
113
+ WorkModule :: off_flag ( fighter. module_accessor , * FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_HI ) ;
114
+ WorkModule :: off_flag ( fighter. module_accessor , * FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_LW ) ;
115
+ fighter. sub_shift_status_main ( L2CValue :: Ptr ( special_s4_main_loop as * const ( ) as _ ) )
116
+ }
117
+
118
+ unsafe extern "C" fn special_s4_main_loop ( fighter : & mut L2CFighterCommon ) -> L2CValue {
119
+ if !StatusModule :: is_changing ( fighter. module_accessor ) {
120
+ if StatusModule :: is_situation_changed ( fighter. module_accessor ) {
121
+ special_s_mot_helper ( fighter) ;
122
+ }
123
+ }
124
+ else {
125
+ special_s_mot_helper ( fighter) ;
126
+ }
127
+ if CancelModule :: is_enable_cancel ( fighter. module_accessor ) {
128
+ if fighter. sub_wait_ground_check_common ( false . into ( ) ) . get_bool ( )
129
+ || fighter. sub_air_check_fall_common ( ) . get_bool ( ) {
130
+ return 0 . into ( ) ;
131
+ }
132
+ }
133
+ if MotionModule :: is_end ( fighter. module_accessor ) {
134
+ let sit = fighter. global_table [ SITUATION_KIND ] . get_i32 ( ) ;
135
+ if sit != * SITUATION_KIND_GROUND {
136
+ fighter. change_status ( FIGHTER_STATUS_KIND_FALL . into ( ) , false . into ( ) ) ;
137
+ }
138
+ else {
139
+ fighter. change_status ( FIGHTER_STATUS_KIND_WAIT . into ( ) , false . into ( ) ) ;
140
+ }
141
+ }
142
+ 0 . into ( )
143
+ }
144
+
145
+ unsafe extern "C" fn special_s_mot_helper ( fighter : & mut L2CFighterCommon ) {
146
+ let sit = fighter. global_table [ SITUATION_KIND ] . get_i32 ( ) ;
147
+ let correct;
148
+ let mot;
149
+ if sit != * SITUATION_KIND_GROUND {
150
+ correct = * GROUND_CORRECT_KIND_AIR ;
151
+ mot = WorkModule :: get_int64 ( fighter. module_accessor , * FIGHTER_ROY_STATUS_SPECIAL_S_WORK_INT_MOTION_KIND_AIR ) ;
152
+ }
153
+ else {
154
+ correct = * GROUND_CORRECT_KIND_GROUND_CLIFF_STOP ;
155
+ mot = WorkModule :: get_int64 ( fighter. module_accessor , * FIGHTER_ROY_STATUS_SPECIAL_S_WORK_INT_MOTION_KIND ) ;
156
+ }
157
+ GroundModule :: correct ( fighter. module_accessor , GroundCorrectKind ( correct) ) ;
158
+ if !WorkModule :: is_flag ( fighter. module_accessor , * FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_CONTINUE_MOT ) {
159
+ MotionModule :: change_motion (
160
+ fighter. module_accessor ,
161
+ Hash40 :: new_raw ( mot) ,
162
+ 0.0 ,
163
+ 1.0 ,
164
+ false ,
165
+ 0.0 ,
166
+ false ,
167
+ false
168
+ ) ;
169
+ WorkModule :: on_flag ( fighter. module_accessor , * FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_CONTINUE_MOT ) ;
170
+ }
171
+ else {
172
+ MotionModule :: change_motion_inherit_frame (
173
+ fighter. module_accessor ,
174
+ Hash40 :: new_raw ( mot) ,
175
+ -1.0 ,
176
+ 1.0 ,
177
+ 0.0 ,
178
+ false ,
179
+ false
180
+ ) ;
181
+ }
182
+ }
0 commit comments