diff --git a/.github/workflows/build_prerelease.yml b/.github/workflows/build_prerelease.yml index 1d5197b8c5..6e5fe4fa47 100644 --- a/.github/workflows/build_prerelease.yml +++ b/.github/workflows/build_prerelease.yml @@ -1,8 +1,12 @@ name: build_prerelease on: - push: - branches: - - dev + workflow_dispatch: + inputs: + romfs_version: + type: string + description: 'The romfs version tag to use' + required: true + default: 'latest' jobs: # bump the version and build the changelog @@ -10,20 +14,22 @@ jobs: runs-on: ubuntu-24.04 env: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} - outputs: + outputs: version: ${{ steps.push_tag.outputs.version }} changelog: ${{ steps.github_changelog.outputs.changelog }} steps: - # fail out if this is not a merge commit - - name: ensure merge - if: ${{ !startsWith(github.event.head_commit.message, 'Merge') }} - run: exit 1 - - name: checkout version uses: actions/checkout@v4.1.4 - with: + with: fetch-depth: 0 + # fail out if this is not a merge commit + - name: ensure merge + run: | + if ! git log -1 --pretty=%s | grep -q "^Merge"; then + exit 1 + fi + - name: get last merge id: last_merge shell: bash @@ -80,14 +86,14 @@ jobs: PLUGIN_NAME: hdr runs-on: ubuntu-24.04 needs: version_and_changelog - container: + container: image: wuboyth/skyline-plugin-builder:latest steps: # - name: setup python # uses: actions/setup-python@v5.1.0 # with: # python-version: '3.9' # Version range or exact version of a Python version to use, using SemVer's version range syntax - + - name: checkout version uses: actions/checkout@v4.1.4 @@ -143,8 +149,8 @@ jobs: tag: ${{ needs.version_and_changelog.outputs.version }} overwrite: true body: ${{ needs.version_and_changelog.outputs.changelog }} - - # wait for any previous prereleases to complete, since we dont want to step on any + + # wait for any previous prereleases to complete, since we dont want to step on any # full package uploads prior to this one. wait_for_previous_builds: runs-on: ubuntu-24.04 @@ -152,7 +158,7 @@ jobs: steps: - name: checkout version uses: actions/checkout@v4.1.4 - with: + with: fetch-depth: 0 - uses: ahmadnassri/action-workflow-queue@v1 with: @@ -168,10 +174,16 @@ jobs: uses: actions/checkout@v4.1.4 - id: romfs_version - uses: pozetroninc/github-action-get-latest-release@master - with: - token: ${{ secrets.RELEASE_TOKEN }} - repository: HDR-Development/romfs-release + shell: bash + run: | + if [ "${{ inputs.romfs_version }}" = "latest" ]; then + RELEASE=$(curl -s -H "Authorization: Bearer ${{ secrets.RELEASE_TOKEN }}" \ + https://api.github.com/repos/HDR-Development/romfs-release/releases/latest \ + | python3 -c "import sys,json; print(json.load(sys.stdin)['tag_name'])") + echo "release=$RELEASE" >> $GITHUB_OUTPUT + else + echo "release=${{ inputs.romfs_version }}" >> $GITHUB_OUTPUT + fi - name: Download romfs id: get_romfs @@ -235,14 +247,14 @@ jobs: - uses: actions/download-artifact@v4.1.7 with: name: changelog - + - name: Display structure of downloaded changelog run: ls -R && cp CHANGELOG.md artifacts - uses: actions/download-artifact@v4.1.7 with: name: version - + # build the lvd files # - id: lvd_files # uses: robinraju/release-downloader@v1.7 @@ -400,7 +412,7 @@ jobs: repo_name: HDR-Development/HDR-PreReleases tag: ${{ needs.version_and_changelog.outputs.version }} overwrite: true - + # upload the to_beta_deletions.json to the beta for the launcher - name: Upload to_beta_deletions.json to prerelease uses: svenstaro/upload-release-action@v2 diff --git a/dynamic/src/lib.rs b/dynamic/src/lib.rs index 85eafddffa..81c065fd46 100644 --- a/dynamic/src/lib.rs +++ b/dynamic/src/lib.rs @@ -1,4 +1,5 @@ #![allow(non_upper_case_globals)] +#![allow(integer_to_ptr_transmutes)] #![allow(unused)] pub mod offsets; pub mod util; @@ -24,4 +25,4 @@ pub use hdr_macros::{ pub use hdr_macros as macros; pub use modules::*; -pub use frame_info::*; \ No newline at end of file +pub use frame_info::*; diff --git a/fighters/chrom/src/status/special_hi.rs b/fighters/chrom/src/status/special_hi.rs index 7ac13253a2..e86db97723 100644 --- a/fighters/chrom/src/status/special_hi.rs +++ b/fighters/chrom/src/status/special_hi.rs @@ -21,7 +21,7 @@ pub unsafe extern "C" fn special_hi_common_init(fighter: &mut L2CFighterCommon, let air_accel_x_mul = WorkModule::get_param_float(fighter.module_accessor, hash40("air_accel_x_mul"), 0); let air_accel_x_add = WorkModule::get_param_float(fighter.module_accessor, hash40("air_accel_x_add"), 0); let air_speed_x_stable = WorkModule::get_param_float(fighter.module_accessor, hash40("air_speed_x_stable"), 0); - + if !KineticModule::is_enable_energy(fighter.module_accessor, *FIGHTER_KINETIC_ENERGY_ID_CONTROL) { let mut speed_x = KineticModule::get_sum_speed_x(fighter.module_accessor, *KINETIC_ENERGY_RESERVE_ATTRIBUTE_MAIN); if fighter.is_status(*FIGHTER_STATUS_KIND_SPECIAL_HI) { @@ -51,7 +51,7 @@ pub unsafe extern "C" fn special_hi_common_init(fighter: &mut L2CFighterCommon, sv_kinetic_energy!(set_stable_speed, fighter, FIGHTER_KINETIC_ENERGY_ID_CONTROL, air_speed_x_stable * speed_x_max_mul, 0.0); WorkModule::set_float(fighter.module_accessor, accel_x_mul, *FIGHTER_INSTANCE_WORK_ID_FLOAT_MUL_FALL_X_ACCEL); WorkModule::set_float(fighter.module_accessor, speed_x_max_mul, *FIGHTER_INSTANCE_WORK_ID_FLOAT_FALL_X_MAX_MUL); - + if fighter.is_status_one_of(&[*FIGHTER_STATUS_KIND_SPECIAL_HI, *FIGHTER_STATUS_KIND_FALL_SPECIAL]) { return; } @@ -60,7 +60,7 @@ pub unsafe extern "C" fn special_hi_common_init(fighter: &mut L2CFighterCommon, let max_y_param = if (status_kind == statuses::chrom::SPECIAL_HI_DIVE) { hash40("air_speed_y_stable") } else { hash40("dive_speed_y") }; let air_speed_y_stable = WorkModule::get_param_float(fighter.module_accessor, max_y_param, 0); let speed_y = KineticModule::get_sum_speed_y(fighter.module_accessor, *KINETIC_ENERGY_RESERVE_ATTRIBUTE_MAIN); - let motion_y: f32 = MotionModule::trans_move_speed(fighter.module_accessor).value[1]; + let motion_y: f32 = MotionModule::trans_move_speed(fighter.module_accessor).y(); if !KineticModule::is_enable_energy(fighter.module_accessor, *FIGHTER_KINETIC_ENERGY_ID_GRAVITY) { KineticModule::enable_energy(fighter.module_accessor, *FIGHTER_KINETIC_ENERGY_ID_GRAVITY); let flip_speed_y_mul = ParamModule::get_float(fighter.battle_object, ParamType::Agent, "param_special_hi.flip_speed_y_mul"); @@ -168,7 +168,7 @@ pub unsafe extern "C" fn special_hi_main_loop(fighter: &mut L2CFighterCommon) -> fighter.sub_change_kinetic_type_by_situation(FIGHTER_KINETIC_TYPE_MOTION.into(), FIGHTER_KINETIC_TYPE_MOTION_AIR_ANGLE.into()); fighter.sub_set_ground_correct_by_situation(true.into()); KineticModule::enable_energy(fighter.module_accessor, *FIGHTER_KINETIC_ENERGY_ID_MOTION); - } + } if MotionModule::is_end(fighter.module_accessor) { let new_status = if fighter.is_situation(*SITUATION_KIND_GROUND) { FIGHTER_STATUS_KIND_LANDING_FALL_SPECIAL } else { FIGHTER_STATUS_KIND_FALL_SPECIAL }; let accel_x_mul = ParamModule::get_float(fighter.battle_object, ParamType::Agent, "param_special_hi.fall_special_accel_x_mul"); @@ -198,7 +198,7 @@ pub unsafe extern "C" fn special_hi_main_loop(fighter: &mut L2CFighterCommon) -> // && !AttackModule::is_infliction_status(fighter.module_accessor, *COLLISION_KIND_MASK_PARRY) { // VarModule::on_flag(fighter.battle_object, vars::chrom::status::SPECIAL_HI_AERIAL_CANCEL_ENABLE); // } - + return 0.into(); } @@ -206,7 +206,7 @@ pub unsafe extern "C" fn special_hi_exec(fighter: &mut L2CFighterCommon) -> L2CV if !WorkModule::is_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_HI_FLAG_KINETIC_CHANGE_CHROM) { let move_energy = KineticModule::get_energy(fighter.module_accessor, *FIGHTER_KINETIC_ENERGY_ID_MOTION) as *mut smash::app::KineticEnergy; let move_speed_y = lua_bind::KineticEnergy::get_speed_y(move_energy); - let motion_y: f32 = MotionModule::trans_move_speed(fighter.module_accessor).value[1]; + let motion_y: f32 = MotionModule::trans_move_speed(fighter.module_accessor).y(); //If rising via motion, or triggered via acmd... if motion_y > 0.0 || WorkModule::is_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_HI_FLAG_TRANS_JUMP) { @@ -324,7 +324,7 @@ pub unsafe extern "C" fn special_hi_2_main_loop(fighter: &mut L2CFighterCommon) if VarModule::is_flag(fighter.battle_object, vars::chrom::status::SPECIAL_HI_DIVE_ENABLE) { // Aerial cancels // if VarModule::is_flag(fighter.battle_object, vars::chrom::status::SPECIAL_HI_AERIAL_CANCEL_ENABLE) - // && StatusModule::situation_kind(fighter.module_accessor) == *SITUATION_KIND_AIR + // && StatusModule::situation_kind(fighter.module_accessor) == *SITUATION_KIND_AIR // && !fighter.is_in_hitlag() // && fighter.get_aerial() != None { // fighter.change_status(FIGHTER_STATUS_KIND_ATTACK_AIR.into(), false.into()); @@ -376,7 +376,7 @@ pub unsafe extern "C" fn special_hi_3_attack(fighter: &mut L2CFighterCommon, par } pub unsafe extern "C" fn special_hi_3_init(fighter: &mut L2CFighterCommon) -> L2CValue { - WorkModule::on_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_HI_FLAG_CONTINUE_MOT); + WorkModule::on_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_HI_FLAG_CONTINUE_MOT); special_hi_common_init(fighter, statuses::chrom::SPECIAL_HI_DIVE); 0.into() } @@ -386,7 +386,7 @@ pub unsafe extern "C" fn special_hi_3_main(fighter: &mut L2CFighterCommon) -> L2 let landing_frame = ParamModule::get_float(fighter.battle_object, ParamType::Agent, "param_special_hi.dive_landing_frame"); WorkModule::set_float(fighter.module_accessor, landing_frame, *FIGHTER_INSTANCE_WORK_ID_FLOAT_LANDING_FRAME); fighter.select_cliff_hangdata_from_name("special_hi"); - + fighter.sub_shift_status_main(L2CValue::Ptr(special_hi_3_main_loop as *const () as _)) } @@ -399,7 +399,7 @@ pub unsafe extern "C" fn special_hi_3_main_loop(fighter: &mut L2CFighterCommon) if fighter.is_situation(*SITUATION_KIND_GROUND) { // Don't transition to Hi4 if Chrom used his spin final hit let dive_hi4_max_frame = ParamModule::get_float(fighter.battle_object, ParamType::Agent, "param_special_hi.dive_hi4_max_frame"); - let new_status = if is_spinning || MotionModule::frame(fighter.module_accessor) < dive_hi4_max_frame + let new_status = if is_spinning || MotionModule::frame(fighter.module_accessor) < dive_hi4_max_frame { FIGHTER_ROY_STATUS_KIND_SPECIAL_HI_4 } else { FIGHTER_STATUS_KIND_LANDING_FALL_SPECIAL }; fighter.change_status(new_status.into(), false.into()); return 1.into(); @@ -417,7 +417,7 @@ pub unsafe extern "C" fn special_hi_3_main_loop(fighter: &mut L2CFighterCommon) && motion_frame >= end_frame - 2.0; if manual_transition || auto_transition { - WorkModule::off_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_HI_FLAG_CONTINUE_MOT); + WorkModule::off_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_HI_FLAG_CONTINUE_MOT); MotionModule::change_motion(fighter.module_accessor, Hash40::new("special_air_hi_2"), 0.0, 1.0, false, 0.0, false, false); } } @@ -455,4 +455,4 @@ pub fn install(agent: &mut smashline::Agent) { agent.status(Main, statuses::chrom::SPECIAL_HI_DIVE, special_hi_3_main); agent.status(CheckAttack, statuses::chrom::SPECIAL_HI_DIVE, special_hi_3_attack); agent.status(Exit, statuses::chrom::SPECIAL_HI_DIVE, special_hi_exit); -} \ No newline at end of file +} diff --git a/fighters/common/src/function_hooks/energy/mod.rs b/fighters/common/src/function_hooks/energy/mod.rs index 1442fe0e1f..46b42284ad 100644 --- a/fighters/common/src/function_hooks/energy/mod.rs +++ b/fighters/common/src/function_hooks/energy/mod.rs @@ -2,9 +2,9 @@ use super::*; mod control; +mod damage; mod motion; mod stop; -mod damage; #[repr(C)] pub struct KineticEnergyVTable { @@ -19,10 +19,9 @@ pub struct KineticEnergyVTable { pub setup_energy: extern "C" fn(&mut KineticEnergy, u32, &Vector3f, u64, &mut BattleObjectModuleAccessor), pub clear_energy: extern "C" fn(&mut KineticEnergy), pub unk2: extern "C" fn(&mut KineticEnergy), - pub set_speed: extern "C" fn (&mut KineticEnergy, &Vector2f), + pub set_speed: extern "C" fn(&mut KineticEnergy, &Vector2f), pub mul_accel: extern "C" fn(&mut KineticEnergy, &Vector2f), // ... - } #[derive(Debug, Copy, Clone)] @@ -30,7 +29,7 @@ pub struct KineticEnergyVTable { pub struct PaddedVec2 { pub x: f32, pub y: f32, - pub padding: u64 + pub padding: u64, } impl PaddedVec2 { @@ -38,7 +37,7 @@ impl PaddedVec2 { Self { x, y, - padding: 0 + padding: 0, } } @@ -46,7 +45,7 @@ impl PaddedVec2 { Self { x: 0.0, y: 0.0, - padding: 0 + padding: 0, } } @@ -62,7 +61,7 @@ pub struct KineticEnergy { pub speed: PaddedVec2, pub rot_speed: PaddedVec2, pub enable: bool, - pub unk2: [u8; 0xF], // probably padding + pub unk2: [u8; 0xF], // probably padding pub accel: PaddedVec2, pub speed_max: PaddedVec2, pub speed_brake: PaddedVec2, @@ -76,12 +75,17 @@ pub struct KineticEnergy { impl KineticEnergy { pub fn adjust_speed_for_ground_normal(speed: &PaddedVec2, boma: &mut BattleObjectModuleAccessor) -> PaddedVec2 { - #[skyline::from_offset(0x47b4f0)] + #[skyline::from_offset(0x47b4f0)] extern "C" fn adjust_speed_for_ground_normal_internal(speed: smash_rs::cpp::simd::Vector2, boma: &mut BattleObjectModuleAccessor) -> smash_rs::cpp::simd::Vector2; unsafe { - let result = adjust_speed_for_ground_normal_internal(smash_rs::cpp::simd::Vector2 { vec: [speed.x, speed.y] }, boma); - PaddedVec2::new(result.vec[0], result.vec[1]) + let result = adjust_speed_for_ground_normal_internal( + smash_rs::cpp::simd::Vector2 { + vec: [speed.x, speed.y], + }, + boma, + ); + PaddedVec2::new(result.x(), result.y()) } } @@ -95,63 +99,43 @@ impl KineticEnergy { } pub fn update(&mut self, boma: &mut BattleObjectModuleAccessor) { - unsafe { - (self.vtable.update)(self, boma) - } + unsafe { (self.vtable.update)(self, boma) } } pub fn get_speed<'a>(&'a mut self) -> &'a mut PaddedVec2 { - unsafe { - std::mem::transmute((self.vtable.get_speed)(self)) - } + unsafe { std::mem::transmute((self.vtable.get_speed)(self)) } } pub fn initialize(&mut self, boma: &mut BattleObjectModuleAccessor) { - unsafe { - (self.vtable.initialize)(self, boma) - } + unsafe { (self.vtable.initialize)(self, boma) } } pub fn get_some_flag(&mut self) -> bool { - unsafe { - (self.vtable.get_some_flag)(self) - } + unsafe { (self.vtable.get_some_flag)(self) } } pub fn set_some_flag(&mut self, flag: bool) { - unsafe { - (self.vtable.set_some_flag)(self, flag) - } + unsafe { (self.vtable.set_some_flag)(self, flag) } } pub fn setup_energy(&mut self, reset_type: u32, incoming_speed: &Vector3f, some: u64, boma: &mut BattleObjectModuleAccessor) { - unsafe { - (self.vtable.setup_energy)(self, reset_type, incoming_speed, some, boma) - } + unsafe { (self.vtable.setup_energy)(self, reset_type, incoming_speed, some, boma) } } pub fn clear_energy(&mut self) { - unsafe { - (self.vtable.clear_energy)(self) - } + unsafe { (self.vtable.clear_energy)(self) } } pub fn unk2(&mut self) { - unsafe { - (self.vtable.unk2)(self) - } + unsafe { (self.vtable.unk2)(self) } } pub fn set_speed(&mut self, speed: &Vector2f) { - unsafe { - (self.vtable.set_speed)(self, speed) - } + unsafe { (self.vtable.set_speed)(self, speed) } } pub fn mul_accel(&mut self, mul: &Vector2f) { - unsafe { - (self.vtable.mul_accel)(self, mul) - } + unsafe { (self.vtable.mul_accel)(self, mul) } } } @@ -160,4 +144,4 @@ pub fn install() { motion::install(); stop::install(); damage::install(); -} \ No newline at end of file +} diff --git a/fighters/common/src/function_hooks/energy/motion.rs b/fighters/common/src/function_hooks/energy/motion.rs index 7525ecc9e6..30eb1153c6 100644 --- a/fighters/common/src/function_hooks/energy/motion.rs +++ b/fighters/common/src/function_hooks/energy/motion.rs @@ -1,6 +1,6 @@ use super::*; -use crate::consts::*; use crate::consts::globals::*; +use crate::consts::*; use std::ops::{Deref, DerefMut}; #[derive(Debug, Copy, Clone, PartialEq, Eq)] @@ -19,7 +19,7 @@ pub enum EnergyMotionResetType { CliffTrans, CliffTransGround, LadderMove, - LadderTrans + LadderTrans, } impl EnergyMotionResetType { @@ -114,9 +114,9 @@ impl FighterKineticEnergyMotion { let func: extern "C" fn(&mut BattleObjectModuleAccessor) -> smash_rs::cpp::simd::Vector3 = std::mem::transmute(MotionModule::trans_move_speed as *const ()); let vec = func(boma); Vector3f { - x: vec.vec[0], - y: vec.vec[1], - z: vec.vec[2] + x: vec.x(), + y: vec.y(), + z: vec.z(), } } } @@ -126,9 +126,9 @@ impl FighterKineticEnergyMotion { let func: extern "C" fn(&mut BattleObjectModuleAccessor) -> smash_rs::cpp::simd::Vector3 = std::mem::transmute(MotionModule::trans_move_speed_2nd as *const ()); let vec = func(boma); Vector3f { - x: vec.vec[0], - y: vec.vec[1], - z: vec.vec[2] + x: vec.x(), + y: vec.y(), + z: vec.z(), } } } @@ -191,7 +191,7 @@ unsafe fn motion_update(energy: &mut FighterKineticEnergyMotion, boma: &mut Batt energy.active_flag = true; if !FighterKineticEnergyMotion::is_motion_updating_energy(boma, reset_type) { let backup_brake = energy.speed_brake; - + if reset_type == LadderMove { // If we are on a ladder, we need to **immediately** stop moving if the MotionModule is no longer updating our position // By setting the acceleration to negative of our speed, we are immediately stopping our movement. This should not be applied @@ -199,22 +199,14 @@ unsafe fn motion_update(energy: &mut FighterKineticEnergyMotion, boma: &mut Batt // // A bug that I encountered when reimplementing was setting this for the grounded states as well, which caused things like jumpsquat // and landing to immediately stop all momentum - energy.set_values_and_process( - PaddedVec2::new(-energy.speed.x, -energy.speed.y), - PaddedVec2::zeros(), - PaddedVec2::zeros(), - boma - ); + energy.set_values_and_process(PaddedVec2::new(-energy.speed.x, -energy.speed.y), PaddedVec2::zeros(), PaddedVec2::zeros(), boma); return; } // Set our grounded speed limit if we are on the ground // This is applied in situations like landing (which includes wavetech in HDR) if reset_type.is_ground() { - energy.speed_limit = PaddedVec2::new( - WorkModule::get_param_float(boma, smash::hash40("common"), smash::hash40("ground_speed_limit")), - 0.0 - ); + energy.speed_limit = PaddedVec2::new(WorkModule::get_param_float(boma, smash::hash40("common"), smash::hash40("ground_speed_limit")), 0.0); } // @@ -222,17 +214,18 @@ unsafe fn motion_update(energy: &mut FighterKineticEnergyMotion, boma: &mut Batt // Double traction while above max walk speed if StatusModule::status_kind(boma) <= 0x1DB // only affects common statuses && boma.is_situation(*SITUATION_KIND_GROUND) - && !boma.is_prev_situation(*SITUATION_KIND_AIR) { + && !boma.is_prev_situation(*SITUATION_KIND_AIR) + { let mut damage_energy = KineticModule::get_energy(boma, *FIGHTER_KINETIC_ENERGY_ID_DAMAGE) as *mut app::KineticEnergy; let damage_speed_x = app::lua_bind::KineticEnergy::get_speed_x(damage_energy); // If our speed is being influenced by knockback, we handle double traction elsewhere if damage_speed_x == 0.0 { - let walk_speed_max = WorkModule::get_param_float(boma, smash::hash40("walk_speed_max"), 0); + let walk_speed_max = WorkModule::get_param_float(boma, smash::hash40("walk_speed_max"), 0); let speed = &mut energy.speed; let adjusted_speed = energy::KineticEnergy::adjust_speed_for_ground_normal(speed, boma); let magnitude = (adjusted_speed.x.powi(2) + adjusted_speed.y.powi(2)).sqrt(); - + if magnitude >= walk_speed_max { energy.speed_brake.x *= 2.0; } @@ -246,12 +239,7 @@ unsafe fn motion_update(energy: &mut FighterKineticEnergyMotion, boma: &mut Batt // For ground, this is `ground_brake`, for example. That's the only thing applied here. // If you wanted to, say apply double traction in this situation you could double the energy.brake temporarily and restore it afterwards // as done in the control kinetic energy for some situations - energy.set_values_and_process( - PaddedVec2::zeros(), - PaddedVec2::zeros(), - PaddedVec2::zeros(), - boma - ); + energy.set_values_and_process(PaddedVec2::zeros(), PaddedVec2::zeros(), PaddedVec2::zeros(), boma); energy.speed_brake = backup_brake; @@ -264,30 +252,22 @@ unsafe fn motion_update(energy: &mut FighterKineticEnergyMotion, boma: &mut Batt // Allows all grounded attacks to retain sliding momentum by default let mut is_stop_added = false; - - if !energy.update_flag - && boma.is_status_one_of(&[ - *FIGHTER_STATUS_KIND_ATTACK_HI4_START, - *FIGHTER_STATUS_KIND_ATTACK_HI4_HOLD, - *FIGHTER_STATUS_KIND_ATTACK_HI4, - *FIGHTER_STATUS_KIND_ATTACK_S4_START, - *FIGHTER_STATUS_KIND_ATTACK_S4_HOLD, - *FIGHTER_STATUS_KIND_ATTACK_S4, - *FIGHTER_STATUS_KIND_ATTACK_LW4_START, - *FIGHTER_STATUS_KIND_ATTACK_LW4_HOLD, - *FIGHTER_STATUS_KIND_ATTACK_LW4, - *FIGHTER_STATUS_KIND_ATTACK, - *FIGHTER_STATUS_KIND_ATTACK_HI3, - *FIGHTER_STATUS_KIND_ATTACK_S3, - *FIGHTER_STATUS_KIND_ATTACK_LW3]) - { + + if !energy.update_flag && boma.is_status_one_of(&[*FIGHTER_STATUS_KIND_ATTACK_HI4_START, *FIGHTER_STATUS_KIND_ATTACK_HI4_HOLD, *FIGHTER_STATUS_KIND_ATTACK_HI4, *FIGHTER_STATUS_KIND_ATTACK_S4_START, *FIGHTER_STATUS_KIND_ATTACK_S4_HOLD, *FIGHTER_STATUS_KIND_ATTACK_S4, *FIGHTER_STATUS_KIND_ATTACK_LW4_START, *FIGHTER_STATUS_KIND_ATTACK_LW4_HOLD, *FIGHTER_STATUS_KIND_ATTACK_LW4, *FIGHTER_STATUS_KIND_ATTACK, *FIGHTER_STATUS_KIND_ATTACK_HI3, *FIGHTER_STATUS_KIND_ATTACK_S3, *FIGHTER_STATUS_KIND_ATTACK_LW3]) { let mut stop_energy = KineticModule::get_energy(boma, *FIGHTER_KINETIC_ENERGY_ID_STOP) as *mut app::KineticEnergy; let prev_speed = KineticModule::get_sum_speed3f(boma, *KINETIC_ENERGY_RESERVE_ATTRIBUTE_MAIN); - let reset_speed_2f = Vector2f { x: prev_speed.x, y: prev_speed.y }; - let reset_speed_3f = Vector3f { x: 0.0, y: 0.0, z: 0.0 }; + let reset_speed_2f = Vector2f { + x: prev_speed.x, + y: prev_speed.y, + }; + let reset_speed_3f = Vector3f { + x: 0.0, + y: 0.0, + z: 0.0, + }; lua_bind::KineticEnergy::reset_energy(stop_energy, *ENERGY_STOP_RESET_TYPE_GROUND, &reset_speed_2f, &reset_speed_3f, boma); lua_bind::KineticEnergy::enable(stop_energy); - + is_stop_added = true; } @@ -347,19 +327,19 @@ unsafe fn motion_update(energy: &mut FighterKineticEnergyMotion, boma: &mut Batt energy.active_flag = true; energy.speed_limit = PaddedVec2::new(-1.0, 0.0); move_speed - }, - + } + GroundTransIgnoreNorm => { energy.speed_limit = PaddedVec2::new(-1.0, 0.0); move_speed - }, + } // I'm still not quit sure what this "active_flag" is, but it's unset for these moves and reset for other moves? // Enabling it for this and the previous reset_types doesn't appear to have any different behavior off a few quick tests GroundTrans => { energy.speed_limit = PaddedVec2::new(-1.0, 0.0); energy::KineticEnergy::adjust_speed_for_ground_normal(&move_speed, boma) - }, + } // Haven't quite figured out where this gets used yet, and the work const has a few hits so I'm just not quite sure GroundTransLoopGekikara => { @@ -368,26 +348,18 @@ unsafe fn motion_update(energy: &mut FighterKineticEnergyMotion, boma: &mut Batt let some_rate = WorkModule::get_float(boma, 0x1000009); let motion_rate = MotionModule::rate(boma); if some_rate != 0.0 && motion_rate / some_rate != 0.0 { - PaddedVec2::new( - move_speed.x * some_rate / motion_rate, - move_speed.y * some_rate / motion_rate - ) + PaddedVec2::new(move_speed.x * some_rate / motion_rate, move_speed.y * some_rate / motion_rate) } else { PaddedVec2::zeros() } - }, + } // When you are in the air your speed doesn't have any special calculations AirTrans | AirTrans2nd => move_speed, // This multiplies by the angle set with (afaik) app::sv_kinetic_energy::set_angle // Set angle whole is used regardless of the energy reset type - AirTransAngle => { - PaddedVec2::new( - move_speed.x * energy.angle.cos() - move_speed.y * energy.angle.sin(), - move_speed.y * energy.angle.cos() + move_speed.x * energy.angle.sin() - ) - }, + AirTransAngle => PaddedVec2::new(move_speed.x * energy.angle.cos() - move_speed.y * energy.angle.sin(), move_speed.y * energy.angle.cos() + move_speed.x * energy.angle.sin()), // Here we zero out the X speed and literally only use the Y speed. Epic! AirTransY => PaddedVec2::new(0.0, move_speed.y), @@ -412,26 +384,22 @@ unsafe fn motion_update(energy: &mut FighterKineticEnergyMotion, boma: &mut Batt } energy.angle }; - PaddedVec2::new( - move_speed.x * angle.cos() - move_speed.y * energy.angle.sin(), - move_speed.y * angle.cos() + move_speed.x * energy.angle.sin() - ) - }, + PaddedVec2::new(move_speed.x * angle.cos() - move_speed.y * energy.angle.sin(), move_speed.y * angle.cos() + move_speed.x * energy.angle.sin()) + } // Cliff functions require using a dedicated function, probably to figure out where the fighter needs to move // to in order to complete the cliff catch // These likely happen in a very brief, perhaps only 1 frame, window CliffTransIntp | CliffTrans | CliffTransGround => { - let motion_module = *(boma as *const BattleObjectModuleAccessor as *const u64).add(0x88 / 0x8); let motion_vtable = *(motion_module as *const *const u64); let some_func: extern "C" fn(u64) -> smash_rs::cpp::simd::Vector4 = std::mem::transmute(*motion_vtable.add(0x230 / 0x8)); let vec = some_func(motion_module); let vec = Vector4f { - x: vec.vec[0], - y: vec.vec[1], - z: vec.vec[2], - w: vec.vec[3] + x: vec.x(), + y: vec.y(), + z: vec.z(), + w: vec.w(), }; if reset_type == CliffTransGround { energy.active_flag = true; @@ -440,11 +408,11 @@ unsafe fn motion_update(energy: &mut FighterKineticEnergyMotion, boma: &mut Batt if reset_type == CliffTransIntp { let frame = WorkModule::get_int(boma, 0x11000005); let interpolated = 1.0 / (frame + 1) as f32; - PaddedVec2::new(vec.vec[0] * interpolated, vec.vec[1] * interpolated) + PaddedVec2::new(vec.x() * interpolated, vec.y() * interpolated) } else { - PaddedVec2::new(vec.vec[0], vec.vec[1]) + PaddedVec2::new(vec.x(), vec.y()) } - }, + } // LadderMove appears to be for when you are actually moving up/down the later LadderMove => { @@ -461,33 +429,31 @@ unsafe fn motion_update(energy: &mut FighterKineticEnergyMotion, boma: &mut Batt }; PaddedVec2::new(0.0, speed_y) - }, + } // As opposed to LadderMove, LadderTrans is likely for when you are getting on/off the ladder - // + // // The reason I say this, is due to a bug in reimplementation, when you would get off the ladder you // would meet god in the top blastzone LadderTrans => { energy.active_flag = true; let ladder_end_y = WorkModule::get_float(boma, *FIGHTER_STATUS_LADDER_WORK_FLOAT_LADDER_END_Y); let ladder_end_start_y = WorkModule::get_float(boma, *FIGHTER_STATUS_LADDER_WORK_FLOAT_LADDER_END_START_Y); - let mut vec = Vector3f { x: 0.0, y: 0.0, z: 0.0 }; + let mut vec = Vector3f { + x: 0.0, + y: 0.0, + z: 0.0, + }; MotionModule::trans_tra(boma, &mut vec, true, true); let speed_y = (ladder_end_y + vec.y) - ladder_end_start_y; WorkModule::add_float(boma, speed_y, *FIGHTER_STATUS_LADDER_WORK_FLOAT_LADDER_END_START_Y); PaddedVec2::new(0.0, speed_y) - } - // _ => {} + } // _ => {} }; // It is unclear to me why this specific case is handled so explicitly, but it is if reset_type.is_ground() && energy.update_flag && speed.x == 0.0 && energy.prev_speed.x == 0.0 { - energy.set_values_and_process( - PaddedVec2::zeros(), - PaddedVec2::zeros(), - speed, - boma - ); + energy.set_values_and_process(PaddedVec2::zeros(), PaddedVec2::zeros(), speed, boma); return; } @@ -505,18 +471,11 @@ unsafe fn motion_update(energy: &mut FighterKineticEnergyMotion, boma: &mut Batt energy.speed }; - // Since acceleration is just the difference in speed between two frames, just subtract where we want to be + // Since acceleration is just the difference in speed between two frames, just subtract where we want to be // and where we were/are - energy.set_values_and_process( - PaddedVec2::new(speed.x - speed_to_change_from.x, speed.y - speed_to_change_from.y), - PaddedVec2::new(-1.0, -1.0), - speed, - boma - ); + energy.set_values_and_process(PaddedVec2::new(speed.x - speed_to_change_from.x, speed.y - speed_to_change_from.y), PaddedVec2::new(-1.0, -1.0), speed, boma); } pub fn install() { - skyline::install_hooks!( - motion_update - ); -} \ No newline at end of file + skyline::install_hooks!(motion_update); +} diff --git a/fighters/common/src/function_hooks/energy/stop.rs b/fighters/common/src/function_hooks/energy/stop.rs index 0be0497c93..8473360a9b 100644 --- a/fighters/common/src/function_hooks/energy/stop.rs +++ b/fighters/common/src/function_hooks/energy/stop.rs @@ -1,6 +1,6 @@ use super::*; -use crate::consts::*; use crate::consts::globals::*; +use crate::consts::*; use std::ops::{Deref, DerefMut}; #[repr(C)] @@ -22,8 +22,7 @@ pub struct FighterKineticEnergyStop { _xBA: bool, _xBB: bool, _xBC: u32, - _xC0: PaddedVec2 - // ... + _xC0: PaddedVec2, // ... } impl Deref for FighterKineticEnergyStop { @@ -45,7 +44,7 @@ impl FighterKineticEnergyStop { unsafe { let func: extern "C" fn(&mut BattleObjectModuleAccessor, i32, i32) -> smash_rs::cpp::simd::Vector3 = std::mem::transmute(LinkModule::get_parent_sum_speed as *const ()); let vec = func(boma, link_no, arg); - PaddedVec2::new(vec.vec[0], vec.vec[1]) + PaddedVec2::new(vec.x(), vec.y()) } } } @@ -96,12 +95,13 @@ unsafe fn update_stop(energy: &mut FighterKineticEnergyStop, boma: &mut BattleOb // Double traction while above max walk speed if StatusModule::status_kind(boma) <= 0x1DB // only affects common statuses && boma.is_situation(*SITUATION_KIND_GROUND) - && !boma.is_prev_situation(*SITUATION_KIND_AIR) { + && !boma.is_prev_situation(*SITUATION_KIND_AIR) + { let mut damage_energy = KineticModule::get_energy(boma, *FIGHTER_KINETIC_ENERGY_ID_DAMAGE) as *mut app::KineticEnergy; let damage_speed_x = app::lua_bind::KineticEnergy::get_speed_x(damage_energy); // If our speed is being influenced by knockback, we handle double traction elsewhere if damage_speed_x == 0.0 { - let walk_speed_max = WorkModule::get_param_float(boma, smash::hash40("walk_speed_max"), 0); + let walk_speed_max = WorkModule::get_param_float(boma, smash::hash40("walk_speed_max"), 0); if matches!(energy.reset_type, Ground | CatchDash | DamageGround | GuardDamage | DamageGroundOrbit | ShieldRebound) { let speed = energy.get_speed(); let adjusted_speed = energy::KineticEnergy::adjust_speed_for_ground_normal(speed, boma); @@ -113,24 +113,18 @@ unsafe fn update_stop(energy: &mut FighterKineticEnergyStop, boma: &mut BattleOb } } } - } // call_original!(energy, boma); - + energy.speed_brake = backup_brake; } #[skyline::hook(offset = 0x6d8560)] pub unsafe extern "Rust" fn setup_stop(energy: &mut FighterKineticEnergyStop, reset_type: EnergyStopResetType, initial_speed: &PaddedVec2, unk: u64, boma: &mut BattleObjectModuleAccessor) { - if ( boma.is_fighter() - && (boma.kind() == *FIGHTER_KIND_MEWTWO && boma.is_status(*FIGHTER_MEWTWO_STATUS_KIND_SPECIAL_HI_2)) - || (boma.kind() == *FIGHTER_KIND_PALUTENA && boma.is_status(*FIGHTER_PALUTENA_STATUS_KIND_SPECIAL_HI_2)) - || (boma.kind() == *FIGHTER_KIND_SHEIK && boma.is_status(*FIGHTER_SHEIK_STATUS_KIND_SPECIAL_HI_MOVE)) - || (boma.kind() == *FIGHTER_KIND_ZELDA && boma.is_status(*FIGHTER_ZELDA_STATUS_KIND_SPECIAL_HI_2)) ) - { + if (boma.is_fighter() && (boma.kind() == *FIGHTER_KIND_MEWTWO && boma.is_status(*FIGHTER_MEWTWO_STATUS_KIND_SPECIAL_HI_2)) || (boma.kind() == *FIGHTER_KIND_PALUTENA && boma.is_status(*FIGHTER_PALUTENA_STATUS_KIND_SPECIAL_HI_2)) || (boma.kind() == *FIGHTER_KIND_SHEIK && boma.is_status(*FIGHTER_SHEIK_STATUS_KIND_SPECIAL_HI_MOVE)) || (boma.kind() == *FIGHTER_KIND_ZELDA && boma.is_status(*FIGHTER_ZELDA_STATUS_KIND_SPECIAL_HI_2))) { VarModule::set_float(boma.object(), vars::common::status::TELEPORT_INITIAL_SPEED_X, initial_speed.x); VarModule::set_float(boma.object(), vars::common::status::TELEPORT_INITIAL_SPEED_Y, initial_speed.y); } @@ -138,8 +132,5 @@ pub unsafe extern "Rust" fn setup_stop(energy: &mut FighterKineticEnergyStop, re } pub fn install() { - skyline::install_hooks!( - update_stop, - setup_stop - ); -} \ No newline at end of file + skyline::install_hooks!(update_stop, setup_stop); +} diff --git a/fighters/common/src/function_hooks/knockback_util.rs b/fighters/common/src/function_hooks/knockback_util.rs index 8b2cf868cb..29b767e1ab 100644 --- a/fighters/common/src/function_hooks/knockback_util.rs +++ b/fighters/common/src/function_hooks/knockback_util.rs @@ -7,24 +7,56 @@ extern "C" { } #[repr(simd)] -#[derive(Debug)] +#[derive(Clone, Copy)] struct Rect { // left: f32, // right: f32, // top: f32, // bottom: f32, - vec: [f32; 4] + vec: [f32; 4], } impl Rect { + pub fn x(self) -> f32 { + unsafe { core::intrinsics::simd::simd_extract(self, 0) } + } + pub fn set_x(&mut self, value: f32) { + unsafe { + *self = core::intrinsics::simd::simd_insert(*self, 0, value); + } + } + pub fn y(self) -> f32 { + unsafe { core::intrinsics::simd::simd_extract(self, 1) } + } + pub fn set_y(&mut self, value: f32) { + unsafe { + *self = core::intrinsics::simd::simd_insert(*self, 1, value); + } + } + pub fn z(self) -> f32 { + unsafe { core::intrinsics::simd::simd_extract(self, 2) } + } + pub fn set_z(&mut self, value: f32) { + unsafe { + *self = core::intrinsics::simd::simd_insert(*self, 2, value); + } + } + pub fn w(self) -> f32 { + unsafe { core::intrinsics::simd::simd_extract(self, 3) } + } + pub fn set_w(&mut self, value: f32) { + unsafe { + *self = core::intrinsics::simd::simd_insert(*self, 3, value); + } + } fn contains(&self, x: f32, y: f32) -> bool { - (self.vec[0] <= x && x <= self.vec[1]) && (self.vec[3] <= y && y <= self.vec[2]) + (self.x() <= x && x <= self.y()) && (self.w() <= y && y <= self.z()) } fn grow(&mut self, x: f32, y: f32) { - self.vec[0] -= x; - self.vec[1] += x; - self.vec[2] += y; - self.vec[3] -= y; + self.set_x(self.x() - x); + self.set_y(self.y() + x); + self.set_z(self.z() + y); + self.set_w(self.w() - y); } } @@ -68,21 +100,12 @@ const DEAD_AREA_LENIENCY: f32 = 7.5; const DEAD_AREA_LENIENCY_FINAL: f32 = 2.5; impl KnockbackCalcContext { - pub unsafe fn new( - defender_boma: *mut BattleObjectModuleAccessor, - knockback: f32, - hitstun: f32, - damage: f32, - sdi_mul: f32, - launch_radians: f32, - launch_speed: Vector2f, - is_tumble: bool, - ) -> Self { - let fly_top_angle_lw= WorkModule::get_param_float(defender_boma, hash40("battle_object"), hash40("fly_top_angle_lw")); - let fly_top_angle_hi= WorkModule::get_param_float(defender_boma, hash40("battle_object"), hash40("fly_top_angle_hi")); + pub unsafe fn new(defender_boma: *mut BattleObjectModuleAccessor, knockback: f32, hitstun: f32, damage: f32, sdi_mul: f32, launch_radians: f32, launch_speed: Vector2f, is_tumble: bool) -> Self { + let fly_top_angle_lw = WorkModule::get_param_float(defender_boma, hash40("battle_object"), hash40("fly_top_angle_lw")); + let fly_top_angle_hi = WorkModule::get_param_float(defender_boma, hash40("battle_object"), hash40("fly_top_angle_hi")); let ecb_bottom = *GroundModule::get_rhombus(defender_boma, true).add(1); - let ecb_left = *GroundModule::get_rhombus(defender_boma, true).add(2); - let ecb_right = *GroundModule::get_rhombus(defender_boma, true).add(3); + let ecb_left = *GroundModule::get_rhombus(defender_boma, true).add(2); + let ecb_right = *GroundModule::get_rhombus(defender_boma, true).add(3); let y_chara_speed = 0.0; let air_accel_y = WorkModule::get_param_float(defender_boma, hash40("air_accel_y"), hash40("")); let hitstun_gravity_min = ParamModule::get_float((*defender_boma).object(), ParamType::Common, "hitstun_gravity_min"); @@ -97,13 +120,13 @@ impl KnockbackCalcContext { } else { 1.0 }; - let sdi_frame = WorkModule::get_param_int(defender_boma, hash40("common"), hash40("hit_stop_delay_flick_frame")); + let sdi_frame = WorkModule::get_param_int(defender_boma, hash40("common"), hash40("hit_stop_delay_flick_frame")); let sdi_max_count = WorkModule::get_param_int(defender_boma, hash40("common"), hash40("hit_stop_delay_flick_max_count")); - let base_sdi = WorkModule::get_param_float(defender_boma, hash40("common"), hash40("hit_stop_delay_flick_mul")); - let base_asdi = WorkModule::get_param_float(defender_boma, hash40("common"), hash40("hit_stop_delay_auto_mul")); - let hitlag_max = WorkModule::get_param_float(defender_boma, hash40("battle_object"), hash40("hitstop_frame_max")); - let hitlag_add = WorkModule::get_param_float(defender_boma, hash40("battle_object"), hash40("hitstop_frame_add")); - let hitlag_mul = WorkModule::get_param_float(defender_boma, hash40("battle_object"), hash40("hitstop_frame_mul")); + let base_sdi = WorkModule::get_param_float(defender_boma, hash40("common"), hash40("hit_stop_delay_flick_mul")); + let base_asdi = WorkModule::get_param_float(defender_boma, hash40("common"), hash40("hit_stop_delay_auto_mul")); + let hitlag_max = WorkModule::get_param_float(defender_boma, hash40("battle_object"), hash40("hitstop_frame_max")); + let hitlag_add = WorkModule::get_param_float(defender_boma, hash40("battle_object"), hash40("hitstop_frame_add")); + let hitlag_mul = WorkModule::get_param_float(defender_boma, hash40("battle_object"), hash40("hitstop_frame_mul")); let hitlag = (2.0 * (damage * hitlag_mul + hitlag_add)).clamp(0.0, hitlag_max).floor(); let sdi_count = ((hitlag - 1.0) / (sdi_frame as f32)).clamp(0.0, sdi_max_count as f32).floor(); let sdi_distance = (sdi_count * base_sdi + base_asdi) * sdi_mul; @@ -139,10 +162,7 @@ impl KnockbackCalcContext { pub unsafe fn reset_angle(&mut self, launch_radians: f32) { // calculate values that depend on the new angle let mag = (self.launch_speed.y.powi(2) + self.launch_speed.x.powi(2)).sqrt(); - let launch_speed = Vector2f::new( - launch_radians.cos() * mag, - launch_radians.sin() * mag, - ); + let launch_speed = Vector2f::new(launch_radians.cos() * mag, launch_radians.sin() * mag); // update the context self.launch_radians = launch_radians; self.launch_speed = launch_speed; @@ -154,11 +174,15 @@ impl KnockbackCalcContext { // check left wall tech let ecb_offset = self.ecb_left.x - self.ecb_bottom.x; if GroundModule::ray_check( - defender_boma, - &self.pos, - &Vector2f{ x: -1.0 * self.sdi_distance + ecb_offset, y: 0.0}, - true - ) == 1 { + defender_boma, + &self.pos, + &Vector2f { + x: -1.0 * self.sdi_distance + ecb_offset, + y: 0.0, + }, + true, + ) == 1 + { self.is_tech_possible = true; return; } @@ -166,23 +190,31 @@ impl KnockbackCalcContext { // check right wall tech let ecb_offset = self.ecb_right.x - self.ecb_bottom.x; if GroundModule::ray_check( - defender_boma, - &self.pos, - &Vector2f{ x: self.sdi_distance + ecb_offset, y: 0.0}, - true - ) == 1 { + defender_boma, + &self.pos, + &Vector2f { + x: self.sdi_distance + ecb_offset, + y: 0.0, + }, + true, + ) == 1 + { self.is_tech_possible = true; return; } // check floor tech if self.pos.y - self.pos_prev.y < self.base_asdi * self.sdi_mul - && GroundModule::ray_check( - defender_boma, - &self.pos, - &Vector2f{ x: 0.0, y: self.sdi_distance}, - true - ) == 1 { + && GroundModule::ray_check( + defender_boma, + &self.pos, + &Vector2f { + x: 0.0, + y: self.sdi_distance, + }, + true, + ) == 1 + { self.is_tech_possible = true; return; } @@ -192,11 +224,12 @@ impl KnockbackCalcContext { let defender_boma = self.defender_boma; let diff = Vector2f::new(self.pos.x - self.pos_prev.x, self.pos.y - self.pos_prev.y); if GroundModule::ray_check( - defender_boma, - &self.pos_prev, - &diff, - diff.y <= 0.0 // only check for platforms if going downwards - ) == 1 { + defender_boma, + &self.pos_prev, + &diff, + diff.y <= 0.0, // only check for platforms if going downwards + ) == 1 + { self.is_tech_possible = true; return; } @@ -204,10 +237,7 @@ impl KnockbackCalcContext { pub unsafe fn step(&mut self) { let kb_angle = self.launch_speed.y.atan2(self.launch_speed.x); - let decay = Vector2f::new( - self.damage_air_brake * kb_angle.cos().abs(), - self.damage_air_brake * kb_angle.sin().abs() - ); + let decay = Vector2f::new(self.damage_air_brake * kb_angle.cos().abs(), self.damage_air_brake * kb_angle.sin().abs()); self.pos_prev.x = self.pos.x; self.pos_prev.y = self.pos.y; @@ -219,7 +249,7 @@ impl KnockbackCalcContext { if (self.launch_speed.x < 0.0) { self.launch_speed.x = 0.0; } else { - self.launch_speed.x *= dir; + self.launch_speed.x *= dir; } } @@ -255,7 +285,7 @@ impl KnockbackCalcContext { let defender_boma = self.defender_boma; let (num_angles_checked, survivable_angles_allowed, dead_area_leniency_x, dead_area_leniency_y) = if is_final { (NUM_ANGLES_CHECKED_FINAL, SURVIVABLE_ANGLES_ALLOWED_FINAL, DEAD_AREA_LENIENCY_FINAL, DEAD_AREA_LENIENCY_FINAL) - } else { + } else { let x = DEAD_AREA_LENIENCY.max(self.sdi_distance); let y = if StatusModule::situation_kind(defender_boma) != *SITUATION_KIND_GROUND { DEAD_AREA_LENIENCY.max(self.sdi_distance) @@ -276,7 +306,7 @@ impl KnockbackCalcContext { for idx in 0..num_angles_checked + 1 { // calc and update the DI angle let new_radians = (min_di + (idx as f32 * step)).to_radians(); - + // reset everything to scratch *self = original_context.clone(); self.reset_angle(new_radians); @@ -301,4 +331,4 @@ impl KnockbackCalcContext { } return true; } -} \ No newline at end of file +} diff --git a/fighters/common/src/function_hooks/vtables/dolly_burst.rs b/fighters/common/src/function_hooks/vtables/dolly_burst.rs index 4f97fb9dc1..04bcd39ebb 100644 --- a/fighters/common/src/function_hooks/vtables/dolly_burst.rs +++ b/fighters/common/src/function_hooks/vtables/dolly_burst.rs @@ -3,7 +3,7 @@ use utils::ext::*; // thanks wuboy -static mut BURST_BOMA_PTR : u64 = 0; +static mut BURST_BOMA_PTR: u64 = 0; #[skyline::hook(offset = 0x97569c, inline)] unsafe extern "C" fn burst_check_status(ctx: &mut skyline::hooks::InlineCtx) { @@ -11,8 +11,7 @@ unsafe extern "C" fn burst_check_status(ctx: &mut skyline::hooks::InlineCtx) { let battle_object: *mut BattleObject = utils::util::get_battle_object_from_id((*module_accessor).battle_object_id); BURST_BOMA_PTR = module_accessor as u64; let status = ctx.registers[0].w() as i32; - if status == *FIGHTER_DOLLY_STATUS_KIND_SUPER_SPECIAL - && VarModule::is_flag(battle_object, vars::dolly::status::SUPER_SPECIAL_TRIPLE) { + if status == *FIGHTER_DOLLY_STATUS_KIND_SUPER_SPECIAL && VarModule::is_flag(battle_object, vars::dolly::status::SUPER_SPECIAL_TRIPLE) { ctx.registers[0].set_w(0); } } @@ -23,14 +22,13 @@ unsafe extern "C" fn burst_set_motion(ctx: &mut skyline::hooks::InlineCtx) { let battle_object: *mut BattleObject = utils::util::get_battle_object_from_id((*module_accessor).battle_object_id); let mut motion = ctx.registers[8].x(); // println!("motion: {:#x}", motion); - if StatusModule::status_kind(module_accessor) == *FIGHTER_DOLLY_STATUS_KIND_SUPER_SPECIAL - && VarModule::is_flag(battle_object, vars::dolly::status::SUPER_SPECIAL_TRIPLE) { + if StatusModule::status_kind(module_accessor) == *FIGHTER_DOLLY_STATUS_KIND_SUPER_SPECIAL && VarModule::is_flag(battle_object, vars::dolly::status::SUPER_SPECIAL_TRIPLE) { let num = VarModule::get_int(battle_object, vars::dolly::status::SUPER_SPECIAL_TRIPLE_COUNT); motion = match num { 1 => hash40("super_special_triple_1"), 2 => hash40("super_special_triple_2"), 3 => hash40("super_special_triple_3"), - _ => hash40("super_special") + _ => hash40("super_special"), }; } ctx.registers[8].set_x(motion); @@ -48,15 +46,16 @@ unsafe extern "C" fn burst_init(_vtable: u64, weapon: *mut app::Weapon, somethin // println!("is_air: {}", is_air); WorkModule::set_flag(module_accessor, is_air, *WEAPON_DOLLY_BURST_INSTANCE_WORK_ID_FLAG_AIR); - if [ - hash40("final2"), - hash40("final3"), - hash40("super_special_triple_2"), - hash40("super_special_triple_3"), - ].contains(&motion) { + if [hash40("final2"), hash40("final3"), hash40("super_special_triple_2"), hash40("super_special_triple_3")].contains(&motion) { let pos = &mut *(something as *mut smash_rs::cpp::simd::Vector2).add(0x98 / 0x8); - // println!("pos: {}, {}", pos.vec[0], pos.vec[1]); - GroundModule::set_shape_safe_pos(module_accessor, &Vector2f{x: pos.vec[0], y: pos.vec[1]}); + // println!("pos: {}, {}", pos.x(), pos.y()); + GroundModule::set_shape_safe_pos( + module_accessor, + &Vector2f { + x: pos.x(), + y: pos.y(), + }, + ); } let atack_mul = *(something as *const f32).add(0xa8 / 0x4); @@ -78,18 +77,13 @@ unsafe extern "C" fn burst_on_hit(_vtable: u64, weapon: *mut app::Weapon) -> u64 let event = if motion == hash40("final") { 0x1e7886b711 - } - else if motion == hash40("final2") { + } else if motion == hash40("final2") { 0x1f701d1848 - } - else if motion == hash40("final3") { + } else if motion == hash40("final3") { 0x1f071a28de - } - else if [ - hash40("super_special"), - hash40("super_special_triple_3"), - ].contains(&motion) { - if WorkModule::is_flag(module_accessor, 0x20000006) { // WEAPON_DOLLY_BURST_INSTANCE_WORK_ID_FLAG_HIT_SUPER_SPECIAL + } else if [hash40("super_special"), hash40("super_special_triple_3")].contains(&motion) { + if WorkModule::is_flag(module_accessor, 0x20000006) { + // WEAPON_DOLLY_BURST_INSTANCE_WORK_ID_FLAG_HIT_SUPER_SPECIAL return 0; } @@ -99,21 +93,15 @@ unsafe extern "C" fn burst_on_hit(_vtable: u64, weapon: *mut app::Weapon) -> u64 WorkModule::on_flag(module_accessor, 0x20000006); 0x265df8a12e - } - else { + } else { 0 }; - + LinkModule::send_event_parents(module_accessor, 3, Hash40::new_raw(event)); - return 0 + return 0; } pub fn install() { - skyline::install_hooks!( - burst_check_status, - burst_set_motion, - burst_init, - burst_on_hit - ); -} \ No newline at end of file + skyline::install_hooks!(burst_check_status, burst_set_motion, burst_init, burst_on_hit); +} diff --git a/fighters/common/src/function_hooks/vtables/edge.rs b/fighters/common/src/function_hooks/vtables/edge.rs index 2658b9f1da..cc3c541018 100644 --- a/fighters/common/src/function_hooks/vtables/edge.rs +++ b/fighters/common/src/function_hooks/vtables/edge.rs @@ -16,5 +16,5 @@ pub fn install() { let _ = skyline::patching::Patch::in_text(0x5189860 + (*WEAPON_KIND_EDGE_FLASH as usize * 0x1d * 0x8)).data(text.add(0x33b8a80 / 0x8)); } - let _ = skyline::patching::Patch::in_text(0x51c0ff0).data(edge_flash_on_search as u64); -} \ No newline at end of file + let _ = skyline::patching::Patch::in_text(0x51c0ff0).data(edge_flash_on_search as *const () as u64); +} diff --git a/fighters/common/src/function_hooks/vtables/gekkouga.rs b/fighters/common/src/function_hooks/vtables/gekkouga.rs index ce667b9432..dd97cef7bc 100644 --- a/fighters/common/src/function_hooks/vtables/gekkouga.rs +++ b/fighters/common/src/function_hooks/vtables/gekkouga.rs @@ -46,11 +46,11 @@ unsafe extern "C" fn gekkouga_on_init(vtable: u64, fighter: &mut Fighter) { // } pub fn install() { - let _ = skyline::patching::Patch::in_text(0x4fbf2d8).data(gekkouga_on_init as u64); + let _ = skyline::patching::Patch::in_text(0x4fbf2d8).data(gekkouga_on_init as *const () as u64); // let _ = skyline::patching::Patch::in_text(0x4fbf438).data(gekkouga_on_search as u64); // skyline::install_hooks!( // gekkouga_frame // ); -} \ No newline at end of file +} diff --git a/fighters/common/src/function_hooks/vtables/ike.rs b/fighters/common/src/function_hooks/vtables/ike.rs index c482a2bd2c..ab87deadfe 100644 --- a/fighters/common/src/function_hooks/vtables/ike.rs +++ b/fighters/common/src/function_hooks/vtables/ike.rs @@ -24,7 +24,7 @@ pub unsafe extern "C" fn ike_on_attack(_vtable: u64, fighter: &mut Fighter, log: if kind == *FIGHTER_KIND_IKE { if status == *FIGHTER_IKE_STATUS_KIND_SPECIAL_S_ATTACK && VarModule::is_flag(battle_object, vars::ike::status::SPECIAL_S_INSTAKILL) { - let collision_log: &mut CollisionLog = std::mem::transmute(log); + let collision_log: &mut CollisionLog = std::mem::transmute(log as *mut u64); let kind = collision_log.collision_kind; if kind == *COLLISION_KIND_HIT as u8 { VarModule::on_flag(battle_object, vars::ike::status::SPECIAL_S_INSTAKILL_HIT); @@ -51,4 +51,4 @@ pub fn install() { skyline::install_hooks!( ike_on_attack, ); -} \ No newline at end of file +} diff --git a/fighters/common/src/function_hooks/vtables/littlemac.rs b/fighters/common/src/function_hooks/vtables/littlemac.rs index 0e4a45ad6b..22a710fdd7 100644 --- a/fighters/common/src/function_hooks/vtables/littlemac.rs +++ b/fighters/common/src/function_hooks/vtables/littlemac.rs @@ -55,7 +55,7 @@ pub unsafe extern "C" fn hook_ko_meter_gain(vtable: u64, battle_object: *mut Bat let team_color = FighterUtil::get_team_color(boma); let mut effect_team_color = FighterUtil::get_effect_team_color(EColorKind(team_color as i32), Hash40::new("direction_effect_color")); let effect = EffectModule::req_on_joint(opponent_boma, Hash40::new("sys_hit_dead"), Hash40::new("hip"), &Vector3f::new(0.0, 2.0, 0.0), &Vector3f::new(0.0, 0.0, 90.0), 0.6, &Vector3f::zero(), &Vector3f::zero(), true, 0, 0, 0); - EffectModule::set_rgb(boma, effect as u32, effect_team_color.value[0], effect_team_color.value[1], effect_team_color.value[2]); + EffectModule::set_rgb(boma, effect as u32, effect_team_color.x(), effect_team_color.y(), effect_team_color.z()); SoundModule::play_se_no3d(boma, Hash40::new("vc_littlemac_appeal05"), true, true); SoundModule::play_se_no3d(boma, Hash40::new("vc_littlemac_missfoot02"), true, true); meter_gain = 100.0; @@ -155,4 +155,4 @@ pub fn install() { let _ = skyline::patching::Patch::in_text(0xc46674).data(0x7100D41Fu32); // mov w3, #0x36 let _ = skyline::patching::Patch::in_text(0xc4668c).data(0x528006C3u32); -} \ No newline at end of file +} diff --git a/fighters/common/src/function_hooks/vtables/ryu_shinkuhadoken.rs b/fighters/common/src/function_hooks/vtables/ryu_shinkuhadoken.rs index 489ab66fa1..1ab1b03d83 100644 --- a/fighters/common/src/function_hooks/vtables/ryu_shinkuhadoken.rs +++ b/fighters/common/src/function_hooks/vtables/ryu_shinkuhadoken.rs @@ -9,5 +9,5 @@ unsafe extern "C" fn shinku_on_hit(vtable: u64, weapon: *mut app::Weapon, someth unsafe extern "C" fn normal_weapon_hit_handler(vtable: u64, weapon: *mut app::Weapon, something: u32) -> u64; pub fn install() { - let _ = skyline::patching::Patch::in_text(0x5214940).data(shinku_on_hit as u64); -} \ No newline at end of file + let _ = skyline::patching::Patch::in_text(0x5214940).data(shinku_on_hit as *const () as u64); +} diff --git a/fighters/common/src/general_statuses/mod.rs b/fighters/common/src/general_statuses/mod.rs index d1c5ef230b..854c390438 100644 --- a/fighters/common/src/general_statuses/mod.rs +++ b/fighters/common/src/general_statuses/mod.rs @@ -150,7 +150,7 @@ pub unsafe fn FL_get_LandingStiffness(fighter: &mut L2CFighterCommon) -> L2CValu let land_cancel_lag = VarModule::get_float(fighter.battle_object, vars::common::instance::LAND_CANCEL_LAG); if land_cancel_lag != 0.0 { VarModule::set_float(fighter.battle_object, vars::common::instance::LAND_CANCEL_LAG, 0.0); - + // "landing stiffness" logic does not support values greater than your landing_heavy animation length // so we must manually extend your landing animation // if our defined landing lag value > landing_heavy animation length @@ -164,7 +164,7 @@ pub unsafe fn FL_get_LandingStiffness(fighter: &mut L2CFighterCommon) -> L2CValu // Coupled with "landing_heavy" change in change_motion hook // Because we start heavy landing anims on f3 rather than f1, we need to increase this value by 2 frames so it is accurate to the defined landing lag value let landing_lag = land_cancel_lag + 2.0; - + return landing_lag.into(); } @@ -248,9 +248,9 @@ pub unsafe fn status_Landing_MainSub(fighter: &mut L2CFighterCommon) -> L2CValue Hash40::new("se_common_down_l_01"), Hash40::new("se_demon_down"), Hash40::new("se_dolly_down01"), - + ]; - + for x in down_sfx.iter() { if SoundModule::is_playing(fighter.module_accessor, *x) { SoundModule::stop_se(fighter.module_accessor, *x, 3); @@ -624,7 +624,7 @@ pub unsafe fn super_jump_punch_main_hook(fighter: &mut L2CFighterCommon) { if WorkModule::is_flag(fighter.module_accessor, *FIGHTER_STATUS_SUPER_JUMP_PUNCH_FLAG_MOVE_TRANS) { if fighter.global_table[PREV_SITUATION_KIND] == SITUATION_KIND_AIR && fighter.global_table[SITUATION_KIND] == SITUATION_KIND_GROUND - && MotionModule::trans_move_speed(fighter.module_accessor).value[1] < 0.0 + && MotionModule::trans_move_speed(fighter.module_accessor).y() < 0.0 { fighter.change_status(FIGHTER_STATUS_KIND_LANDING_FALL_SPECIAL.into(), false.into()); } @@ -657,7 +657,7 @@ pub unsafe fn super_jump_punch_uniq(fighter: &mut L2CFighterCommon, arg2: L2CVal if !WorkModule::is_flag(fighter.module_accessor, *FIGHTER_STATUS_SUPER_JUMP_PUNCH_FLAG_MOVE_TRANS) && KineticModule::get_kinetic_type(fighter.module_accessor) != *FIGHTER_KINETIC_TYPE_AIR_STOP { KineticModule::change_kinetic(fighter.module_accessor, *FIGHTER_KINETIC_TYPE_AIR_STOP); - + let speed_x_mul = WorkModule::get_float(fighter.module_accessor, *FIGHTER_STATUS_SUPER_JUMP_PUNCH_WORK_FLOAT_MOVE_TRANS_END_SPEED_X_MUL); let speed_y_mul = WorkModule::get_float(fighter.module_accessor, *FIGHTER_STATUS_SUPER_JUMP_PUNCH_WORK_FLOAT_MOVE_TRANS_END_SPEED_Y_MUL); @@ -855,9 +855,9 @@ unsafe extern "C" fn check_damage_speed_up_fail(fighter: &mut L2CFighterCommon) return true; } let log = log as *mut u8; - return *log.add(0x8f) != 0 + return *log.add(0x8f) != 0 || *log.add(0x92) != 0 - || *log.add(0x93) != 0 + || *log.add(0x93) != 0 || *log.add(0x98) != 0; } @@ -1048,7 +1048,7 @@ pub unsafe fn sub_is_dive(fighter: &mut L2CFighterCommon) -> L2CValue { fighter.clear_lua_stack(); lua_args!(fighter, FIGHTER_KINETIC_ENERGY_ID_GRAVITY, ENERGY_GRAVITY_RESET_TYPE_GRAVITY, 0.0, speed_y, 0.0, 0.0, 0.0); app::sv_kinetic_energy::reset_energy(fighter.lua_state_agent); - + fighter.clear_lua_stack(); lua_args!(fighter, FIGHTER_KINETIC_ENERGY_ID_GRAVITY); app::sv_kinetic_energy::enable(fighter.lua_state_agent); @@ -1075,7 +1075,7 @@ unsafe fn sub_calc_landing_motion_rate(_fighter: &mut L2CFighterCommon, end_fram pub unsafe fn sub_landing_cancel_damage_face(fighter: &mut L2CFighterCommon) -> L2CValue { VarModule::off_flag(fighter.battle_object, vars::common::instance::IS_CC_NON_TUMBLE); ControlModule::set_command_life_extend(fighter.module_accessor, 0); - + original!()(fighter) } @@ -1163,7 +1163,7 @@ pub unsafe fn sub_air_check_fall_common(fighter: &mut L2CFighterCommon) -> L2CVa WorkModule::unable_transition_term_group_ex(fighter.module_accessor, *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_TURN); WorkModule::unable_transition_term_group_ex(fighter.module_accessor, *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_TURN_DASH); WorkModule::unable_transition_term_group_ex(fighter.module_accessor, *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_SQUAT); - + fighter.global_table[SITUATION_KIND].assign(&L2CValue::I32(*SITUATION_KIND_GROUND)); if fighter.sub_squat_common_Main().get_bool() { let last_grounded_pos = VarModule::get_vec3(fighter.battle_object, vars::common::instance::LAST_GROUNDED_POS); @@ -1192,7 +1192,7 @@ pub unsafe fn sub_air_check_fall_common(fighter: &mut L2CFighterCommon) -> L2CVa } } } - + original!()(fighter) } @@ -1249,4 +1249,4 @@ pub fn install() { squat::install(); skyline::nro::add_hook(nro_hook); -} \ No newline at end of file +} diff --git a/fighters/common/src/general_statuses/shield/guard_damage/main.rs b/fighters/common/src/general_statuses/shield/guard_damage/main.rs index bb722e1ace..d2f894eab1 100644 --- a/fighters/common/src/general_statuses/shield/guard_damage/main.rs +++ b/fighters/common/src/general_statuses/shield/guard_damage/main.rs @@ -96,14 +96,14 @@ unsafe fn status_GuardDamage_common(fighter: &mut L2CFighterCommon, arg: L2CValu app::EColorKind(team_color as i32), Hash40::new("shield_effect_color") ); - let color = Vector3f {x: color.value[0], y: color.value[1], z: color.value[2]}; + let color = Vector3f {x: color.x(), y: color.y(), z: color.z()}; EffectModule::req_follow(fighter.module_accessor, Hash40::new("sys_shield_damage3"), Hash40::new("throw"), &ZERO_VEC, &ZERO_VEC, 0.1, false, *EFFECT_SUB_ATTRIBUTE_NONE as u32, 0, -1, *EFFECT_FLIP_NONE, 1, false, false); EffectModule::set_rgb_partial_last(fighter.module_accessor, color.x, color.y, color.z); - + let effect2_handle = EffectModule::req_follow(fighter.module_accessor, Hash40::new("sys_shield_damage2"), Hash40::new("throw"), &ZERO_VEC, &ZERO_VEC, 0.1, false, *EFFECT_SUB_ATTRIBUTE_NONE as u32, 0, -1, *EFFECT_FLIP_NONE, 1, false, false) as u32; EffectModule::set_rgb_partial_last(fighter.module_accessor, color.x, color.y, color.z); fighter.set_int(effect2_handle as i32, *FIGHTER_STATUS_GUARD_ON_WORK_INT_SHIELD_DAMAGE2_EFFECT_HANDLE); - + let effect_handle = EffectModule::req_follow(fighter.module_accessor, Hash40::new("sys_shield_damage"), Hash40::new("throw"), &ZERO_VEC, &ZERO_VEC, 1.0, false, *EFFECT_SUB_ATTRIBUTE_NONE as u32, 0, -1, *EFFECT_FLIP_NONE, 1, false, false) as u32; EffectModule::set_rgb_partial_last(fighter.module_accessor, color.x, color.y, color.z); fighter.set_int(effect_handle as i32, *FIGHTER_STATUS_GUARD_ON_WORK_INT_SHIELD_DAMAGE_EFFECT_HANDLE); @@ -173,13 +173,13 @@ unsafe fn status_guard_damage_main_common(fighter: &mut L2CFighterCommon) -> L2C } let special_stick_y = fighter.get_param_float("common", "special_stick_y"); let cat1 = fighter.global_table[CMD_CAT1].get_i32(); - if special_stick_y <= fighter.global_table[STICK_Y].get_f32() + if special_stick_y <= fighter.global_table[STICK_Y].get_f32() && (cat1 & *FIGHTER_PAD_CMD_CAT1_FLAG_SPECIAL_HI) != 0 { WorkModule::on_flag(fighter.module_accessor, *FIGHTER_STATUS_GUARD_ON_WORK_FLAG_SPECIAL_HI); } if fighter.is_flag(*FIGHTER_STATUS_GUARD_ON_WORK_FLAG_JUST_SHIELD) { - + // parry, force instant transition even during hitstop for chained parries if fighter.is_button_trigger(Buttons::Parry) && fighter.is_cat_flag(CatHdr::Parry) { @@ -195,7 +195,7 @@ unsafe fn status_guard_damage_main_common(fighter: &mut L2CFighterCommon) -> L2C return true.into(); } // end animation, wait transition - if MotionModule::is_end(fighter.module_accessor) + if MotionModule::is_end(fighter.module_accessor) && fighter.global_table[SITUATION_KIND] == SITUATION_KIND_GROUND { fighter.change_status(FIGHTER_STATUS_KIND_WAIT.into(), false.into()); return false.into(); diff --git a/fighters/common/src/lib.rs b/fighters/common/src/lib.rs index f374028193..98f0f07e3f 100644 --- a/fighters/common/src/lib.rs +++ b/fighters/common/src/lib.rs @@ -3,8 +3,10 @@ #![allow(non_snake_case)] #![allow(improper_ctypes)] #![allow(static_mut_refs)] +#![allow(internal_features)] #![feature(repr_simd)] #![feature(simd_ffi)] +#![feature(core_intrinsics)] use smash::app::lua_bind::*; use smash::lua2cpp::*; use smash::lib::{*, lua_const::*}; @@ -52,4 +54,4 @@ pub fn install() { Agent::new("fighter") .on_start(common_init) .install(); -} \ No newline at end of file +} diff --git a/fighters/duckhunt/src/acmd/specials/special_hi.rs b/fighters/duckhunt/src/acmd/specials/special_hi.rs index f6c9e3b57b..8d2f17dbf2 100644 --- a/fighters/duckhunt/src/acmd/specials/special_hi.rs +++ b/fighters/duckhunt/src/acmd/specials/special_hi.rs @@ -28,7 +28,7 @@ unsafe extern "C" fn effect_specialhi(agent: &mut L2CAgentBase) { //EFFECT(agent, Hash40::new("duckhunt_target"), Hash40::new("top"), 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, false); let eff_handle = EffectModule::req_on_joint(boma, Hash40::new("duckhunt_target"), Hash40::new("top"), &Vector3f::new(0.0, 3.0, 0.0), &Vector3f::zero(), 1.0, &Vector3f::zero(), &Vector3f::zero(), false, 0, 0, 0); VarModule::set_int64(agent.battle_object, vars::duckhunt::status::SPECIAL_HI_RETICLE_EFFECT_HANDLE, eff_handle as u64); - LAST_EFFECT_SET_COLOR(agent, effect_team_color.value[0], effect_team_color.value[1], effect_team_color.value[2]); + LAST_EFFECT_SET_COLOR(agent, effect_team_color.x(), effect_team_color.y(), effect_team_color.z()); EFFECT_FOLLOW(agent, Hash40::new("duckhunt_feather"), Hash40::new("duckneck"), -4, 0, 0, 0, 0, -90, 1, true); } frame(lua_state, 8.0); @@ -106,7 +106,7 @@ unsafe extern "C" fn effect_specialhi2(agent: &mut L2CAgentBase) { //EFFECT(agent, Hash40::new("duckhunt_target"), Hash40::new("top"), 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, false); let eff_handle = EffectModule::req_on_joint(boma, Hash40::new("duckhunt_target"), Hash40::new("top"), &Vector3f::new(0.0, 3.0, 0.0), &Vector3f::zero(), 1.0, &Vector3f::zero(), &Vector3f::zero(), false, 0, 0, 0); VarModule::set_int64(agent.battle_object, vars::duckhunt::status::SPECIAL_HI_RETICLE_EFFECT_HANDLE, eff_handle as u64); - LAST_EFFECT_SET_COLOR(agent, effect_team_color.value[0], effect_team_color.value[1], effect_team_color.value[2]); + LAST_EFFECT_SET_COLOR(agent, effect_team_color.x(), effect_team_color.y(), effect_team_color.z()); EFFECT_FOLLOW(agent, Hash40::new("duckhunt_feather"), Hash40::new("duckneck"), -4, 0, 0, 0, 0, -90, 1, true); } frame(lua_state, 8.0); @@ -177,7 +177,7 @@ unsafe extern "C" fn effect_specialhi3(agent: &mut L2CAgentBase) { //EFFECT(agent, Hash40::new("duckhunt_target"), Hash40::new("top"), -3, 7, 0, 0, 0, 0, 1.2, 0, 0, 0, 0, 0, 0, false); let eff_handle = EffectModule::req_on_joint(boma, Hash40::new("duckhunt_target"), Hash40::new("top"), &Vector3f::new(-3.0, 7.0, 0.0), &Vector3f::zero(), 1.2, &Vector3f::zero(), &Vector3f::zero(), false, 0, 0, 0); VarModule::set_int64(agent.battle_object, vars::duckhunt::status::SPECIAL_HI_RETICLE_EFFECT_HANDLE, eff_handle as u64); - LAST_EFFECT_SET_COLOR(agent, effect_team_color.value[0], effect_team_color.value[1], effect_team_color.value[2]); + LAST_EFFECT_SET_COLOR(agent, effect_team_color.x(), effect_team_color.y(), effect_team_color.z()); EFFECT_FOLLOW(agent, Hash40::new("duckhunt_feather_long"), Hash40::new("duckneck"), -4, 0, 0, 0, 0, -90, 1, true); } frame(lua_state, 6.0); @@ -235,4 +235,4 @@ pub fn install(agent: &mut Agent) { agent.acmd("effect_specialhi3", effect_specialhi3, Priority::Low); agent.acmd("sound_specialhi3", sound_specialhi3, Priority::Low); agent.acmd("expression_specialhi3", expression_specialhi3, Priority::Low); -} \ No newline at end of file +} diff --git a/fighters/edge/src/flash/acmd.rs b/fighters/edge/src/flash/acmd.rs index eb898f2c5e..3a3ece401c 100644 --- a/fighters/edge/src/flash/acmd.rs +++ b/fighters/edge/src/flash/acmd.rs @@ -16,7 +16,7 @@ unsafe extern "C" fn effect_wait(agent: &mut L2CAgentBase) { let team_color = FighterUtil::get_team_color(owner_boma); let mut effect_team_color = FighterUtil::get_effect_team_color(EColorKind(team_color as i32), Hash40::new("direction_effect_color")); EffectModule::req_follow(boma, Hash40::new("sys_direction"), Hash40::new("top"), &Vector3f::new(0.0, 16.0, 0.0), &Vector3f::new(0.0, 90.0, 180.0), 0.67, true, 0, 0, 0, 0, 0, false, false); - EffectModule::set_rgb_partial_last(boma, effect_team_color.value[0], effect_team_color.value[1], effect_team_color.value[2]); + EffectModule::set_rgb_partial_last(boma, effect_team_color.x(), effect_team_color.y(), effect_team_color.z()); let flash_handle = EffectModule::req_follow(boma, Hash40::new("edge_senkou_shield"), Hash40::new("top"), &Vector3f::new(0.0, 2.0, 0.0), &Vector3f::new(0.0, 0.0, 0.0), 0.7, false, 0, 0, 0, 0, 0, false, false); EffectModule::set_scale_last(boma, &Vector3f::new(0.7, 0.7, 0.4)); VarModule::set_int64(agent.battle_object, vars::edge_flash::status::EFFECT_HANDLE, flash_handle); @@ -113,4 +113,4 @@ pub fn install(agent: &mut Agent) { agent.acmd("game_vanish", acmd_stub, Priority::Low); agent.acmd("effect_vanish", acmd_stub, Priority::Low); agent.acmd("sound_vanish", acmd_stub, Priority::Low); -} \ No newline at end of file +} diff --git a/fighters/gekkouga/src/opff.rs b/fighters/gekkouga/src/opff.rs index d9f6735732..c0ba67f656 100644 --- a/fighters/gekkouga/src/opff.rs +++ b/fighters/gekkouga/src/opff.rs @@ -62,7 +62,7 @@ unsafe fn fastfall_specials(fighter: &mut L2CFighterCommon) { *FIGHTER_GEKKOUGA_STATUS_KIND_SPECIAL_LW_ATTACK, *FIGHTER_GEKKOUGA_STATUS_KIND_SPECIAL_LW_HIT, *FIGHTER_GEKKOUGA_STATUS_KIND_SPECIAL_LW_BOUND - ]) + ]) && fighter.is_situation(*SITUATION_KIND_AIR) { fighter.sub_air_check_dive(); } @@ -123,17 +123,20 @@ pub unsafe fn substitute_teleport_check(fighter: &mut L2CFighterCommon) { EffectModule::set_pos(fighter.module_accessor, eff_handle, &Vector3f{x: guide_pos.x, y: guide_pos.y, z: 0.0}); } EffectModule::set_rot(fighter.module_accessor, eff_handle, &Vector3f{x: 0.0, y: 0.0, z: angle - 90.0}); - + if can_teleport { let team_color = FighterUtil::get_team_color(fighter.module_accessor); - let mut effect_team_color = FighterUtil::get_effect_team_color(EColorKind(team_color as i32), Hash40::new("direction_effect_color")); + let effect_team_color = FighterUtil::get_effect_team_color(EColorKind(team_color as i32), Hash40::new("direction_effect_color")); + let mut r = effect_team_color.x(); + let mut g = effect_team_color.y(); + let mut b = effect_team_color.z(); if !WorkModule::is_enable_transition_term(fighter.module_accessor, *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_SPECIAL_LW) || WorkModule::is_flag(fighter.module_accessor, *FIGHTER_GEKKOUGA_INSTANCE_WORK_ID_FLAG_SPECIAL_LW_SAVE_SPEED) { - effect_team_color.value[0] += 0.22; - effect_team_color.value[1] += 0.22; - effect_team_color.value[2] += 0.22; + r += 0.22; + g += 0.22; + b += 0.22; } - EffectModule::set_rgb(fighter.module_accessor, eff_handle, effect_team_color.value[0], effect_team_color.value[1], effect_team_color.value[2]); + EffectModule::set_rgb(fighter.module_accessor, eff_handle, r, g, b); } else { EffectModule::set_rgb(fighter.module_accessor, eff_handle, 0.7, 0.7, 0.7); diff --git a/fighters/lucario/src/status/special_hi.rs b/fighters/lucario/src/status/special_hi.rs index aab3d08c59..8943c467f1 100644 --- a/fighters/lucario/src/status/special_hi.rs +++ b/fighters/lucario/src/status/special_hi.rs @@ -112,7 +112,7 @@ unsafe extern "C" fn special_hi_guide_handler(fighter: &mut L2CFighterCommon, sc let team_color = FighterUtil::get_team_color(fighter.module_accessor); let effect_team_color = FighterUtil::get_effect_team_color(EColorKind(team_color as i32), Hash40::new("direction_effect_color")); - EffectModule::set_rgb(fighter.module_accessor, eff_handle, effect_team_color.value[0], effect_team_color.value[1], effect_team_color.value[2]); + EffectModule::set_rgb(fighter.module_accessor, eff_handle, effect_team_color.x(), effect_team_color.y(), effect_team_color.z()); } // FIGHTER_LUCARIO_STATUS_KIND_SPECIAL_HI_BOUND @@ -178,11 +178,11 @@ unsafe extern "C" fn special_hi_rush_main_loop(fighter: &mut L2CFighterCommon) - fighter.ground_correct_by_situation(*GROUND_CORRECT_KIND_GROUND, *GROUND_CORRECT_KIND_AIR); } // metered attack cancel - if !CancelModule::is_enable_cancel(fighter.module_accessor) - && !fighter.is_in_hitlag() + if !CancelModule::is_enable_cancel(fighter.module_accessor) + && !fighter.is_in_hitlag() && !VarModule::is_flag(fighter.object(), vars::lucario::instance::METER_BURNOUT) && VarModule::is_flag(fighter.battle_object, vars::lucario::status::HIT_CANCEL) - && fighter.is_situation(*SITUATION_KIND_AIR) + && fighter.is_situation(*SITUATION_KIND_AIR) && fighter.get_aerial() != None { fighter.on_flag(*FIGHTER_LUCARIO_MACH_STATUS_WORK_ID_FLAG_STATUS_TRANS); fighter.set_int(*FIGHTER_LUCARIO_STATUS_KIND_SPECIAL_HI_RUSH_END, *FIGHTER_LUCARIO_MACH_STATUS_WORK_ID_INT_NEXT_STATUS); @@ -312,11 +312,11 @@ unsafe extern "C" fn special_hi_rush_end_main_loop(fighter: &mut L2CFighterCommo if !StatusModule::is_changing(fighter.module_accessor) { // metered attack cancel if VarModule::is_flag(fighter.object(), vars::lucario::instance::SPECIAL_HI_ATTACK_CANCEL) || ( - !CancelModule::is_enable_cancel(fighter.module_accessor) - && !fighter.is_in_hitlag() + !CancelModule::is_enable_cancel(fighter.module_accessor) + && !fighter.is_in_hitlag() && !VarModule::is_flag(fighter.object(), vars::lucario::instance::METER_BURNOUT) && VarModule::is_flag(fighter.battle_object, vars::lucario::status::HIT_CANCEL) - && fighter.is_situation(*SITUATION_KIND_AIR) + && fighter.is_situation(*SITUATION_KIND_AIR) && fighter.get_aerial() != None ) { fighter.change_status(FIGHTER_STATUS_KIND_ATTACK_AIR.into(), false.into()); @@ -502,4 +502,4 @@ pub fn install(agent: &mut Agent) { agent.status(Init, *FIGHTER_LUCARIO_STATUS_KIND_SPECIAL_HI_RUSH_END, special_hi_rush_end_init); agent.status(Main, *FIGHTER_LUCARIO_STATUS_KIND_SPECIAL_HI_RUSH_END, special_hi_rush_end_main); agent.status(End, *FIGHTER_LUCARIO_STATUS_KIND_SPECIAL_HI_RUSH_END, special_hi_rush_end_end); -} \ No newline at end of file +} diff --git a/fighters/robot/src/status/special_hi.rs b/fighters/robot/src/status/special_hi.rs index a226a0f52d..fea3d665dc 100644 --- a/fighters/robot/src/status/special_hi.rs +++ b/fighters/robot/src/status/special_hi.rs @@ -7,17 +7,17 @@ use vars::robot::{ // FIGHTER_STATUS_KIND_SPECIAL_HI -unsafe extern "C" fn special_hi_pre(fighter: &mut L2CFighterCommon) -> L2CValue { +unsafe extern "C" fn special_hi_pre(fighter: &mut L2CFighterCommon) -> L2CValue { StatusModule::init_settings( fighter.module_accessor, SituationKind(*SITUATION_KIND_NONE), *FIGHTER_KINETIC_TYPE_UNIQ, *GROUND_CORRECT_KIND_KEEP as u32, GroundCliffCheckKind(*GROUND_CLIFF_CHECK_KIND_NONE), - true, + true, *FIGHTER_STATUS_WORK_KEEP_FLAG_NONE_FLAG, *FIGHTER_STATUS_WORK_KEEP_FLAG_NONE_INT, - *FIGHTER_STATUS_WORK_KEEP_FLAG_NONE_FLOAT, + *FIGHTER_STATUS_WORK_KEEP_FLAG_NONE_FLOAT, 0 ); FighterStatusModuleImpl::set_fighter_status_data( @@ -99,7 +99,7 @@ unsafe extern "C" fn special_hi_main_loop(fighter: &mut L2CFighterCommon) -> L2C sv_kinetic_energy!(set_accel, fighter, FIGHTER_KINETIC_ENERGY_ID_GRAVITY, -start_accel_y); } } - + // defines fuel consumption throughout the move let start_fuel = fighter.get_float(*FIGHTER_ROBOT_INSTANCE_WORK_ID_FLOAT_BURNER_ENERGY_VALUE); let max_fuel = fighter.get_param_float("param_special_hi", "energy_max_frame"); @@ -111,7 +111,7 @@ unsafe extern "C" fn special_hi_main_loop(fighter: &mut L2CFighterCommon) -> L2C // handles rob's rotation during the charge let rot_x = VarModule::get_float(fighter.battle_object, SPECIAL_HI_ROT_X); let rot_amount = if fighter.is_situation(*SITUATION_KIND_AIR) { 2.5 } else {3.75}; // how much rob rotates each frame - if fighter.left_stick_x().abs() > 0.1 { + if fighter.left_stick_x().abs() > 0.1 { let reverse = if fighter.is_stick_backward() { -1.0 } else { 1.0 }; let direction = fighter.lr() * reverse; // determines the direction to rotate let angle = (rot_x + (rot_amount * direction)).clamp(-60.0, 60.0); @@ -140,7 +140,7 @@ unsafe extern "C" fn special_hi_main_loop(fighter: &mut L2CFighterCommon) -> L2C if fighter.is_situation(*SITUATION_KIND_GROUND) && charge_frame > 28.0 { sv_kinetic_energy!(set_accel, fighter, FIGHTER_KINETIC_ENERGY_ID_GRAVITY, 0.0); KineticModule::change_kinetic(fighter.module_accessor, *FIGHTER_KINETIC_TYPE_FALL); - + KineticModule::resume_energy_all(fighter.module_accessor); KineticModule::enable_energy(fighter.module_accessor, *FIGHTER_KINETIC_ENERGY_ID_MOTION); @@ -162,7 +162,7 @@ unsafe extern "C" fn special_hi_main_loop(fighter: &mut L2CFighterCommon) -> L2C if MotionModule::is_end(fighter.module_accessor) { sv_kinetic_energy!(set_accel, fighter, FIGHTER_KINETIC_ENERGY_ID_GRAVITY, 0.0); KineticModule::change_kinetic(fighter.module_accessor, *FIGHTER_KINETIC_TYPE_FALL); - + KineticModule::resume_energy_all(fighter.module_accessor); KineticModule::enable_energy(fighter.module_accessor, *FIGHTER_KINETIC_ENERGY_ID_MOTION); @@ -216,7 +216,7 @@ unsafe extern "C" fn special_hi_main_loop(fighter: &mut L2CFighterCommon) -> L2C // launches/exits if rob ran out of fuel if fuel_depleted { - if start_fuel > 0.0 { + if start_fuel > 0.0 { // println!("launch speed: {}", launch_speed.y); KineticModule::add_speed(fighter.module_accessor, &launch_speed); } @@ -227,7 +227,7 @@ unsafe extern "C" fn special_hi_main_loop(fighter: &mut L2CFighterCommon) -> L2C fighter.change_status(FIGHTER_ROBOT_STATUS_KIND_SPECIAL_HI_KEEP.into(), true.into()); return 1.into(); - } + } // otherwise, launch with the amount of consumed fuel at the time of releasing the button if charge_frame >= 10.0 { // 10 frame minimum before launching @@ -235,16 +235,16 @@ unsafe extern "C" fn special_hi_main_loop(fighter: &mut L2CFighterCommon) -> L2C KineticModule::add_speed(fighter.module_accessor, &launch_speed); fighter.set_float(remaining_fuel, *FIGHTER_ROBOT_INSTANCE_WORK_ID_FLOAT_BURNER_ENERGY_VALUE); PLAY_SE(fighter, Hash40::new(sfx)); - + //println!("{}", launch_speed.x); fighter.change_status(FIGHTER_ROBOT_STATUS_KIND_SPECIAL_HI_KEEP.into(), true.into()); - + return 1.into(); } return 0.into(); } - + unsafe extern "C" fn special_hi_end(fighter: &mut L2CFighterCommon) -> L2CValue { fighter.off_flag(*FIGHTER_ROBOT_STATUS_BURNER_FLAG_TRANSFORM_COMP); @@ -303,7 +303,7 @@ pub unsafe fn special_hi_guide_handler(fighter: &mut L2CFighterCommon) { // than let team_color = FighterUtil::get_team_color(fighter.module_accessor); let effect_team_color = FighterUtil::get_effect_team_color(EColorKind(team_color as i32), Hash40::new("direction_effect_color")); - EffectModule::set_rgb(fighter.module_accessor, eff_handle, effect_team_color.value[0], effect_team_color.value[1], effect_team_color.value[2]); + EffectModule::set_rgb(fighter.module_accessor, eff_handle, effect_team_color.x(), effect_team_color.y(), effect_team_color.z()); } // FIGHTER_ROBOT_STATUS_KIND_SPECIAL_HI_KEEP @@ -381,4 +381,4 @@ pub fn install(agent: &mut Agent) { agent.status(Exec, *FIGHTER_STATUS_KIND_SPECIAL_HI, stub_status); agent.status(Init, *FIGHTER_ROBOT_STATUS_KIND_SPECIAL_HI_KEEP, stub_status); agent.status(Exec, *FIGHTER_ROBOT_STATUS_KIND_SPECIAL_HI_KEEP, stub_status); -} \ No newline at end of file +} diff --git a/fighters/trail/src/status/special_s.rs b/fighters/trail/src/status/special_s.rs index 673371b592..fc86eeabb3 100644 --- a/fighters/trail/src/status/special_s.rs +++ b/fighters/trail/src/status/special_s.rs @@ -5,7 +5,7 @@ use super::*; unsafe extern "C" fn special_s_pre(fighter: &mut L2CFighterCommon) -> L2CValue { StatusModule::init_settings( - fighter.module_accessor, + fighter.module_accessor, app::SituationKind(*SITUATION_KIND_NONE), *FIGHTER_KINETIC_TYPE_UNIQ, *GROUND_CORRECT_KIND_KEEP as u32, @@ -29,7 +29,7 @@ unsafe extern "C" fn special_s_pre(fighter: &mut L2CFighterCommon) -> L2CValue { *FIGHTER_POWER_UP_ATTACK_BIT_SPECIAL_S as u32, 0 ); - + 0.into() } @@ -112,7 +112,7 @@ unsafe extern "C" fn trail_special_s_set_angle_guide(fighter: &mut L2CFighterCom EffectModule::set_rot(fighter.module_accessor, effect, &Vector3f{x: 0.0, y: 0.0, z: angle - 90.0}); let team_color = FighterUtil::get_team_color(fighter.module_accessor); let effect_team_color = FighterUtil::get_effect_team_color(EColorKind(team_color as i32), Hash40::new("direction_effect_color")); - EffectModule::set_rgb_partial_last(fighter.module_accessor, effect_team_color.value[0], effect_team_color.value[1], effect_team_color.value[2]); + EffectModule::set_rgb_partial_last(fighter.module_accessor, effect_team_color.x(), effect_team_color.y(), effect_team_color.z()); WorkModule::set_int(fighter.module_accessor, effect as i32, *FIGHTER_TRAIL_STATUS_SPECIAL_S_INT_SEARCH_GUIDE_EFFECT_HANDLE); } } diff --git a/fighters/zelda/src/dein/status.rs b/fighters/zelda/src/dein/status.rs index 07edcf4507..612f9d3e5e 100644 --- a/fighters/zelda/src/dein/status.rs +++ b/fighters/zelda/src/dein/status.rs @@ -19,7 +19,7 @@ unsafe extern "C" fn move_loop(weapon: &mut L2CWeaponCommon) -> L2CValue { || (zelda_boma.is_button_trigger(Buttons::Attack) && !zelda_boma.is_button_trigger(Buttons::CStickOn)) { weapon.change_status(WEAPON_ZELDA_DEIN_STATUS_KIND_TAME.into(), false.into()) - } + } //hold to keep dins out w/o moving if GroundModule::is_touch(weapon.module_accessor, *GROUND_TOUCH_FLAG_ALL as u32) || weapon.get_float(*WEAPON_ZELDA_DEIN_STATUS_WORK_FLOAT_LIFE) < 0.0 { @@ -61,7 +61,7 @@ pub unsafe extern "C" fn dein_remove(weapon: &mut smash::lua2cpp::L2CFighterBase let dein2_boma = &mut *(*dein2_battle_object).module_accessor; //Dins existence checks, applicable refreshes and variable settings if sv_battle_object::is_active(dein as u32) && dein != 0 { - if sv_battle_object::is_active(dein2 as u32) && dein2 != 0{ + if sv_battle_object::is_active(dein2 as u32) && dein2 != 0{ //if both dins slots are full, shuffle slots and kill first dins VarModule::set_int(zelda, vars::zelda::instance::SPECIAL_S_DEIN_OBJECT_ID, dein2); VarModule::set_int(zelda, vars::zelda::instance::SPECIAL_S_DEIN_OBJECT_ID_2, thisdins); @@ -99,7 +99,7 @@ pub unsafe extern "C" fn dein_remove(weapon: &mut smash::lua2cpp::L2CFighterBase LAST_EFFECT_SET_SCALE_W(weapon, 0.67, 0.4, 0.67); let team_color = FighterUtil::get_team_color(zelda_boma); let effect_team_color = FighterUtil::get_effect_team_color(EColorKind(team_color as i32), Hash40::new("direction_effect_color")); - EffectModule::set_rgb_partial_last(weapon.module_accessor, effect_team_color.value[0], effect_team_color.value[1], effect_team_color.value[2]); + EffectModule::set_rgb_partial_last(weapon.module_accessor, effect_team_color.x(), effect_team_color.y(), effect_team_color.z()); } unsafe extern "C" fn dins_detonate(weapon: &mut L2CWeaponCommon) -> L2CValue { @@ -156,7 +156,7 @@ pub unsafe extern "C" fn detonate_conditions(weapon: &mut smash::lua2cpp::L2CFig let dein2_pos = *PostureModule::pos(dein2_boma); //calc distance let diff_dein1: &Vector2f = &Vector2f::new( dein2_pos.x - dein1_pos.x, dein2_pos.y - dein1_pos.y); - //dins size, hold frames + //dins size, hold frames let hold_frame_max = zelda_boma.get_param_float("param_dein", "count"); let hold_frame = dein1_boma.get_float(*WEAPON_ZELDA_DEIN_STATUS_WORK_FLOAT_COUNT); let base_detonate_range = ParamModule::get_float(zelda, ParamType::Agent, "param_special_s.base_detonate_range"); @@ -165,7 +165,7 @@ pub unsafe extern "C" fn detonate_conditions(weapon: &mut smash::lua2cpp::L2CFig //explode timer && current frame let mine_timer = zelda_boma.get_param_float("param_dein", "bang_time"); let frame = dein1_boma.get_float(*WEAPON_ZELDA_DEIN_STATUS_WORK_FLOAT_LIFE); //frames till explosion - if diff_dein1.x.abs() <= pop_distance + if diff_dein1.x.abs() <= pop_distance && diff_dein1.y.abs() <= pop_distance && frame > (mine_timer - 146.0) { //if conditions satisfied for detonate diff --git a/fighters/zelda/src/phantom/acmd.rs b/fighters/zelda/src/phantom/acmd.rs index 92457685f2..ddca397007 100644 --- a/fighters/zelda/src/phantom/acmd.rs +++ b/fighters/zelda/src/phantom/acmd.rs @@ -86,7 +86,7 @@ unsafe extern "C" fn game_build(agent: &mut L2CAgentBase) { } else { boma.change_status_req(*WEAPON_ZELDA_PHANTOM_STATUS_KIND_ATTACK, true); } - } + } } unsafe extern "C" fn effect_build(agent: &mut L2CAgentBase) { @@ -109,7 +109,7 @@ unsafe extern "C" fn effect_build(agent: &mut L2CAgentBase) { LAST_EFFECT_SET_SCALE_W(agent, 0.75, 0.45, 0.75); let team_color = FighterUtil::get_team_color(zelda_boma); let effect_team_color = FighterUtil::get_effect_team_color(EColorKind(team_color as i32), Hash40::new("direction_effect_color")); - EffectModule::set_rgb_partial_last(boma, effect_team_color.value[0], effect_team_color.value[1], effect_team_color.value[2]); + EffectModule::set_rgb_partial_last(boma, effect_team_color.x(), effect_team_color.y(), effect_team_color.z()); } frame(lua_state, 5.0); if is_excute(agent) { @@ -331,7 +331,7 @@ unsafe extern "C" fn effect_attacks(agent: &mut L2CAgentBase) { EFFECT_FOLLOW(agent, Hash40::new("zelda_phantom_line"), Hash40::new("top"), -5, 10, -5, 0, 0, 0, 1, true); } else{ - EFFECT_FOLLOW(agent, Hash40::new("zelda_phantom_line"), Hash40::new("top"), 5, 10, -5, 0, 0, 0, 1, true); + EFFECT_FOLLOW(agent, Hash40::new("zelda_phantom_line"), Hash40::new("top"), 5, 10, -5, 0, 0, 0, 1, true); } AFTER_IMAGE4_ON_arg29(agent, Hash40::new("tex_zelda_phantomsword_flame"), Hash40::new("tex_zelda_phantomsword2"), 6, Hash40::new("handr"), 1.5, 0.4, -1.0, Hash40::new("handr"), 1.5, 0.4, 24.4, true, Hash40::new("zelda_phantom_sword_fire"), Hash40::new("handr"), 1.85, 0.35, 0.0, 0.0, 0.0, 0.0, 1.0, 0, *EFFECT_AXIS_X, 0, *TRAIL_BLEND_ALPHA, 101, *TRAIL_CULL_NONE, 1.5, 0.5); @@ -529,7 +529,7 @@ unsafe extern "C" fn game_attackmax(agent: &mut L2CAgentBase) { agent.clear_lua_stack(); lua_args!(agent, WEAPON_ZELDA_PHANTOM_KINETIC_ENERGY_ID_NORMAL, rush_speed * PostureModule::lr(boma)); app::sv_kinetic_energy::set_speed(lua_state); - agent.clear_lua_stack(); + agent.clear_lua_stack(); } frame(lua_state, 11.0); if is_excute(agent) { @@ -575,7 +575,7 @@ unsafe extern "C" fn effect_attackmax(agent: &mut L2CAgentBase) { else{ EFFECT_FOLLOW(agent, Hash40::new("zelda_phantom_line"), Hash40::new("top"), 5, 10, -7, 0, 0, 0, 1, true); } - + EFFECT_FOLLOW(agent, Hash40::new("zelda_atk_hi_flash"), Hash40::new("handr"), 0, 0, 16.0, 0, 0, 0, 2.0, true); } frame(lua_state, 4.0); diff --git a/src/lib.rs b/src/lib.rs index 265e4fa20b..7026b2afd5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -160,7 +160,7 @@ unsafe fn training_reset_music1(ctx: &skyline::hooks::InlineCtx) { #[skyline::hook(offset = 0x235cad0, inline)] unsafe fn main_menu_quick(ctx: &skyline::hooks::InlineCtx) { - let sp = (ctx as *const skyline::hooks::InlineCtx as *mut u8).add(0x300); + let sp = ctx.sp.x() as *mut u8; *(sp.add(0x60) as *mut u64) = 0x1100000000; let mut slice = std::slice::from_raw_parts_mut(sp.add(0x68), 18); slice.copy_from_slice(b"MenuSequenceScene\0");