From ec8c3cd94dd38bef4add815b3b8d4188d4fdc4d9 Mon Sep 17 00:00:00 2001 From: WuBoytH Date: Thu, 14 Nov 2024 23:16:25 -0500 Subject: [PATCH] fix kirby special n callback --- Cargo.lock | 44 ++++++++++----------- fighters/kirby/src/status/mod.rs | 66 ++++++++++++++++++++++++-------- 2 files changed, 71 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 319f986698..2bf54085ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -577,9 +577,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" [[package]] name = "hdr" @@ -759,7 +759,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.15.0", + "hashbrown 0.15.1", ] [[package]] @@ -892,9 +892,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.161" +version = "0.2.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" +checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" [[package]] name = "libc-nnsdk" @@ -1400,7 +1400,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.87", ] [[package]] @@ -1890,22 +1890,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.87", ] [[package]] @@ -2049,7 +2049,7 @@ dependencies = [ [[package]] name = "skyline_smash" version = "0.1.0" -source = "git+https://github.com/blu-dev/skyline-smash#56892e72f5e2dc64667a5afeae97f2a654220bbb" +source = "git+https://github.com/blu-dev/skyline-smash#9136f9f7c03a0d19c130283a590b9075a4f9e653" dependencies = [ "compile-time-lua-bind-hash", "lazy_static", @@ -2068,7 +2068,7 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smash" version = "0.1.0" -source = "git+https://github.com/blu-dev/smash-rs#b3cbf418207d30949aef56183498a617f6d75b63" +source = "git+https://github.com/blu-dev/smash-rs#bdf75541fe603785290c95a588f5b0ce12dc4896" dependencies = [ "bitflags 1.3.2", "hash40 1.3.1 (git+https://github.com/BenHall-7/hash40-rs)", @@ -2099,7 +2099,7 @@ dependencies = [ [[package]] name = "smash_macro" version = "0.1.0" -source = "git+https://github.com/blu-dev/smash-rs#b3cbf418207d30949aef56183498a617f6d75b63" +source = "git+https://github.com/blu-dev/smash-rs#bdf75541fe603785290c95a588f5b0ce12dc4896" dependencies = [ "proc-macro2", "quote", @@ -2181,9 +2181,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.86" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89275301d38033efb81a6e60e3497e734dfcc62571f2854bf4b16690398824c" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -2214,22 +2214,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d171f59dbaa811dbbb1aee1e73db92ec2b122911a48e1390dfe327a821ddede" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b08be0f17bd307950653ce45db00cd31200d82b624b36e181337d9c7d92765b5" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.87", ] [[package]] @@ -2602,5 +2602,5 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.87", ] diff --git a/fighters/kirby/src/status/mod.rs b/fighters/kirby/src/status/mod.rs index 4e65279257..f1d491b724 100644 --- a/fighters/kirby/src/status/mod.rs +++ b/fighters/kirby/src/status/mod.rs @@ -173,23 +173,56 @@ pub unsafe extern "C" fn throw_kirby_map_correction(fighter: &mut L2CFighterComm 0.into() } -/// Prevents side b from being used again in air when it has been disabled by up-b fall -unsafe extern "C" fn ganon_should_use_special_n_callback(fighter: &mut L2CFighterCommon) -> L2CValue { - if WorkModule::get_int(fighter.module_accessor, *FIGHTER_KIRBY_INSTANCE_WORK_ID_INT_COPY_CHARA) == *FIGHTER_KIND_GANON - && fighter.is_situation(*SITUATION_KIND_AIR) && VarModule::is_flag(fighter.battle_object, vars::ganon::instance::DISABLE_SPECIAL_N) { - false.into() - } else { - true.into() +unsafe extern "C" fn should_use_special_n_callback(fighter: &mut L2CFighterCommon) -> L2CValue { + if !WorkModule::is_flag(fighter.module_accessor, *FIGHTER_KIRBY_INSTANCE_WORK_ID_FLAG_COPY) { + return 1.into(); } -} - -unsafe extern "C" fn trail_should_use_special_n_callback(fighter: &mut L2CFighterCommon) -> L2CValue { - if WorkModule::get_int(fighter.module_accessor, *FIGHTER_KIRBY_INSTANCE_WORK_ID_INT_COPY_CHARA) == *FIGHTER_KIND_TRAIL - && VarModule::is_flag(fighter.battle_object, vars::trail::instance::DISABLE_SPECIAL_N) { - false.into() - } else { - true.into() + else { + let copy_kind = WorkModule::get_int(fighter.module_accessor, *FIGHTER_KIRBY_INSTANCE_WORK_ID_INT_COPY_CHARA); + if copy_kind == *FIGHTER_KIND_ROSETTA { + let rosetta_interval = WorkModule::get_int(fighter.module_accessor, *FIGHTER_KIRBY_INSTANCE_WORK_ID_INT_ROSETTA_SPECIAL_N_INTERVAL); + if rosetta_interval <= 0 { + return 1.into(); + } + else { + return 0.into(); + } + } + if copy_kind == *FIGHTER_KIND_GANON { + if fighter.is_situation(*SITUATION_KIND_AIR) && VarModule::is_flag(fighter.battle_object, vars::ganon::instance::DISABLE_SPECIAL_N) { + return 1.into(); + } + else { + return 0.into(); + } + } + if copy_kind == *FIGHTER_KIND_TRAIL { + if VarModule::is_flag(fighter.battle_object, vars::trail::instance::DISABLE_SPECIAL_N) { + return 1.into(); + } + else { + return 0.into(); + } + } + if copy_kind != *FIGHTER_KIND_PIT { + if copy_kind != *FIGHTER_KIND_PITB { + if copy_kind == *FIGHTER_KIND_INKLING { + let inkling_ink = WorkModule::get_float(fighter.module_accessor, *FIGHTER_KIRBY_INSTANCE_WORK_ID_FLOAT_INKLING_SPECIAL_N_INK); + if inkling_ink > 0.0 { + return 1.into(); + } + else { + return 0.into(); + } + } + return 1.into(); + } + } + if !WorkModule::is_flag(fighter.module_accessor, *FIGHTER_KIRBY_INSTANCE_WORK_ID_FLAG_COPY_STRANS_OFF) { + return 1.into(); + } } + 0.into() } // FIGHTER_STATUS_KIND_SPECIAL_N // @@ -231,9 +264,8 @@ unsafe extern "C" fn on_start(fighter: &mut L2CFighterCommon) { // set the callbacks on fighter init fighter.global_table[globals::USE_SPECIAL_HI_CALLBACK].assign(&L2CValue::Ptr(should_use_special_hi_callback as *const () as _)); fighter.global_table[globals::STATUS_CHANGE_CALLBACK].assign(&L2CValue::Ptr(change_status_callback as *const () as _)); - fighter.global_table[globals::USE_SPECIAL_N_CALLBACK].assign(&L2CValue::Ptr(ganon_should_use_special_n_callback as *const () as _)); + fighter.global_table[globals::USE_SPECIAL_N_CALLBACK].assign(&L2CValue::Ptr(should_use_special_n_callback as *const () as _)); fighter.global_table[globals::CHECK_SPECIAL_COMMAND].assign(&L2CValue::Ptr(shoto_check_special_command as *const () as _)); - fighter.global_table[globals::USE_SPECIAL_N_CALLBACK].assign(&L2CValue::Ptr(trail_should_use_special_n_callback as *const () as _)); if is_training_mode() {