diff --git a/dynamic/src/consts.rs b/dynamic/src/consts.rs index ab0b67d53b..68b92c33e1 100644 --- a/dynamic/src/consts.rs +++ b/dynamic/src/consts.rs @@ -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; diff --git a/dynamic/src/ext.rs b/dynamic/src/ext.rs index 0bf23dac98..511795c6bc 100644 --- a/dynamic/src/ext.rs +++ b/dynamic/src/ext.rs @@ -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; @@ -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); } diff --git a/fighters/common/src/function_hooks/article.rs b/fighters/common/src/function_hooks/article.rs new file mode 100644 index 0000000000..6fbff9789e --- /dev/null +++ b/fighters/common/src/function_hooks/article.rs @@ -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, + ); +} \ No newline at end of file diff --git a/fighters/common/src/function_hooks/effect.rs b/fighters/common/src/function_hooks/effect.rs index b4f0f2f43e..ac5b095502 100644 --- a/fighters/common/src/function_hooks/effect.rs +++ b/fighters/common/src/function_hooks/effect.rs @@ -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 @@ -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 @@ -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 diff --git a/fighters/common/src/function_hooks/misc.rs b/fighters/common/src/function_hooks/misc.rs index a19fe6e236..91922defa6 100644 --- a/fighters/common/src/function_hooks/misc.rs +++ b/fighters/common/src/function_hooks/misc.rs @@ -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 + ); } \ No newline at end of file diff --git a/fighters/common/src/function_hooks/mod.rs b/fighters/common/src/function_hooks/mod.rs index 645e590bf7..1ea4a43287 100644 --- a/fighters/common/src/function_hooks/mod.rs +++ b/fighters/common/src/function_hooks/mod.rs @@ -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; @@ -821,6 +822,7 @@ pub fn install() { camera::install(); shotos::install(); sound::install(); + article::install(); lua_bind_hook::install(); fighterspecializer::install(); fighter_util::install(); diff --git a/fighters/common/src/function_hooks/sound.rs b/fighters/common/src/function_hooks/sound.rs index bc0f27e18d..7a72b21c49 100644 --- a/fighters/common/src/function_hooks/sound.rs +++ b/fighters/common/src/function_hooks/sound.rs @@ -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 } diff --git a/fighters/common/src/general_statuses/mod.rs b/fighters/common/src/general_statuses/mod.rs index 31fd881733..d3a940ec64 100644 --- a/fighters/common/src/general_statuses/mod.rs +++ b/fighters/common/src/general_statuses/mod.rs @@ -37,6 +37,7 @@ mod lasso; mod itemthrow; mod fallspecial; mod squat; +mod rebirth; // [LUA-REPLACE-REBASE] // [SHOULD-CHANGE] @@ -1068,6 +1069,7 @@ pub fn install() { itemthrow::install(); fallspecial::install(); squat::install(); + rebirth::install(); skyline::nro::add_hook(nro_hook); } diff --git a/fighters/common/src/general_statuses/rebirth.rs b/fighters/common/src/general_statuses/rebirth.rs new file mode 100644 index 0000000000..4a99ebd98d --- /dev/null +++ b/fighters/common/src/general_statuses/rebirth.rs @@ -0,0 +1,1031 @@ +use super::*; +use globals::*; + + +#[skyline::hook(replace = smash::lua2cpp::L2CFighterCommon_sub_rebirth_uniq_process_init)] +unsafe extern "C" fn sub_rebirth_uniq_process_init(fighter: &mut L2CFighterCommon) -> L2CValue { + let lr = PostureModule::lr(fighter.module_accessor); + let kind = fighter.global_table[FIGHTER_KIND].get_i32(); + + if !ParamModule::is_flag(fighter.object(), ParamType::Shared, "use_entry_anim_on_respawn") { + return original!()(fighter); + } + + match kind { + 0x0 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_MARIO_GENERATE_ARTICLE_DOKAN, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_MARIO_GENERATE_ARTICLE_DOKAN, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_MARIO_GENERATE_ARTICLE_DOKAN, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x1 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_DONKEY_GENERATE_ARTICLE_DKBARREL, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_DONKEY_GENERATE_ARTICLE_DKBARREL, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_DONKEY_GENERATE_ARTICLE_DKBARREL, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x3 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_SAMUS_GENERATE_ARTICLE_TRANSPORTATION, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_SAMUS_GENERATE_ARTICLE_TRANSPORTATION, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_SAMUS_GENERATE_ARTICLE_TRANSPORTATION, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x6 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_KIRBY_GENERATE_ARTICLE_WARPSTAR, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_KIRBY_GENERATE_ARTICLE_WARPSTAR, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_KIRBY_GENERATE_ARTICLE_WARPSTAR, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x7 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_FOX_GENERATE_ARTICLE_ARWING, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_FOX_GENERATE_ARTICLE_ARWING, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_FOX_GENERATE_ARTICLE_ARWING, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x8 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_PIKACHU_GENERATE_ARTICLE_MONSTERBALL, false, -1); + + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_PIKACHU_GENERATE_ARTICLE_MONSTERBALL, Hash40::new("entry_r"), true, -1.0); + }, + 0x9 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_LUIGI_GENERATE_ARTICLE_DOKAN, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_LUIGI_GENERATE_ARTICLE_DOKAN, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_LUIGI_GENERATE_ARTICLE_DOKAN, Hash40::new("entry_r"), true, -1.0); + } + }, + 0xB => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_CAPTAIN_GENERATE_ARTICLE_BLUEFALCON, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_CAPTAIN_GENERATE_ARTICLE_BLUEFALCON, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_CAPTAIN_GENERATE_ARTICLE_BLUEFALCON, Hash40::new("entry_r"), true, -1.0); + } + }, + 0xC => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_PURIN_GENERATE_ARTICLE_MONSTERBALL, false, -1); + + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_PURIN_GENERATE_ARTICLE_MONSTERBALL, Hash40::new("entry"), true, -1.0); + }, + 0xD => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_PEACH_GENERATE_ARTICLE_KASSAR, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_PEACH_GENERATE_ARTICLE_KASSAR, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_PEACH_GENERATE_ARTICLE_KASSAR, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x12 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_MARIOD_GENERATE_ARTICLE_CAPSULEBLOCK, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_MARIOD_GENERATE_ARTICLE_CAPSULEBLOCK, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_MARIOD_GENERATE_ARTICLE_CAPSULEBLOCK, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x13 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_PICHU_GENERATE_ARTICLE_MONSTERBALL, false, -1); + + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_PICHU_GENERATE_ARTICLE_MONSTERBALL, Hash40::new("entry_r"), true, -1.0); + }, + 0x14 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_FALCO_GENERATE_ARTICLE_ARWING, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_FALCO_GENERATE_ARTICLE_ARWING, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_FALCO_GENERATE_ARTICLE_ARWING, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x16 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_LUCINA_GENERATE_ARTICLE_MASK, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_LUCINA_GENERATE_ARTICLE_MASK, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_LUCINA_GENERATE_ARTICLE_MASK, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x1A => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_ROY_GENERATE_ARTICLE_SWORD, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_ROY_GENERATE_ARTICLE_SWORD, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_ROY_GENERATE_ARTICLE_SWORD, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x1C => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_GAMEWATCH_GENERATE_ARTICLE_ENTRY, false, -1); + }, + 0x1D => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_METAKNIGHT_GENERATE_ARTICLE_MANTLE, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_METAKNIGHT_GENERATE_ARTICLE_MANTLE, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_METAKNIGHT_GENERATE_ARTICLE_MANTLE, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x20 => { + // ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_SZEROSUIT_GENERATE_ARTICLE_GUNSHIP, false, -1); + + // if lr == -1.0 { + // ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_SZEROSUIT_GENERATE_ARTICLE_GUNSHIP, Hash40::new("entry_l"), true, -1.0); + // } + // else { + // ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_SZEROSUIT_GENERATE_ARTICLE_GUNSHIP, Hash40::new("entry_r"), true, -1.0); + // } + }, + 0x21 => { + let bike_hp = WorkModule::get_param_float(fighter.module_accessor, hash40("param_special_s"), hash40("bike_hp")); + WorkModule::set_float(fighter.module_accessor, bike_hp, *FIGHTER_WARIO_INSTANCE_WORK_ID_FLOAT_SPECIAL_S_BIKE_HP); + + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_WARIO_GENERATE_ARTICLE_WARIOBIKE, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_WARIO_GENERATE_ARTICLE_WARIOBIKE, Hash40::new("entry_l"), true, -1.0); + + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_WARIO_GENERATE_ARTICLE_WARIOBIKE, Hash40::new("entry_r"), true, -1.0); + } + + WorkModule::on_flag(fighter.module_accessor, *FIGHTER_WARIO_INSTANCE_WORK_ID_FLAG_REMOVE_BIKE); + }, + 0x27 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_DIDDY_GENERATE_ARTICLE_DKBARREL, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_DIDDY_GENERATE_ARTICLE_DKBARREL, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_DIDDY_GENERATE_ARTICLE_DKBARREL, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x28 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_LUCAS_GENERATE_ARTICLE_DOSEITABLE, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_LUCAS_GENERATE_ARTICLE_DOSEITABLE, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_LUCAS_GENERATE_ARTICLE_DOSEITABLE, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x2A => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_DEDEDE_GENERATE_ARTICLE_SHRINE, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_DEDEDE_GENERATE_ARTICLE_SHRINE, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_DEDEDE_GENERATE_ARTICLE_SHRINE, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x30 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_MURABITO_GENERATE_ARTICLE_HOUSE, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_MURABITO_GENERATE_ARTICLE_HOUSE, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_MURABITO_GENERATE_ARTICLE_HOUSE, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x32 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_WIIFIT_GENERATE_ARTICLE_BALANCEBOARD, false, -1); + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_WIIFIT_GENERATE_ARTICLE_WIIBO, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_WIIFIT_GENERATE_ARTICLE_BALANCEBOARD, Hash40::new("entry_l"), true, -1.0); + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_WIIFIT_GENERATE_ARTICLE_WIIBO, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_WIIFIT_GENERATE_ARTICLE_BALANCEBOARD, Hash40::new("entry_r"), true, -1.0); + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_WIIFIT_GENERATE_ARTICLE_WIIBO, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x33 => { + // ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_ROSETTA_GENERATE_ARTICLE_TICO, false, -1); + }, + 0x34 => { + let costume_slot = WorkModule::get_int(fighter.module_accessor, *FIGHTER_INSTANCE_WORK_ID_INT_COLOR); + if costume_slot != 5 + && costume_slot != 7 { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_LITTLEMAC_GENERATE_ARTICLE_SWEATLITTLEMAC, false, -1); + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_LITTLEMAC_GENERATE_ARTICLE_THROWSWEAT, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_LITTLEMAC_GENERATE_ARTICLE_SWEATLITTLEMAC, Hash40::new("entry_l"), true, -1.0); + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_LITTLEMAC_GENERATE_ARTICLE_THROWSWEAT, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_LITTLEMAC_GENERATE_ARTICLE_SWEATLITTLEMAC, Hash40::new("entry_r"), true, -1.0); + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_LITTLEMAC_GENERATE_ARTICLE_THROWSWEAT, Hash40::new("entry_r"), true, -1.0); + } + } + }, + 0x35 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_GEKKOUGA_GENERATE_ARTICLE_MONSTERBALL, false, -1); + + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_GEKKOUGA_GENERATE_ARTICLE_MONSTERBALL, Hash40::new("entry"), true, -1.0); + }, + 0x36 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_PALUTENA_GENERATE_ARTICLE_GATE, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_PALUTENA_GENERATE_ARTICLE_GATE, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_PALUTENA_GENERATE_ARTICLE_GATE, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x37 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_PACMAN_GENERATE_ARTICLE_BIGPACMAN, false, -1); + + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_PACMAN_GENERATE_ARTICLE_BIGPACMAN, Hash40::new("entry"), true, -1.0); + }, + 0x46 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_SHIZUE_GENERATE_ARTICLE_OFFICE, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_SHIZUE_GENERATE_ARTICLE_OFFICE, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_SHIZUE_GENERATE_ARTICLE_OFFICE, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x47 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_GAOGAEN_GENERATE_ARTICLE_MONSTERBALL, false, -1); + + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_GAOGAEN_GENERATE_ARTICLE_MONSTERBALL, Hash40::new("entry"), true, -1.0); + }, + 0x4B => { + // if lr == -1.0 { + // ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_POPO_GENERATE_ARTICLE_CONDOR, Hash40::new("entry_l"), true, -1.0); + // } + // else { + // ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_POPO_GENERATE_ARTICLE_CONDOR, Hash40::new("entry_r"), true, -1.0); + // } + }, + 0x4C => { + // if lr == -1.0 { + // ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_POPO_GENERATE_ARTICLE_CONDOR, Hash40::new("entry_l"), true, -1.0); + // } + // else { + // ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_POPO_GENERATE_ARTICLE_CONDOR, Hash40::new("entry_r"), true, -1.0); + // } + }, + 0x56 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_MASTER_GENERATE_ARTICLE_BATON, false, -1); + + if lr == -1.0 { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_MASTER_GENERATE_ARTICLE_BATON, Hash40::new("entry_l"), true, -1.0); + } + else { + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_MASTER_GENERATE_ARTICLE_BATON, Hash40::new("entry_r"), true, -1.0); + } + }, + 0x58 => { + ArticleModule::generate_article(fighter.module_accessor, *FIGHTER_PICKEL_GENERATE_ARTICLE_ENTRYOBJECT, false, -1); + + ArticleModule::change_motion(fighter.module_accessor, *FIGHTER_PICKEL_GENERATE_ARTICLE_ENTRYOBJECT, Hash40::new("entry_r"), true, -1.0); + }, + _ => {} + } + + original!()(fighter) +} + +#[skyline::hook(replace = smash::lua2cpp::L2CFighterCommon_sub_rebirth_common_pre)] +unsafe extern "C" fn sub_rebirth_common_pre(fighter: &mut L2CFighterCommon) { + let lr = PostureModule::lr(fighter.module_accessor); + let kind = fighter.global_table[FIGHTER_KIND].get_i32(); + + CameraModule::reset_all(fighter.module_accessor); + + ControlModule::reset_trigger(fighter.module_accessor); + ControlModule::clear_command(fighter.module_accessor, false); + + AreaModule::set_whole(fighter.module_accessor, false); + VisibilityModule::set_whole(fighter.module_accessor, true); + + notify_event_msc_cmd!(fighter, Hash40::new_raw(0x1f20a9d549), true); + notify_event_msc_cmd!(fighter, Hash40::new_raw(0x1e61567377)); + + PhysicsModule::set_swing_rebirth(fighter.module_accessor, true); + + let end_frame = if lr == -1.0 { + MotionModule::end_frame_from_hash(fighter.module_accessor, Hash40::new("entry_l")) + } else { + MotionModule::end_frame_from_hash(fighter.module_accessor, Hash40::new("entry_r")) + }; + + let start_frame: f32 = match kind { + 0x4 => { + end_frame - 75.0 + }, + 0xA => { + 0.0 + }, + 0xB => { + end_frame - 61.0 + }, + 0x1C => { + 70.0 + }, + 0x1E => { + 45.0 + }, + 0x1F => { + 45.0 + }, + 0x21 => { + 15.0 + }, + 0x22 => { + end_frame - 75.0 + }, + 0x2A => { + end_frame - 80.0 + }, + 0x30 => { + 54.0 + }, + 0x32 => { + end_frame - 75.0 + }, + 0x33 => { + 0.0 + }, + 0x46 => { + 54.0 + }, + _ => { + (end_frame - 85.0).max(0.0) + } + }; + + if start_frame > 45.0 { + VarModule::on_flag(fighter.battle_object, vars::common::status::IGNORE_INITIAL_SOUND); + } + + if [*FIGHTER_KIND_PZENIGAME, + *FIGHTER_KIND_PFUSHIGISOU, + *FIGHTER_KIND_PLIZARDON].contains(&kind) + { + MotionModule::change_motion(fighter.module_accessor, Hash40::new("respawn"), 0.0, 1.0, false, 0.0, false, false); + } + else if !ParamModule::is_flag(fighter.object(), ParamType::Shared, "use_entry_anim_on_respawn") + || [*FIGHTER_KIND_PIKMIN].contains(&kind) { + MotionModule::change_motion(fighter.module_accessor, Hash40::new("down_stand_d"), 0.0, 0.0, false, 0.0, false, false); + } + else { + if lr == -1.0 { + MotionModule::change_motion(fighter.module_accessor, Hash40::new("entry_l"), 0.0, 1.0, false, 0.0, false, false); + } + else { + MotionModule::change_motion(fighter.module_accessor, Hash40::new("entry_r"), 0.0, 1.0, false, 0.0, false, false); + } + + MotionModule::set_frame_sync_anim_cmd(fighter.module_accessor, start_frame, false, false, false); + } + + match kind { + 0x0 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_MARIO_GENERATE_ARTICLE_DOKAN) { + let article_boma = fighter.get_article_boma(*FIGHTER_MARIO_GENERATE_ARTICLE_DOKAN); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x1 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_DONKEY_GENERATE_ARTICLE_DKBARREL) { + let article_boma = fighter.get_article_boma(*FIGHTER_DONKEY_GENERATE_ARTICLE_DKBARREL); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x2 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_LINK_GENERATE_ARTICLE_PARASAIL) { + let article_boma = fighter.get_article_boma(*FIGHTER_LINK_GENERATE_ARTICLE_PARASAIL); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + } + 0x3 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_SAMUS_GENERATE_ARTICLE_TRANSPORTATION) { + let article_boma = fighter.get_article_boma(*FIGHTER_SAMUS_GENERATE_ARTICLE_TRANSPORTATION); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x6 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_KIRBY_GENERATE_ARTICLE_WARPSTAR) { + let article_boma = fighter.get_article_boma(*FIGHTER_KIRBY_GENERATE_ARTICLE_WARPSTAR); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x7 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_FOX_GENERATE_ARTICLE_ARWING) { + let article_boma = fighter.get_article_boma(*FIGHTER_FOX_GENERATE_ARTICLE_ARWING); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x8 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_PIKACHU_GENERATE_ARTICLE_MONSTERBALL) { + let article_boma = fighter.get_article_boma(*FIGHTER_PIKACHU_GENERATE_ARTICLE_MONSTERBALL); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x9 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_LUIGI_GENERATE_ARTICLE_DOKAN) { + let article_boma = fighter.get_article_boma(*FIGHTER_LUIGI_GENERATE_ARTICLE_DOKAN); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0xB => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_CAPTAIN_GENERATE_ARTICLE_BLUEFALCON) { + let article_boma = fighter.get_article_boma(*FIGHTER_CAPTAIN_GENERATE_ARTICLE_BLUEFALCON); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0xC => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_PURIN_GENERATE_ARTICLE_MONSTERBALL) { + let article_boma = fighter.get_article_boma(*FIGHTER_PURIN_GENERATE_ARTICLE_MONSTERBALL); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0xD => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_PEACH_GENERATE_ARTICLE_KASSAR) { + let article_boma = fighter.get_article_boma(*FIGHTER_PEACH_GENERATE_ARTICLE_KASSAR); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x12 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_MARIOD_GENERATE_ARTICLE_CAPSULEBLOCK) { + let article_boma = fighter.get_article_boma(*FIGHTER_MARIOD_GENERATE_ARTICLE_CAPSULEBLOCK); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x13 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_PICHU_GENERATE_ARTICLE_MONSTERBALL) { + let article_boma = fighter.get_article_boma(*FIGHTER_PICHU_GENERATE_ARTICLE_MONSTERBALL); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x14 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_FALCO_GENERATE_ARTICLE_ARWING) { + let article_boma = fighter.get_article_boma(*FIGHTER_FALCO_GENERATE_ARTICLE_ARWING); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x16 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_LUCINA_GENERATE_ARTICLE_MASK) { + let article_boma = fighter.get_article_boma(*FIGHTER_LUCINA_GENERATE_ARTICLE_MASK); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x1A => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_ROY_GENERATE_ARTICLE_SWORD) { + let article_boma = fighter.get_article_boma(*FIGHTER_ROY_GENERATE_ARTICLE_SWORD); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x1C => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_GAMEWATCH_GENERATE_ARTICLE_ENTRY) { + let article_boma = fighter.get_article_boma(*FIGHTER_GAMEWATCH_GENERATE_ARTICLE_ENTRY); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x1D => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_METAKNIGHT_GENERATE_ARTICLE_MANTLE) { + let article_boma = fighter.get_article_boma(*FIGHTER_METAKNIGHT_GENERATE_ARTICLE_MANTLE); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x20 => { + // if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_SZEROSUIT_GENERATE_ARTICLE_GUNSHIP) { + // let article_boma = fighter.get_article_boma(*FIGHTER_SZEROSUIT_GENERATE_ARTICLE_GUNSHIP); + // MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + // } + }, + 0x21 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_WARIO_GENERATE_ARTICLE_WARIOBIKE) { + let article_boma = fighter.get_article_boma(*FIGHTER_WARIO_GENERATE_ARTICLE_WARIOBIKE); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x27 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_DIDDY_GENERATE_ARTICLE_DKBARREL) { + let article_boma = fighter.get_article_boma(*FIGHTER_DIDDY_GENERATE_ARTICLE_DKBARREL); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x28 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_LUCAS_GENERATE_ARTICLE_DOSEITABLE) { + let article_boma = fighter.get_article_boma(*FIGHTER_LUCAS_GENERATE_ARTICLE_DOSEITABLE); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x2A => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_DEDEDE_GENERATE_ARTICLE_SHRINE) { + let article_boma = fighter.get_article_boma(*FIGHTER_DEDEDE_GENERATE_ARTICLE_SHRINE); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x30 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_MURABITO_GENERATE_ARTICLE_HOUSE) { + let article_boma = fighter.get_article_boma(*FIGHTER_MURABITO_GENERATE_ARTICLE_HOUSE); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x32 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_WIIFIT_GENERATE_ARTICLE_BALANCEBOARD) { + let article_boma = fighter.get_article_boma(*FIGHTER_WIIFIT_GENERATE_ARTICLE_BALANCEBOARD); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_WIIFIT_GENERATE_ARTICLE_WIIBO) { + let article_boma = fighter.get_article_boma(*FIGHTER_WIIFIT_GENERATE_ARTICLE_WIIBO); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x33 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_ROSETTA_GENERATE_ARTICLE_TICO) { + ArticleModule::set_visibility_whole(fighter.module_accessor, *FIGHTER_ROSETTA_GENERATE_ARTICLE_TICO, true, ArticleOperationTarget(*ARTICLE_OPE_TARGET_ALL)); + + let article_boma = fighter.get_article_boma(*FIGHTER_ROSETTA_GENERATE_ARTICLE_TICO); + StatusModule::change_status_request_from_script(article_boma, *WEAPON_ROSETTA_TICO_STATUS_KIND_ENTRY, false); + } + }, + 0x34 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_LITTLEMAC_GENERATE_ARTICLE_SWEATLITTLEMAC) { + let article_boma = fighter.get_article_boma(*FIGHTER_LITTLEMAC_GENERATE_ARTICLE_SWEATLITTLEMAC); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_LITTLEMAC_GENERATE_ARTICLE_THROWSWEAT) { + let article_boma = fighter.get_article_boma(*FIGHTER_LITTLEMAC_GENERATE_ARTICLE_THROWSWEAT); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x35 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_GEKKOUGA_GENERATE_ARTICLE_MONSTERBALL) { + let article_boma = fighter.get_article_boma(*FIGHTER_GEKKOUGA_GENERATE_ARTICLE_MONSTERBALL); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x36 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_PALUTENA_GENERATE_ARTICLE_GATE) { + let article_boma = fighter.get_article_boma(*FIGHTER_PALUTENA_GENERATE_ARTICLE_GATE); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x37 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_PACMAN_GENERATE_ARTICLE_BIGPACMAN) { + let article_boma = fighter.get_article_boma(*FIGHTER_PACMAN_GENERATE_ARTICLE_BIGPACMAN); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x46 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_SHIZUE_GENERATE_ARTICLE_OFFICE) { + let article_boma = fighter.get_article_boma(*FIGHTER_SHIZUE_GENERATE_ARTICLE_OFFICE); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x47 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_GAOGAEN_GENERATE_ARTICLE_MONSTERBALL) { + let article_boma = fighter.get_article_boma(*FIGHTER_GAOGAEN_GENERATE_ARTICLE_MONSTERBALL); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x4B => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_POPO_GENERATE_ARTICLE_CONDOR) { + let article_boma = fighter.get_article_boma(*FIGHTER_POPO_GENERATE_ARTICLE_CONDOR); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x4C => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_POPO_GENERATE_ARTICLE_CONDOR) { + let article_boma = fighter.get_article_boma(*FIGHTER_POPO_GENERATE_ARTICLE_CONDOR); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x56 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_MASTER_GENERATE_ARTICLE_BATON) { + let article_boma = fighter.get_article_boma(*FIGHTER_MASTER_GENERATE_ARTICLE_BATON); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x58 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_PICKEL_GENERATE_ARTICLE_ENTRYOBJECT) { + let article_boma = fighter.get_article_boma(*FIGHTER_PICKEL_GENERATE_ARTICLE_ENTRYOBJECT); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x5A => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_EFLAME_GENERATE_ARTICLE_DIVER) { + let article_boma = fighter.get_article_boma(*FIGHTER_EFLAME_GENERATE_ARTICLE_DIVER); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + 0x5B => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_ELIGHT_GENERATE_ARTICLE_DIVER) { + let article_boma = fighter.get_article_boma(*FIGHTER_ELIGHT_GENERATE_ARTICLE_DIVER); + MotionModule::set_frame_sync_anim_cmd(article_boma, start_frame, false, false, false); + } + }, + _ => {} + } + + if !StopModule::is_stop(fighter.module_accessor) { + fighter.sub_rebirth_uniq_check(false.into()); + } + + fighter.global_table[SUB_STATUS].assign(&L2CValue::Ptr(L2CFighterCommon_bind_address_call_sub_rebirth_uniq_check as *const () as _)); + + GroundModule::set_ignore_boss(fighter.module_accessor, true); +} + +#[skyline::hook(replace = smash::lua2cpp::L2CFighterCommon_status_Rebirth_Main)] +unsafe extern "C" fn status_rebirth_main(fighter: &mut L2CFighterCommon) -> L2CValue { + let motion_kind = MotionModule::motion_kind(fighter.module_accessor); + let lr = PostureModule::lr(fighter.module_accessor); + let kind = fighter.global_table[FIGHTER_KIND].get_i32(); + let cmd_cat2 = fighter.global_table[CMD_CAT2].get_i32(); + let pos = PostureModule::pos(fighter.module_accessor); + let pos_x = (*pos).x; + let pos_y = (*pos).y; + let pos_z = (*pos).z; + + if fighter.sub_rebirth_common().get_bool() { + return 1.into(); + } + + let rebirth_move_frame = WorkModule::get_param_int(fighter.module_accessor, hash40("common"), hash40("rebirth_move_frame")); + let down_stand_d_end_frame = MotionModule::end_frame_from_hash(fighter.module_accessor, Hash40::new("down_stand_d")) as i32; + if fighter.is_motion(Hash40::new("down_stand_d")) + && fighter.global_table[CURRENT_FRAME].get_i32() == (rebirth_move_frame - 10) - down_stand_d_end_frame { + MotionModule::set_rate(fighter.module_accessor, 1.0); + } + + if fighter.is_motion_one_of(&[Hash40::new("entry_l"), Hash40::new("entry_r"), Hash40::new("down_stand_d")]) { + rebirth_motion_handler(fighter); + } + else { + fighter.sub_wait_motion(false.into()); + } + + if !StatusModule::is_changing(fighter.module_accessor) + && WorkModule::is_flag(fighter.module_accessor, *FIGHTER_STATUS_REBIRTH_FLAG_ENABLE_STRANS) + && !fighter.is_motion_one_of(&[ + Hash40::new("appeal_hi_r"), + Hash40::new("appeal_hi_l"), + Hash40::new("appeal_s_r"), + Hash40::new("appeal_s_l"), + Hash40::new("appeal_lw_r"), + Hash40::new("appeal_lw_l") + ]) { + if cmd_cat2 & *FIGHTER_PAD_CMD_CAT2_FLAG_APPEAL_HI != 0 { + if lr >= 0.0 { + MotionModule::change_motion(fighter.module_accessor, Hash40::new("appeal_hi_r"), 0.0, 1.0, false, 0.0, false, false); + } + else { + MotionModule::change_motion(fighter.module_accessor, Hash40::new("appeal_hi_l"), 0.0, 1.0, false, 0.0, false, false); + } + } + if cmd_cat2 & *FIGHTER_PAD_CMD_CAT2_FLAG_APPEAL_S_L != 0 || cmd_cat2 & *FIGHTER_PAD_CMD_CAT2_FLAG_APPEAL_S_R != 0 { + if lr >= 0.0 { + MotionModule::change_motion(fighter.module_accessor, Hash40::new("appeal_s_r"), 0.0, 1.0, false, 0.0, false, false); + } + else { + MotionModule::change_motion(fighter.module_accessor, Hash40::new("appeal_s_l"), 0.0, 1.0, false, 0.0, false, false); + } + } + if cmd_cat2 & *FIGHTER_PAD_CMD_CAT2_FLAG_APPEAL_LW != 0 { + if lr >= 0.0 { + MotionModule::change_motion(fighter.module_accessor, Hash40::new("appeal_lw_r"), 0.0, 1.0, false, 0.0, false, false); + } + else { + MotionModule::change_motion(fighter.module_accessor, Hash40::new("appeal_lw_l"), 0.0, 1.0, false, 0.0, false, false); + } + } + } + + match kind { + 0x0 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_MARIO_GENERATE_ARTICLE_DOKAN) { + let article_boma = fighter.get_article_boma(*FIGHTER_MARIO_GENERATE_ARTICLE_DOKAN); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x1 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_DONKEY_GENERATE_ARTICLE_DKBARREL) { + let article_boma = fighter.get_article_boma(*FIGHTER_DONKEY_GENERATE_ARTICLE_DKBARREL); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x2 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_LINK_GENERATE_ARTICLE_PARASAIL) { + let article_boma = fighter.get_article_boma(*FIGHTER_LINK_GENERATE_ARTICLE_PARASAIL); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + } + 0x3 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_SAMUS_GENERATE_ARTICLE_TRANSPORTATION) { + let article_boma = fighter.get_article_boma(*FIGHTER_SAMUS_GENERATE_ARTICLE_TRANSPORTATION); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x6 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_KIRBY_GENERATE_ARTICLE_WARPSTAR) { + let article_boma = fighter.get_article_boma(*FIGHTER_KIRBY_GENERATE_ARTICLE_WARPSTAR); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x7 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_FOX_GENERATE_ARTICLE_ARWING) { + let article_boma = fighter.get_article_boma(*FIGHTER_FOX_GENERATE_ARTICLE_ARWING); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x8 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_PIKACHU_GENERATE_ARTICLE_MONSTERBALL) { + let article_boma = fighter.get_article_boma(*FIGHTER_PIKACHU_GENERATE_ARTICLE_MONSTERBALL); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x9 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_LUIGI_GENERATE_ARTICLE_DOKAN) { + let article_boma = fighter.get_article_boma(*FIGHTER_LUIGI_GENERATE_ARTICLE_DOKAN); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0xB => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_CAPTAIN_GENERATE_ARTICLE_BLUEFALCON) { + let article_boma = fighter.get_article_boma(*FIGHTER_CAPTAIN_GENERATE_ARTICLE_BLUEFALCON); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0xC => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_PURIN_GENERATE_ARTICLE_MONSTERBALL) { + let article_boma = fighter.get_article_boma(*FIGHTER_PURIN_GENERATE_ARTICLE_MONSTERBALL); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0xD => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_PEACH_GENERATE_ARTICLE_KASSAR) { + let article_boma = fighter.get_article_boma(*FIGHTER_PEACH_GENERATE_ARTICLE_KASSAR); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x12 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_MARIOD_GENERATE_ARTICLE_CAPSULEBLOCK) { + let article_boma = fighter.get_article_boma(*FIGHTER_MARIOD_GENERATE_ARTICLE_CAPSULEBLOCK); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x13 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_PICHU_GENERATE_ARTICLE_MONSTERBALL) { + let article_boma = fighter.get_article_boma(*FIGHTER_PICHU_GENERATE_ARTICLE_MONSTERBALL); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x14 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_FALCO_GENERATE_ARTICLE_ARWING) { + let article_boma = fighter.get_article_boma(*FIGHTER_FALCO_GENERATE_ARTICLE_ARWING); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x16 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_LUCINA_GENERATE_ARTICLE_MASK) { + let article_boma = fighter.get_article_boma(*FIGHTER_LUCINA_GENERATE_ARTICLE_MASK); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x1A => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_ROY_GENERATE_ARTICLE_SWORD) { + let article_boma = fighter.get_article_boma(*FIGHTER_ROY_GENERATE_ARTICLE_SWORD); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x1C => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_GAMEWATCH_GENERATE_ARTICLE_ENTRY) { + let article_boma = fighter.get_article_boma(*FIGHTER_GAMEWATCH_GENERATE_ARTICLE_ENTRY); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x1D => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_METAKNIGHT_GENERATE_ARTICLE_MANTLE) { + let article_boma = fighter.get_article_boma(*FIGHTER_METAKNIGHT_GENERATE_ARTICLE_MANTLE); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x20 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_SZEROSUIT_GENERATE_ARTICLE_GUNSHIP) { + let article_boma = fighter.get_article_boma(*FIGHTER_SZEROSUIT_GENERATE_ARTICLE_GUNSHIP); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x21 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_WARIO_GENERATE_ARTICLE_WARIOBIKE) { + let article_boma = fighter.get_article_boma(*FIGHTER_WARIO_GENERATE_ARTICLE_WARIOBIKE); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x27 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_DIDDY_GENERATE_ARTICLE_DKBARREL) { + let article_boma = fighter.get_article_boma(*FIGHTER_DIDDY_GENERATE_ARTICLE_DKBARREL); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x28 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_LUCAS_GENERATE_ARTICLE_DOSEITABLE) { + let article_boma = fighter.get_article_boma(*FIGHTER_LUCAS_GENERATE_ARTICLE_DOSEITABLE); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x2A => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_DEDEDE_GENERATE_ARTICLE_SHRINE) { + let article_boma = fighter.get_article_boma(*FIGHTER_DEDEDE_GENERATE_ARTICLE_SHRINE); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x30 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_MURABITO_GENERATE_ARTICLE_HOUSE) { + let article_boma = fighter.get_article_boma(*FIGHTER_MURABITO_GENERATE_ARTICLE_HOUSE); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z - 10.0}); + } + }, + 0x32 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_WIIFIT_GENERATE_ARTICLE_BALANCEBOARD) { + let article_boma = fighter.get_article_boma(*FIGHTER_WIIFIT_GENERATE_ARTICLE_BALANCEBOARD); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_WIIFIT_GENERATE_ARTICLE_WIIBO) { + let article_boma = fighter.get_article_boma(*FIGHTER_WIIFIT_GENERATE_ARTICLE_WIIBO); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x33 => { + if StatusModule::is_changing(fighter.module_accessor) { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_ROSETTA_GENERATE_ARTICLE_TICO) { + let article_boma = fighter.get_article_boma(*FIGHTER_ROSETTA_GENERATE_ARTICLE_TICO); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + } + }, + 0x34 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_LITTLEMAC_GENERATE_ARTICLE_SWEATLITTLEMAC) { + let article_boma = fighter.get_article_boma(*FIGHTER_LITTLEMAC_GENERATE_ARTICLE_SWEATLITTLEMAC); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_LITTLEMAC_GENERATE_ARTICLE_THROWSWEAT) { + let article_boma = fighter.get_article_boma(*FIGHTER_LITTLEMAC_GENERATE_ARTICLE_THROWSWEAT); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x35 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_GEKKOUGA_GENERATE_ARTICLE_MONSTERBALL) { + let article_boma = fighter.get_article_boma(*FIGHTER_GEKKOUGA_GENERATE_ARTICLE_MONSTERBALL); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x36 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_PALUTENA_GENERATE_ARTICLE_GATE) { + let article_boma = fighter.get_article_boma(*FIGHTER_PALUTENA_GENERATE_ARTICLE_GATE); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x37 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_PACMAN_GENERATE_ARTICLE_BIGPACMAN) { + let article_boma = fighter.get_article_boma(*FIGHTER_PACMAN_GENERATE_ARTICLE_BIGPACMAN); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x46 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_SHIZUE_GENERATE_ARTICLE_OFFICE) { + let article_boma = fighter.get_article_boma(*FIGHTER_SHIZUE_GENERATE_ARTICLE_OFFICE); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z - 10.0}); + } + }, + 0x47 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_GAOGAEN_GENERATE_ARTICLE_MONSTERBALL) { + let article_boma = fighter.get_article_boma(*FIGHTER_GAOGAEN_GENERATE_ARTICLE_MONSTERBALL); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x4B => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_POPO_GENERATE_ARTICLE_CONDOR) { + let article_boma = fighter.get_article_boma(*FIGHTER_POPO_GENERATE_ARTICLE_CONDOR); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x4C => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_POPO_GENERATE_ARTICLE_CONDOR) { + let article_boma = fighter.get_article_boma(*FIGHTER_POPO_GENERATE_ARTICLE_CONDOR); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x56 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_MASTER_GENERATE_ARTICLE_BATON) { + let article_boma = fighter.get_article_boma(*FIGHTER_MASTER_GENERATE_ARTICLE_BATON); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x58 => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_PICKEL_GENERATE_ARTICLE_ENTRYOBJECT) { + let article_boma = fighter.get_article_boma(*FIGHTER_PICKEL_GENERATE_ARTICLE_ENTRYOBJECT); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x5A => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_EFLAME_GENERATE_ARTICLE_DIVER) { + let article_boma = fighter.get_article_boma(*FIGHTER_EFLAME_GENERATE_ARTICLE_DIVER); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + 0x5B => { + if ArticleModule::is_exist(fighter.module_accessor, *FIGHTER_ELIGHT_GENERATE_ARTICLE_DIVER) { + let article_boma = fighter.get_article_boma(*FIGHTER_ELIGHT_GENERATE_ARTICLE_DIVER); + PostureModule::set_pos(article_boma, &Vector3f{x: pos_x, y: pos_y, z: pos_z}); + } + }, + _ => {} + } + + if fighter.sub_air_check_fall_common().get_bool() { + return 1.into(); + } + + if !fighter.global_table[IS_STOPPING].get_bool() { + fighter.sub_rebirth_uniq_process_exec_fix_pos(); + } + + 0.into() +} + +unsafe extern "C" fn rebirth_motion_handler(fighter: &mut L2CFighterCommon) { + if MotionModule::is_end(fighter.module_accessor) { + MotionModule::change_motion(fighter.module_accessor, Hash40::new("wait"), 0.0, 1.0, false, 0.0, false, false); + + fighter.sub_entry_remove_article(); + } +} + +#[skyline::hook(replace = smash::lua2cpp::L2CFighterCommon_bind_address_call_status_end_Rebirth)] +unsafe extern "C" fn bind_address_call_status_end_Rebirth(fighter: &mut L2CFighterCommon, _agent: &mut L2CAgent) -> L2CValue { + fighter.status_end_Rebirth_common(); + + fighter.sub_entry_remove_article(); + + EffectModule::kill_all(fighter.module_accessor, *EFFECT_SUB_ATTRIBUTE_NONE as u32, true, true); + + 0.into() +} + +fn nro_hook(info: &skyline::nro::NroInfo) { + if info.name == "common" { + skyline::install_hooks!( + sub_rebirth_uniq_process_init, + sub_rebirth_common_pre, + status_rebirth_main, + bind_address_call_status_end_Rebirth + ); + } +} + +pub fn install() { + skyline::nro::add_hook(nro_hook); +} \ No newline at end of file diff --git a/fighters/common/src/opff/tech.rs b/fighters/common/src/opff/tech.rs index 49a8e48ef1..4c24e6f568 100644 --- a/fighters/common/src/opff/tech.rs +++ b/fighters/common/src/opff/tech.rs @@ -207,44 +207,6 @@ extern "C" { pub fn stage_id() -> i32; } -pub unsafe fn respawn_taunt(boma: &mut BattleObjectModuleAccessor, status_kind: i32) { - if !boma.is_status(*FIGHTER_STATUS_KIND_REBIRTH) { - return; - } - - match MotionModule::motion_kind(boma) { - utils::hash40!("appeal_hi_r") => return, - utils::hash40!("appeal_hi_l") => return, - utils::hash40!("appeal_lw_r") => return, - utils::hash40!("appeal_lw_l") => return, - utils::hash40!("appeal_s_l") => return, - utils::hash40!("appeal_s_r") => return, - _ => {} - } - - let motion = if boma.is_button_trigger(Buttons::AppealHi) { - if PostureModule::lr(boma) == 1.0 { - Hash40::new("appeal_hi_r") - } else { - Hash40::new("appeal_hi_l") - } - } else if boma.is_button_trigger(Buttons::AppealSL) { - Hash40::new("appeal_s_l") - } else if boma.is_button_trigger(Buttons::AppealSR) { - Hash40::new("appeal_s_r") - } else if boma.is_button_trigger(Buttons::AppealLw) { - if PostureModule::lr(boma) == 1.0 { - Hash40::new("appeal_lw_r") - } else { - Hash40::new("appeal_lw_l") - } - } else { - return; - }; - - MotionModule::change_motion(boma, motion, 0.0, 1.0, false, 0.0, false, false); -} - // Teeter cancelling pub unsafe fn teeter_cancel(fighter: &mut L2CFighterCommon, boma: &mut BattleObjectModuleAccessor) { if (boma.is_situation(*SITUATION_KIND_GROUND) @@ -301,6 +263,5 @@ pub unsafe fn run( double_shield_button_airdodge(boma, status_kind, situation_kind, cat[0]); //drift_di(fighter, boma, status_kind, situation_kind); waveland_plat_drop(boma, cat[1], status_kind); - respawn_taunt(boma, status_kind); teeter_cancel(fighter, boma); } diff --git a/fighters/snake/src/acmd/other.rs b/fighters/snake/src/acmd/other.rs index 05c4443886..f350fbd854 100644 --- a/fighters/snake/src/acmd/other.rs +++ b/fighters/snake/src/acmd/other.rs @@ -201,6 +201,63 @@ unsafe extern "C" fn game_escapeairslide(agent: &mut L2CAgentBase) { } } +unsafe extern "C" fn expression_entry(agent: &mut L2CAgentBase) { + let lua_state = agent.lua_state_agent; + let boma = agent.boma(); + + if is_excute(agent) { + notify_event_msc_cmd!(agent, Hash40::new_raw(0x1f20a9d549), false); + notify_event_msc_cmd!(agent, Hash40::new_raw(0x24772eddef), false); + if boma.is_status(*FIGHTER_STATUS_KIND_ENTRY) { + WorkModule::on_flag(boma, *FIGHTER_SNAKE_STATUS_ENTRY_FLAG_SPYCLOAK); + } + } + frame(lua_state, 13.0); + if is_excute(agent) { + if boma.is_status(*FIGHTER_STATUS_KIND_ENTRY) { + WorkModule::on_flag(boma, *FIGHTER_SNAKE_STATUS_ENTRY_FLAG_SPYCLOAK); + } + } + frame(lua_state, 18.0); + if is_excute(agent) { + if boma.is_status(*FIGHTER_STATUS_KIND_ENTRY) { + WorkModule::on_flag(boma, *FIGHTER_SNAKE_STATUS_ENTRY_FLAG_SPYCLOAK); + } + } + frame(lua_state, 30.0); + if is_excute(agent) { + if boma.is_status(*FIGHTER_STATUS_KIND_ENTRY) { + WorkModule::on_flag(boma, *FIGHTER_SNAKE_STATUS_ENTRY_FLAG_SPYCLOAK); + } + notify_event_msc_cmd!(agent, Hash40::new_raw(0x1f20a9d549), true); + notify_event_msc_cmd!(agent, Hash40::new_raw(0x24772eddef), true); + } + frame(lua_state, 38.0); + if is_excute(agent) { + if boma.is_status(*FIGHTER_STATUS_KIND_ENTRY) { + WorkModule::on_flag(boma, *FIGHTER_SNAKE_STATUS_ENTRY_FLAG_SPYCLOAK); + } + } + frame(lua_state, 44.0); + if is_excute(agent) { + if boma.is_status(*FIGHTER_STATUS_KIND_ENTRY) { + WorkModule::on_flag(boma, *FIGHTER_SNAKE_STATUS_ENTRY_FLAG_SPYCLOAK); + } + } + frame(lua_state, 56.0); + if is_excute(agent) { + if boma.is_status(*FIGHTER_STATUS_KIND_ENTRY) { + WorkModule::on_flag(boma, *FIGHTER_SNAKE_STATUS_ENTRY_FLAG_SPYCLOAK); + } + } + frame(lua_state, 60.0); + if is_excute(agent) { + if boma.is_status(*FIGHTER_STATUS_KIND_ENTRY) { + WorkModule::on_flag(boma, *FIGHTER_SNAKE_STATUS_ENTRY_FLAG_SPYCLOAK); + } + } +} + pub fn install(agent: &mut Agent) { agent.acmd("game_cliffescape", acmd_stub, Priority::Low); @@ -229,4 +286,7 @@ pub fn install(agent: &mut Agent) { agent.acmd("game_escapeair", game_escapeair, Priority::Low); agent.acmd("game_escapeairslide", game_escapeairslide, Priority::Low); + + agent.acmd("expression_entryl", expression_entry, Priority::Low); + agent.acmd("expression_entryr", expression_entry, Priority::Low); } diff --git a/romfs/source/fighter/common/hdr/param/fighter_param.xml b/romfs/source/fighter/common/hdr/param/fighter_param.xml index ea2ccee4cb..55dd8d5489 100644 --- a/romfs/source/fighter/common/hdr/param/fighter_param.xml +++ b/romfs/source/fighter/common/hdr/param/fighter_param.xml @@ -7,6 +7,7 @@ 1.0 1.5 1.8 + false DONKEY @@ -14,6 +15,7 @@ 1.0 1.5 1.8 + true LINK @@ -21,6 +23,7 @@ 0.85 1.5 1.8 + true SAMUS @@ -28,6 +31,7 @@ 1.0 1.5 1.8 + true SAMUSD @@ -35,6 +39,7 @@ 0.95 1.5 1.8 + true YOSHI @@ -42,6 +47,7 @@ 1.0 1.5 1.7 + true KIRBY @@ -49,6 +55,7 @@ 1.0 1.5 1.8 + true FOX @@ -56,6 +63,7 @@ 1.0 1.5 1.8 + true PIKACHU @@ -63,6 +71,7 @@ 0.85 1.5 1.8 + true LUIGI @@ -70,6 +79,7 @@ 1.0 1.5 2.65 + false NESS @@ -77,6 +87,7 @@ 1.0 1.5 1.8 + true CAPTAIN @@ -84,6 +95,7 @@ 1.0 1.5 1.7 + false PURIN @@ -91,6 +103,7 @@ 1.0 1.5 1.8 + true PEACH @@ -98,6 +111,7 @@ 1.0 2.5 1.8 + true DAISY @@ -105,6 +119,7 @@ 1.0 2.5 1.8 + true KOOPA @@ -112,6 +127,7 @@ 1.0 1.5 1.8 + true SHEIK @@ -119,6 +135,7 @@ 0.9 1.5 1.8 + true ZELDA @@ -126,6 +143,7 @@ 1.0 1.5 1.8 + true MARIOD @@ -133,6 +151,7 @@ 1.0 1.5 1.8 + true PICHU @@ -140,6 +159,7 @@ 1.0 1.5 1.8 + true FALCO @@ -147,6 +167,7 @@ 1.0 1.5 1.8 + true MARTH @@ -154,6 +175,7 @@ 1.0 1.5 1.7 + true LUCINA @@ -161,6 +183,7 @@ 1.0 1.5 1.7 + true YOUNGLINK @@ -168,6 +191,7 @@ 1.0 1.5 1.8 + true GANON @@ -175,6 +199,7 @@ 1.0 1.5 1.8 + true MEWTWO @@ -182,6 +207,7 @@ 1.0 1.5 1.8 + true ROY @@ -189,6 +215,7 @@ 0.85 1.5 1.7 + true CHROM @@ -196,6 +223,7 @@ 1.0 1.5 1.7 + true GAMEWATCH @@ -203,6 +231,7 @@ 0.8 1.5 1.8 + true METAKNIGHT @@ -210,6 +239,7 @@ 1.0 1.5 1.8 + true PIT @@ -217,6 +247,7 @@ 0.95 1.5 1.8 + true PITB @@ -224,6 +255,7 @@ 0.95 1.5 1.8 + true SZEROSUIT @@ -231,6 +263,7 @@ 1.0 1.5 1.8 + false WARIO @@ -238,6 +271,7 @@ 1.0 1.5 1.8 + false SNAKE @@ -245,6 +279,7 @@ 1.0 2.75 1.8 + true IKE @@ -252,6 +287,7 @@ 1.0 1.5 1.7 + true PZENIGAME @@ -259,6 +295,7 @@ 0.9 1.5 1.7 + false PFUSHIGISOU @@ -266,6 +303,7 @@ 1.0 1.5 1.8 + false PLIZARDON @@ -273,6 +311,7 @@ 1.0 1.5 1.8 + false DIDDY @@ -280,6 +319,7 @@ 1.0 3.5 1.8 + true LUCAS @@ -287,6 +327,7 @@ 0.95 1.5 1.8 + false SONIC @@ -294,6 +335,7 @@ 1.0 1.5 1.8 + true DEDEDE @@ -301,6 +343,7 @@ 1.0 1.5 1.8 + false PIKMIN @@ -308,6 +351,7 @@ 1.0 1.5 1.8 + false LUCARIO @@ -315,6 +359,7 @@ 1.0 1.5 1.8 + true ROBOT @@ -322,6 +367,7 @@ 1.0 2.5 1.8 + true TOONLINK @@ -329,6 +375,7 @@ 1.0 3.25 1.8 + true WOLF @@ -336,6 +383,7 @@ 1.0 1.5 1.7 + true MURABITO @@ -343,6 +391,7 @@ 1.0 2.75 1.8 + true ROCKMAN @@ -350,6 +399,7 @@ 1.0 1.75 1.8 + true WIIFIT @@ -357,6 +407,7 @@ 1.0 1.5 1.8 + true ROSETTA @@ -364,6 +415,7 @@ 1.0 1.5 1.8 + true LITTLEMAC @@ -371,6 +423,7 @@ 0.9 1.5 1.8 + true GEKKOUGA @@ -378,6 +431,7 @@ 0.9 1.5 1.8 + true PALUTENA @@ -385,6 +439,7 @@ 1.0 1.5 1.8 + true PACMAN @@ -392,6 +447,7 @@ 1.0 1.5 1.8 + true REFLET @@ -399,6 +455,7 @@ 1.0 3.0 1.7 + true SHULK @@ -406,6 +463,7 @@ 1.0 1.5 1.7 + true KOOPAJR @@ -413,6 +471,7 @@ 1.0 2.0 1.8 + true DUCKHUNT @@ -420,6 +479,7 @@ 1.0 1.5 1.8 + true RYU @@ -427,6 +487,7 @@ 1.0 1.5 1.7 + true KEN @@ -434,6 +495,7 @@ 1.0 1.5 1.7 + true CLOUD @@ -441,6 +503,7 @@ 1.0 1.5 1.7 + true KAMUI @@ -448,6 +511,7 @@ 1.0 1.5 1.7 + true BAYONETTA @@ -455,6 +519,7 @@ 1.0 1.5 1.8 + true INKLING @@ -462,6 +527,7 @@ 0.9 1.5 1.8 + true RIDLEY @@ -469,6 +535,7 @@ 0.95 1.5 1.8 + true SIMON @@ -476,6 +543,7 @@ 1.0 1.5 1.8 + true RICHTER @@ -483,6 +551,7 @@ 1.0 1.5 1.8 + true KROOL @@ -490,6 +559,7 @@ 1.0 2.5 1.8 + true SHIZUE @@ -497,6 +567,7 @@ 1.0 1.5 1.8 + true GAOGAEN @@ -504,6 +575,7 @@ 1.0 1.5 1.8 + true MIIFIGHTER @@ -511,6 +583,7 @@ 0.8 1.5 1.8 + true MIISWORDSMAN @@ -518,6 +591,7 @@ 1.0 1.5 1.7 + true MIIGUNNER @@ -525,6 +599,7 @@ 1.0 1.5 1.8 + true POPO @@ -532,6 +607,7 @@ 1.0 1.5 1.8 + true NANA @@ -539,6 +615,7 @@ 1.0 1.5 1.8 + true KOOPAG @@ -546,6 +623,7 @@ 1.0 1.5 1.8 + true MIIENEMYF @@ -553,6 +631,7 @@ 1.0 1.5 1.8 + true MIIENEMYS @@ -560,6 +639,7 @@ 1.0 1.5 1.7 + true MIIENEMYG @@ -567,6 +647,7 @@ 1.0 1.5 1.8 + true PACKUN @@ -574,6 +655,7 @@ 0.95 1.5 1.8 + true JACK @@ -581,6 +663,7 @@ 0.95 1.5 1.8 + true BRAVE @@ -588,6 +671,7 @@ 1.0 1.5 1.8 + true BUDDY @@ -595,6 +679,7 @@ 1.0 1.5 1.8 + true DOLLY @@ -602,6 +687,7 @@ 1.0 1.5 1.8 + true MASTER @@ -609,6 +695,7 @@ 0.95 1.5 1.7 + true TANTAN @@ -616,6 +703,7 @@ 0.95 1.5 1.8 + true PICKEL @@ -623,6 +711,7 @@ 1.0 1.5 1.8 + false EDGE @@ -630,6 +719,7 @@ 1.0 1.5 1.7 + true EFLAME @@ -637,6 +727,7 @@ 1.0 1.5 1.7 + true ELIGHT @@ -644,6 +735,7 @@ 1.0 1.5 1.7 + true DEMON @@ -651,6 +743,7 @@ 1.0 1.5 1.8 + true TRAIL @@ -658,6 +751,7 @@ 1.0 1.5 1.8 + true \ No newline at end of file