Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dynamic/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ pub mod vars {

pub const IS_DASH_CANCEL: i32 = 0x1055;

pub const IGNORE_INITIAL_SOUND: i32 = 0x1000;

// ints

pub const DOWN_STAND_FB_KIND: i32 = 0x1000;
Expand Down
7 changes: 7 additions & 0 deletions dynamic/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ pub trait BomaExt {
// gets the boma of the player who is grabbing you
unsafe fn get_grabber_boma(&mut self) -> &mut BattleObjectModuleAccessor;
unsafe fn get_owner_boma(&mut self) -> &mut BattleObjectModuleAccessor;
unsafe fn get_article_boma(&mut self, article_type: i32) -> &mut BattleObjectModuleAccessor;

// WORK
unsafe fn get_int(&mut self, what: i32) -> i32;
Expand Down Expand Up @@ -923,6 +924,12 @@ impl BomaExt for BattleObjectModuleAccessor {
return &mut *sv_battle_object::module_accessor((WorkModule::get_int(self, *WEAPON_INSTANCE_WORK_ID_INT_ACTIVATE_FOUNDER_ID)) as u32);
}

unsafe fn get_article_boma(&mut self, article_type: i32) -> &mut BattleObjectModuleAccessor {
let article = ArticleModule::get_article(self, article_type);
let article_id = smash::app::lua_bind::Article::get_battle_object_id(article) as u32;
return &mut *sv_battle_object::module_accessor(article_id);
}

unsafe fn get_num_used_jumps(&mut self) -> i32 {
return WorkModule::get_int(self, *FIGHTER_INSTANCE_WORK_ID_INT_JUMP_COUNT);
}
Expand Down
32 changes: 32 additions & 0 deletions fighters/common/src/function_hooks/article.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use super::*;
use utils::ext::*;


#[skyline::hook(offset = 0x3d4180)]
unsafe fn article_module__generate_article(module: u64, article_kind: i32, arg3: bool, arg4: i32) {
let boma = *(module as *mut *mut BattleObjectModuleAccessor).add(1);
let status_module = *(boma as *const u64).add(0x8);
let is_respawn_entry = StatusModule::status_kind(boma) == *FIGHTER_STATUS_KIND_REBIRTH
&& ((*boma).is_motion_one_of(&[Hash40::new("entry_l"), Hash40::new("entry_r")])
|| (*boma).status_frame() <= 1);

// Set your status kind to ENTRY
// This allows entry anim articles to spawn properly during respawn
if is_respawn_entry {
*((status_module + 0x98) as *mut i32) = *FIGHTER_STATUS_KIND_ENTRY; // StatusModule::status_kind
}

call_original!(module, article_kind, arg3, arg4);

// Set your status kind back to REBIRTH after article generation
// to proceed with proper respawn behavior
if is_respawn_entry {
*((status_module + 0x98) as *mut i32) = *FIGHTER_STATUS_KIND_REBIRTH; // StatusModule::status_kind
}
}

pub fn install() {
skyline::install_hooks!(
article_module__generate_article,
);
}
23 changes: 23 additions & 0 deletions fighters/common/src/function_hooks/effect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,14 @@ unsafe fn req_hook(effect_module: u64, effHash: smash::phx::Hash40, pos: *mut Ve
let boma = *(effect_module as *mut *mut BattleObjectModuleAccessor).add(1);
let mut eff_size = size;
let mut new_eff_hash = effHash;

if (*boma).is_weapon()
&& (*boma).get_owner_boma().is_status(*FIGHTER_STATUS_KIND_REBIRTH)
&& (*boma).get_owner_boma().status_frame() == 0
&& (*boma).get_owner_boma().is_motion_one_of(&[Hash40::new("entry_l"), Hash40::new("entry_r")]) {
return 0;
}

if SHOCKWAVE_FX.contains(&effHash.hash) {
let mut effect_size_mul = if effHash.hash == hash40("sys_nopassive") {
0.5
Expand Down Expand Up @@ -273,6 +281,14 @@ unsafe fn req_on_joint_hook(effect_module: u64, effHash: smash::phx::Hash40, bon
let boma = *(effect_module as *mut *mut BattleObjectModuleAccessor).add(1);
let mut eff_size = size;
let mut new_eff_hash = effHash;

if (*boma).is_weapon()
&& (*boma).get_owner_boma().is_status(*FIGHTER_STATUS_KIND_REBIRTH)
&& (*boma).get_owner_boma().status_frame() == 0
&& (*boma).get_owner_boma().is_motion_one_of(&[Hash40::new("entry_l"), Hash40::new("entry_r")]) {
return 0;
}

if SHOCKWAVE_FX.contains(&effHash.hash) {
let mut effect_size_mul = if effHash.hash == hash40("sys_nopassive") {
0.5
Expand Down Expand Up @@ -313,6 +329,13 @@ unsafe fn req_follow(effect_module: u64, effHash: smash::phx::Hash40, boneHash:
let mut eff_size = size;
let mut new_eff_hash = effHash;

if (*boma).is_weapon()
&& (*boma).get_owner_boma().is_status(*FIGHTER_STATUS_KIND_REBIRTH)
&& (*boma).get_owner_boma().status_frame() == 0
&& (*boma).get_owner_boma().is_motion_one_of(&[Hash40::new("entry_l"), Hash40::new("entry_r")]) {
return 0;
}

// Shrink knockback smoke effect by 25%
let mut is_kb_smoke = false;
if effHash.hash == hash40("sys_flyroll_smoke") as u64 { // hash for kb smoke
Expand Down
21 changes: 20 additions & 1 deletion fighters/common/src/function_hooks/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,25 @@ pub unsafe fn add_rebel_gauge(boma: &mut app::BattleObjectModuleAccessor, entry_
send_rebel_gauge_event(entry_id, new_gauge.min(100.0).max(0.0));
}

// A hook regarding the generation/visiblity of articles
// Used to allow entry articles to generate normally
#[skyline::hook(offset = 0x3a6670)]
unsafe extern "C" fn get_article_use_type_mask(weapon_kind: i32, entry_id: i32) -> u32 {
if [
*WEAPON_KIND_MARIO_DOKAN, *WEAPON_KIND_DONKEY_DKBARREL, *WEAPON_KIND_LINK_PARASAIL, *WEAPON_KIND_SAMUS_TRANSPORTATION, *WEAPON_KIND_KIRBY_WARPSTAR, *WEAPON_KIND_FOX_ARWING, *WEAPON_KIND_PIKACHU_MONSTERBALL, *WEAPON_KIND_LUIGI_DOKAN,
*WEAPON_KIND_PURIN_MONSTERBALL, *WEAPON_KIND_PEACH_KASSAR, *WEAPON_KIND_DAISY_KASSAR, *WEAPON_KIND_MARIOD_CAPSULEBLOCK, *WEAPON_KIND_PICHU_MONSTERBALL, *WEAPON_KIND_FALCO_ARWING, *WEAPON_KIND_LUCINA_MASK,
*WEAPON_KIND_ROY_SWORD, *WEAPON_KIND_GAMEWATCH_ENTRY, *WEAPON_KIND_METAKNIGHT_MANTLE, *WEAPON_KIND_DIDDY_DKBARREL, *WEAPON_KIND_LUCAS_DOSEITABLE, *WEAPON_KIND_DEDEDE_SHRINE,
*WEAPON_KIND_MURABITO_HOUSE, *WEAPON_KIND_WIIFIT_BALANCEBOARD, *WEAPON_KIND_WIIFIT_WIIBO, *WEAPON_KIND_LITTLEMAC_SWEATLITTLEMAC, *WEAPON_KIND_LITTLEMAC_THROWSWEAT, *WEAPON_KIND_GEKKOUGA_MONSTERBALL,
*WEAPON_KIND_PALUTENA_GATE, *WEAPON_KIND_SHIZUE_OFFICE, *WEAPON_KIND_GAOGAEN_MONSTERBALL, *WEAPON_KIND_MASTER_BATON, *WEAPON_KIND_PICKEL_ENTRYOBJECT, *WEAPON_KIND_PACMAN_BIGPACMAN
].contains(&weapon_kind) {
return *ARTICLE_USETYPE_FINAL as u32;
}
call_original!(weapon_kind, entry_id)
}

pub fn install() {
skyline::install_hook!(add_rebel_gauge);
skyline::install_hooks!(
add_rebel_gauge,
get_article_use_type_mask
);
}
2 changes: 2 additions & 0 deletions fighters/common/src/function_hooks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub mod collision;
pub mod camera;
pub mod shotos;
pub mod sound;
pub mod article;
mod lua_bind_hook;
mod fighterspecializer;
mod fighter_util;
Expand Down Expand Up @@ -821,6 +822,7 @@ pub fn install() {
camera::install();
shotos::install();
sound::install();
article::install();
lua_bind_hook::install();
fighterspecializer::install();
fighter_util::install();
Expand Down
18 changes: 17 additions & 1 deletion fighters/common/src/function_hooks/sound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,29 @@ use utils::*;

#[skyline::hook(offset = 0x4cf6c0)]
unsafe fn soundmodule__play_se_hook(sound_module: u64, se: smash::phx::Hash40, arg2: bool, arg3: bool, arg4: bool, arg5: bool, se_type: smash::app::enSEType) -> u64 {
let handle = original!()(sound_module, se, arg2, arg3, arg4, arg5, se_type);
let boma = *(sound_module as *mut *mut BattleObjectModuleAccessor).add(1);

let fighter_boma = if (*boma).is_weapon() {
(*boma).get_owner_boma()
} else {
boma
};

if (*fighter_boma).is_status(*FIGHTER_STATUS_KIND_REBIRTH)
&& (*fighter_boma).status_frame() == 0
&& (*fighter_boma).is_motion_one_of(&[Hash40::new("entry_l"), Hash40::new("entry_r")])
&& VarModule::is_flag((*fighter_boma).object(), vars::common::status::IGNORE_INITIAL_SOUND) {
return 0;
}

let handle = original!()(sound_module, se, arg2, arg3, arg4, arg5, se_type);

if se_type.0 == 0
&& !utils::se::SE_LIST.contains(&se.hash) {
// Increase volume of most of the game's SFX (excluding voice clips)
SoundModule::set_se_vol(boma, handle as i32, 1.25, 0);
}

handle
}

Expand Down
2 changes: 2 additions & 0 deletions fighters/common/src/general_statuses/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ mod lasso;
mod itemthrow;
mod fallspecial;
mod squat;
mod rebirth;

// [LUA-REPLACE-REBASE]
// [SHOULD-CHANGE]
Expand Down Expand Up @@ -1068,6 +1069,7 @@ pub fn install() {
itemthrow::install();
fallspecial::install();
squat::install();
rebirth::install();

skyline::nro::add_hook(nro_hook);
}
Loading
Loading