1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-24 02:44:17 +00:00

Fix Save State Slot Effect Removal (#521)

* Initial

* Clippy + Format

* Update save_states.rs

* selected vs random

* fix

* Formats

* Format

* Format

* Fix for effect removal

* Updated copy, 2 randomize_slots, 2 save_slot_state

* Update to 5.1, fix random logic

---------

Co-authored-by: Matthew Edell <edell.matthew@gmail.com>
This commit is contained in:
jugeeya 2023-04-14 16:20:05 -07:00 committed by GitHub
parent 1ce2850af3
commit 9b9070cff2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -152,8 +152,16 @@ static mut MIRROR_STATE: f32 = 1.0;
static mut RANDOM_SLOT: usize = 0; static mut RANDOM_SLOT: usize = 0;
unsafe fn get_slot() -> usize {
if MENU.randomize_slots == OnOff::On {
RANDOM_SLOT
} else {
MENU.save_state_slot as u32 as usize
}
}
pub unsafe fn is_killing() -> bool { pub unsafe fn is_killing() -> bool {
let selected_slot = MENU.save_state_slot as u32 as usize; let selected_slot = get_slot();
(save_state_player(selected_slot).state == KillPlayer (save_state_player(selected_slot).state == KillPlayer
|| save_state_player(selected_slot).state == WaitForAlive) || save_state_player(selected_slot).state == WaitForAlive)
|| (save_state_cpu(selected_slot).state == KillPlayer || (save_state_cpu(selected_slot).state == KillPlayer
@ -161,7 +169,7 @@ pub unsafe fn is_killing() -> bool {
} }
pub unsafe fn is_loading() -> bool { pub unsafe fn is_loading() -> bool {
let selected_slot = MENU.save_state_slot as u32 as usize; let selected_slot = get_slot();
save_state_player(selected_slot).state != NoAction save_state_player(selected_slot).state != NoAction
|| save_state_cpu(selected_slot).state != NoAction || save_state_cpu(selected_slot).state != NoAction
} }
@ -337,12 +345,7 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
return; return;
} }
let selected_slot = if MENU.randomize_slots == OnOff::On { let selected_slot = get_slot();
RANDOM_SLOT
} else {
MENU.save_state_slot as u32 as usize
};
let status = StatusModule::status_kind(module_accessor); let status = StatusModule::status_kind(module_accessor);
let is_cpu = WorkModule::get_int(module_accessor, *FIGHTER_INSTANCE_WORK_ID_INT_ENTRY_ID) let is_cpu = WorkModule::get_int(module_accessor, *FIGHTER_INSTANCE_WORK_ID_INT_ENTRY_ID)
== FighterId::CPU as i32; == FighterId::CPU as i32;