mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2025-03-14 02:16:10 +00:00
Bugfix: Ice Climbers savestates (#294)
* Fix working in frame by frame. Debug commands still present. * Save States and Menu Delay fixed * Full basic save state functionality, Debug removed * NanaPosMove cleanup
This commit is contained in:
parent
ac81ef810f
commit
b4d5afd791
3 changed files with 30 additions and 8 deletions
|
@ -11,7 +11,7 @@ use std::path::Path;
|
|||
use strum::IntoEnumIterator;
|
||||
|
||||
static mut FRAME_COUNTER_INDEX: usize = 0;
|
||||
const MENU_LOCKOUT_FRAMES: u32 = 5;
|
||||
const MENU_LOCKOUT_FRAMES: u32 = 15;
|
||||
|
||||
pub fn init() {
|
||||
unsafe {
|
||||
|
|
|
@ -86,12 +86,15 @@ pub fn is_operation_cpu(module_accessor: &mut app::BattleObjectModuleAccessor) -
|
|||
return false;
|
||||
}
|
||||
|
||||
let entry_id_int =
|
||||
WorkModule::get_int(module_accessor, *FIGHTER_INSTANCE_WORK_ID_INT_ENTRY_ID) as i32;
|
||||
let entry_id_int = WorkModule::get_int(module_accessor, *FIGHTER_INSTANCE_WORK_ID_INT_ENTRY_ID) as i32;
|
||||
|
||||
if entry_id_int == 0 {
|
||||
return false;
|
||||
}
|
||||
|
||||
let entry_id = app::FighterEntryID(entry_id_int);
|
||||
let mgr = *(FIGHTER_MANAGER_ADDR as *mut *mut app::FighterManager);
|
||||
let fighter_information =
|
||||
FighterManager::get_fighter_information(mgr, entry_id) as *mut app::FighterInformation;
|
||||
let fighter_information = FighterManager::get_fighter_information(mgr, entry_id) as *mut app::FighterInformation;
|
||||
|
||||
FighterInformation::is_operation_cpu(fighter_information)
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ enum SaveState {
|
|||
NoAction,
|
||||
KillPlayer,
|
||||
PosMove,
|
||||
NanaPosMove,
|
||||
}
|
||||
|
||||
struct SavedState {
|
||||
|
@ -125,10 +126,13 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
|
|||
*FIGHTER_KIND_PLIZARDON,
|
||||
]
|
||||
.contains(&fighter_kind);
|
||||
let fighter_is_popo = fighter_kind == *FIGHTER_KIND_POPO; // For making sure Popo doesn't steal Nana's PosMove
|
||||
let fighter_is_nana = fighter_kind == *FIGHTER_KIND_NANA; // Don't want Nana to reopen savestates etc.
|
||||
|
||||
// Grab + Dpad up: reset state
|
||||
if ControlModule::check_button_on(module_accessor, *CONTROL_PAD_BUTTON_CATCH)
|
||||
&& ControlModule::check_button_trigger(module_accessor, *CONTROL_PAD_BUTTON_APPEAL_HI)
|
||||
&& !fighter_is_nana
|
||||
{
|
||||
if save_state.state == NoAction {
|
||||
SAVE_STATE_PLAYER.state = KillPlayer;
|
||||
|
@ -150,7 +154,8 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
|
|||
// For ptrainer, don't move on unless we're cycled back to the right pokemon
|
||||
save_state.state = PosMove;
|
||||
}
|
||||
} else if !is_dead(module_accessor) {
|
||||
} else if !is_dead(module_accessor) && !fighter_is_nana {
|
||||
// Don't kill Nana again, since she already gets killed by the game from Popo's death
|
||||
// Try moving off-screen so we don't see effects.
|
||||
let pos = Vector3f {
|
||||
x: -300.0,
|
||||
|
@ -171,7 +176,11 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
|
|||
}
|
||||
|
||||
// move to correct pos
|
||||
if save_state.state == PosMove {
|
||||
if save_state.state == PosMove || save_state.state == NanaPosMove {
|
||||
let status_kind = StatusModule::status_kind(module_accessor) as i32;
|
||||
if save_state.state == NanaPosMove && (!fighter_is_nana || (status_kind == FIGHTER_STATUS_KIND_STANDBY)) {
|
||||
return;
|
||||
}
|
||||
SoundModule::stop_all_sound(module_accessor);
|
||||
MotionAnimcmdModule::set_sleep(module_accessor, false);
|
||||
SoundModule::pause_se_all(module_accessor, false);
|
||||
|
@ -228,19 +237,29 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
|
|||
set_damage(module_accessor, save_state.percent);
|
||||
}
|
||||
|
||||
// if the fighter is Popo, change the state to one where only Nana can move
|
||||
// This is needed because for some reason, outside of frame by frame mode,
|
||||
// Popo will keep trying to move instead of letting Nana move if you just
|
||||
// change the state back to PosMove
|
||||
let prev_status_kind = StatusModule::prev_status_kind(module_accessor, 0);
|
||||
if prev_status_kind == FIGHTER_STATUS_KIND_REBIRTH && fighter_is_popo {
|
||||
save_state.state = NanaPosMove;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Grab + Dpad down: Save state
|
||||
if ControlModule::check_button_on(module_accessor, *CONTROL_PAD_BUTTON_CATCH)
|
||||
&& ControlModule::check_button_trigger(module_accessor, *CONTROL_PAD_BUTTON_APPEAL_LW)
|
||||
&& !fighter_is_nana // Don't begin saving state if Nana's delayed input is captured
|
||||
{
|
||||
MIRROR_STATE = 1.0;
|
||||
SAVE_STATE_PLAYER.state = Save;
|
||||
SAVE_STATE_CPU.state = Save;
|
||||
}
|
||||
|
||||
if save_state.state == Save {
|
||||
if save_state.state == Save && !fighter_is_nana { // Don't save states with Nana. Should already be fine, just a safety.
|
||||
save_state.state = NoAction;
|
||||
|
||||
save_state.x = PostureModule::pos_x(module_accessor);
|
||||
|
|
Loading…
Add table
Reference in a new issue