mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2024-11-20 00:46:34 +00:00
fix save states
This commit is contained in:
parent
6cf353faec
commit
5b1b611787
7 changed files with 79 additions and 46 deletions
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "training_modpack"
|
||||
version = "0.1.0"
|
||||
authors = ["jam1garner <jam1.mcleod@hotmail.com>"]
|
||||
version = "2.0.0"
|
||||
authors = ["jugeeya <jugeeya@live.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
|
@ -9,8 +9,8 @@ crate-type = ["cdylib"]
|
|||
|
||||
[dependencies]
|
||||
skyline = { git = "https://github.com/ultimate-research/skyline-rs.git" }
|
||||
# skyline_smash = { git = "https://github.com/ultimate-research/skyline-smash.git" }
|
||||
skyline_smash = { path = "../../../../src/skyline-smash" }
|
||||
skyline_smash = { git = "https://github.com/ultimate-research/skyline-smash.git" }
|
||||
# skyline_smash = { path = "../../../../src/skyline-smash" }
|
||||
|
||||
[profile.dev]
|
||||
panic = "abort"
|
||||
|
|
|
@ -25,6 +25,8 @@ pub static mut fighter_manager_addr: usize = 0;
|
|||
extern "C" {
|
||||
#[link_name = "\u{1}_ZN3app9smashball16is_training_modeEv"]
|
||||
pub fn is_training_mode() -> bool;
|
||||
#[link_name = "\u{1}_ZN3app7utility8get_kindEPKNS_26BattleObjectModuleAccessorE"]
|
||||
pub fn get_kind(module_accessor: &mut app::BattleObjectModuleAccessor) -> i32;
|
||||
}
|
||||
|
||||
pub fn get_category(module_accessor: &mut app::BattleObjectModuleAccessor) -> i32 {
|
||||
|
|
|
@ -235,13 +235,15 @@ pub unsafe fn get_command_flag_cat(
|
|||
let status_kind = StatusModule::status_kind(module_accessor) as i32;
|
||||
MotionAnimcmdModule::set_sleep_effect(
|
||||
module_accessor,
|
||||
!((*FIGHTER_STATUS_KIND_CATCH..=*FIGHTER_STATUS_KIND_TREAD_FALL)
|
||||
.contains(&status_kind)
|
||||
|| (*FIGHTER_STATUS_KIND_WAIT..=*FIGHTER_STATUS_KIND_REBOUND_JUMP)
|
||||
.contains(&status_kind)),
|
||||
!((status_kind >= FIGHTER_STATUS_KIND_CATCH
|
||||
&& status_kind <= FIGHTER_STATUS_KIND_TREAD_FALL)
|
||||
|| (status_kind >= FIGHTER_STATUS_KIND_WAIT
|
||||
&& status_kind <= FIGHTER_STATUS_KIND_REBOUND_JUMP)),
|
||||
);
|
||||
|
||||
if !(*FIGHTER_STATUS_KIND_CATCH..=*FIGHTER_STATUS_KIND_CATCH_TURN).contains(&status_kind) {
|
||||
if !(*FIGHTER_STATUS_KIND_CATCH..=*FIGHTER_STATUS_KIND_CATCH_TURN).contains(&status_kind)
|
||||
&& !is_shielding(module_accessor)
|
||||
{
|
||||
EffectModule::set_visible_kind(
|
||||
module_accessor,
|
||||
Hash40 {
|
||||
|
|
16
src/lib.rs
16
src/lib.rs
|
@ -44,6 +44,19 @@ pub unsafe fn handle_sub_guard_cont(fighter: &mut L2CFighterCommon) -> L2CValue
|
|||
}
|
||||
}
|
||||
}
|
||||
if (*menu).MASH_STATE == MASH_SPOTDODGE {
|
||||
if StatusModule::prev_status_kind(module_accessor, 0) == FIGHTER_STATUS_KIND_GUARD_DAMAGE {
|
||||
if WorkModule::is_enable_transition_term(
|
||||
module_accessor,
|
||||
*FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_ESCAPE,
|
||||
) {
|
||||
fighter.fighter_base.change_status(
|
||||
L2CValue::new_int(*FIGHTER_STATUS_KIND_ESCAPE as u64),
|
||||
L2CValue::new_bool(true),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
original!()(fighter)
|
||||
}
|
||||
|
||||
|
@ -57,7 +70,7 @@ fn nro_main(nro: &NroInfo) {
|
|||
}
|
||||
}
|
||||
|
||||
#[skyline::main(name = "test")]
|
||||
#[skyline::main(name = "training_modpack")]
|
||||
pub fn main() {
|
||||
println!("Training modpack initialized.");
|
||||
hitbox_visualizer::hitbox_visualization();
|
||||
|
@ -73,7 +86,6 @@ pub fn main() {
|
|||
"w\u{0}".as_bytes().as_ptr(),
|
||||
);
|
||||
|
||||
println!("File pointer: {:#?}", f);
|
||||
if !f.is_null() {
|
||||
fwrite(c_str(&buffer) as *const c_void, 1, buffer.len(), f);
|
||||
fclose(f);
|
||||
|
|
|
@ -66,15 +66,15 @@ pub unsafe fn defensive_option(
|
|||
) {
|
||||
let status = StatusModule::status_kind(module_accessor) as i32;
|
||||
let prev_status = StatusModule::prev_status_kind(module_accessor, 0) as i32;
|
||||
if [
|
||||
*FIGHTER_STATUS_KIND_CLIFF_JUMP3,
|
||||
*FIGHTER_STATUS_KIND_CLIFF_JUMP2,
|
||||
*FIGHTER_STATUS_KIND_CLIFF_JUMP1,
|
||||
]
|
||||
.contains(&status)
|
||||
{
|
||||
*flag |= *FIGHTER_PAD_CMD_CAT1_FLAG_AIR_ESCAPE;
|
||||
}
|
||||
// if [
|
||||
// *FIGHTER_STATUS_KIND_CLIFF_JUMP3,
|
||||
// *FIGHTER_STATUS_KIND_CLIFF_JUMP2,
|
||||
// *FIGHTER_STATUS_KIND_CLIFF_JUMP1,
|
||||
// ]
|
||||
// .contains(&status)
|
||||
// {
|
||||
// *flag |= *FIGHTER_PAD_CMD_CAT1_FLAG_AIR_ESCAPE;
|
||||
// }
|
||||
|
||||
if should_perform_defensive_option(module_accessor, prev_status, status) {
|
||||
perform_defensive_option(module_accessor, flag);
|
||||
|
|
|
@ -64,6 +64,7 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
|
|||
save_state_player_state = CameraMove;
|
||||
save_state_cpu_state = CameraMove;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// move to camera bounds
|
||||
|
@ -72,10 +73,7 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
|
|||
|
||||
let left_right =
|
||||
(*save_state_x > 0.0) as i32 as f32 - (*save_state_x < 0.0) as i32 as f32;
|
||||
let mut y_pos = 0.0;
|
||||
if *save_state_situation_kind == SITUATION_KIND_GROUND {
|
||||
y_pos = -50.0;
|
||||
}
|
||||
let y_pos = 0.0;
|
||||
|
||||
let pos = Vector3f {
|
||||
x: left_right * 50.0,
|
||||
|
@ -83,17 +81,22 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
|
|||
z: 0.0,
|
||||
};
|
||||
PostureModule::set_pos(module_accessor, &pos);
|
||||
StatusModule::set_situation_kind(
|
||||
module_accessor,
|
||||
app::SituationKind {
|
||||
situation_kind: *SITUATION_KIND_AIR,
|
||||
},
|
||||
false,
|
||||
);
|
||||
|
||||
// force aerial, because from aerial state we can move anywhere
|
||||
if StatusModule::situation_kind(module_accessor) == SITUATION_KIND_GROUND {
|
||||
StatusModule::change_status_request(module_accessor, *FIGHTER_STATUS_KIND_JUMP_SQUAT, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// move to correct pos
|
||||
if *save_state == PosMove {
|
||||
if StatusModule::situation_kind(module_accessor) == SITUATION_KIND_GROUND {
|
||||
return;
|
||||
}
|
||||
|
||||
KineticModule::clear_speed_all(module_accessor);
|
||||
|
||||
let pos = Vector3f {
|
||||
x: *save_state_x,
|
||||
y: *save_state_y,
|
||||
|
@ -116,13 +119,25 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
|
|||
false,
|
||||
);
|
||||
|
||||
// Doesn't work, and I don't know why yet.
|
||||
// if *save_state_situation_kind == SITUATION_KIND_GROUND && status != FIGHTER_STATUS_KIND_WAIT {
|
||||
// StatusModule::change_status_request(module_accessor, *FIGHTER_STATUS_KIND_WAIT, false);
|
||||
// }
|
||||
// else if (*save_state_situation_kind == SITUATION_KIND_AIR && status != FIGHTER_STATUS_KIND_FALL)
|
||||
// StatusModule::change_status_request(module_accessor, FIGHTER_STATUS_KIND_FALL, 0);
|
||||
if *save_state_situation_kind == SITUATION_KIND_CLIFF
|
||||
if *save_state_situation_kind == SITUATION_KIND_GROUND
|
||||
&& status != FIGHTER_STATUS_KIND_WAIT
|
||||
{
|
||||
StatusModule::change_status_request(
|
||||
module_accessor,
|
||||
*FIGHTER_STATUS_KIND_CLIFF_WAIT,
|
||||
false,
|
||||
);
|
||||
}
|
||||
else if *save_state_situation_kind == SITUATION_KIND_AIR
|
||||
&& status != FIGHTER_STATUS_KIND_FALL
|
||||
{
|
||||
StatusModule::change_status_request(
|
||||
module_accessor,
|
||||
*FIGHTER_STATUS_KIND_FALL,
|
||||
false,
|
||||
);
|
||||
}
|
||||
else if *save_state_situation_kind == SITUATION_KIND_CLIFF
|
||||
&& status != FIGHTER_STATUS_KIND_CLIFF_CATCH_MOVE
|
||||
&& status != FIGHTER_STATUS_KIND_CLIFF_CATCH
|
||||
{
|
||||
|
@ -133,6 +148,7 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
|
|||
);
|
||||
}
|
||||
*save_state = NoAction;
|
||||
return;
|
||||
}
|
||||
|
||||
// Grab + Dpad down: Save state
|
||||
|
|
|
@ -68,19 +68,20 @@ pub unsafe fn should_perform_defensive_option(
|
|||
*FIGHTER_STATUS_KIND_DOWN_STAND_ATTACK,
|
||||
]
|
||||
.contains(&prev_status)
|
||||
|| [
|
||||
*FIGHTER_STATUS_KIND_DOWN_STAND,
|
||||
*FIGHTER_STATUS_KIND_DOWN_STAND_FB,
|
||||
*FIGHTER_STATUS_KIND_DOWN_STAND_ATTACK,
|
||||
]
|
||||
.contains(&status))
|
||||
// || [
|
||||
// *FIGHTER_STATUS_KIND_DOWN_STAND,
|
||||
// *FIGHTER_STATUS_KIND_DOWN_STAND_FB,
|
||||
// *FIGHTER_STATUS_KIND_DOWN_STAND_ATTACK,
|
||||
// ]
|
||||
// .contains(&status)
|
||||
)
|
||||
&& (
|
||||
WorkModule::is_enable_transition_term(
|
||||
module_accessor,
|
||||
*FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_GUARD_ON,
|
||||
)
|
||||
// ||
|
||||
// CancelModule::is_enable_cancel(module_accessor)
|
||||
||
|
||||
CancelModule::is_enable_cancel(module_accessor)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue