1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2025-01-20 01:10:13 +00:00

Refactor to use param object

This commit is contained in:
jugeeya 2020-09-08 23:04:49 -07:00
parent e74ee787f3
commit 1885258c4e
2 changed files with 8 additions and 7 deletions

View file

@ -3,6 +3,7 @@ use crate::hitbox_visualizer;
use skyline::nn::ro::LookupSymbol;
use smash::app::{self, lua_bind::*};
use smash::lib::lua_const::*;
use smash::params::*;
pub mod combo;
pub mod directional_influence;
@ -294,7 +295,8 @@ pub unsafe fn handle_set_dead_rumble(lua_state: u64) -> u64 {
original!()(lua_state)
}
pub static mut COMMON_OBJ: u64 = 0;
pub static mut COMMON_PARAMS: *mut CommonParams = 0 as *mut _;
// 8.1.0 Offset
static mut LOAD_PRC_FILE_OFFSET: usize = 0x34369d0;
@ -311,7 +313,7 @@ unsafe fn load_once_common_params(common_obj: u64, table1_idx: u32) {
let hash = loaded_tables.get_hash_from_t1_index(table1_idx).as_u64();
if hash == smash::phx::Hash40::new("fighter/common/param/common.prc").hash {
COMMON_OBJ = common_obj;
COMMON_PARAMS = CommonParams::from_u64_mut(common_obj).unwrap() as *mut _;
}
original!()(common_obj, table1_idx)
}

View file

@ -130,15 +130,14 @@ pub unsafe fn get_param_float(
}
pub unsafe fn param_installer() {
if crate::training::COMMON_OBJ != 0 {
if crate::training::COMMON_PARAMS as usize != 0 {
let common_params = &mut *crate::training::COMMON_PARAMS;
if is_training_mode()
&& (MENU.shield_state == Shield::Infinite || should_pause_shield_decay())
{
// Set "shield_damage_mul" to 0.0f
*((crate::training::COMMON_OBJ + 0x16c) as *mut f32) = 0x0 as f32;
common_params.shield_damage_mul = 0.0;
} else {
// Set "shield_damage_mul" to 1.19f
*((crate::training::COMMON_OBJ + 0x16c) as *mut f32) = 1.19 as f32;
common_params.shield_damage_mul = 1.19;
}
}
}