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

Filter by extension

Filter by extension

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

pub const DISABLE_ESCAPE_AIR_EFFECT_HANDLE: i32 = 0x0017;

// link arrow fuse
pub const FUSE_TEAM_NO: i32 = 0x0018;
pub const FUSE_STORED_ITEM_KIND: i32 = 0x0019;
pub const FUSE_STORED_TARGET_ID: i32 = 0x001A;


// floats

Expand Down Expand Up @@ -1014,6 +1019,21 @@ pub mod vars {
}
}

pub mod link_bowarrow {
pub mod instance {
// flags
pub const IS_ARROW_FUSE: i32 = 0x0100;
pub const IS_REFLECT_FIX: i32 = 0x0101;

// ints
pub const FUSED_ITEM_KIND: i32 = 0x0100;
pub const FUSED_ITEM_TYPE: i32 = 0x0101;
pub const FUSED_ITEM_POST_STATUS: i32 = 0x0102;
pub const FUSED_ITEM_ID: i32 = 0x0103;
pub const FUSED_ITEM_OWNER_ID: i32 = 0x0104;
}
}

pub mod littlemac {
pub mod instance {
// flags
Expand Down Expand Up @@ -2211,6 +2231,10 @@ pub mod statuses {
pub const SPECIAL_N_FIRE_HI: i32 = 0x1FA;
}

pub mod link {
pub const SPECIAL_LW_THROW: i32 = 0x1E8;
}

pub mod littlemac {
pub const SPECIAL_LW_CANCEL: i32 = 0x1F4;
pub const SPECIAL_LW_CANCEL_JUMP: i32 = 0x1F5;
Expand Down
2 changes: 1 addition & 1 deletion fighters/common/src/function_hooks/controls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ static mut GC_TRIGGERS: [f32; 2] = [0.0, 0.0];
#[skyline::hook(offset = 0x366745c, inline)]
unsafe fn post_gamecube_process(ctx: &skyline::hooks::InlineCtx) {
let state: *mut skyline::nn::hid::NpadGcState =
(ctx as *const _ as *mut u8).add(0x300) as *mut _;
(ctx.sp.x() as *const u8) as *mut _;
let controller: *mut Controller = ctx.registers[19].x() as _;

GC_TRIGGERS[0] = (*state).LTrigger as f32 / i16::MAX as f32;
Expand Down
26 changes: 25 additions & 1 deletion fighters/common/src/function_hooks/vtables/krool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,31 @@ pub unsafe extern "C" fn hook_on_damage(vtable: u64, battle_object: *mut Fighter

let ret = call_original!(vtable, battle_object, log);

if opponent_boma.is_item() && opponent_boma.kind() == *ITEM_KIND_KROOLCROWN
// a crown fused to one of link's arrows, whether the crown or the arrow made contact
let fuse_arrow_id = if opponent_boma.is_item() && LinkModule::is_link(opponent_boma, *ITEM_LINK_NO_HAVE) {
LinkModule::get_parent_id(opponent_boma, *ITEM_LINK_NO_HAVE, true) as u32
}
else {
opponent_id
};
let mut fuse_arrow = std::ptr::null_mut();
if sv_battle_object::is_active(fuse_arrow_id) {
let arrow_boma = &mut *sv_battle_object::module_accessor(fuse_arrow_id);
if arrow_boma.is_weapon() && arrow_boma.kind() == *WEAPON_KIND_LINK_BOWARROW {
fuse_arrow = get_battle_object_from_id(fuse_arrow_id);
}
}
let is_crown_fuse_arrow = !fuse_arrow.is_null()
&& VarModule::is_flag(fuse_arrow, vars::link_bowarrow::instance::IS_ARROW_FUSE)
&& VarModule::get_int(fuse_arrow, vars::link_bowarrow::instance::FUSED_ITEM_KIND) == *ITEM_KIND_KROOLCROWN;

if is_crown_fuse_arrow
&& boma.is_flag(*FIGHTER_KROOL_INSTANCE_WORK_ID_FLAG_DROP_CROWN) {
crate::opff::fuse::fuse_remove_item(fuse_arrow);
EffectModule::req_follow(boma, Hash40::new("sys_item_get"), Hash40::new("crown1"), &Vector3f::zero(), &Vector3f::zero(), 1.0, false, 0, 0, 0, 0, 0, false, false);
boma.off_flag(*FIGHTER_KROOL_INSTANCE_WORK_ID_FLAG_DROP_CROWN);
}
else if opponent_boma.is_item() && opponent_boma.kind() == *ITEM_KIND_KROOLCROWN
&& boma.is_flag(*FIGHTER_KROOL_INSTANCE_WORK_ID_FLAG_DROP_CROWN) {
StatusModule::change_status_request(opponent_boma, *ITEM_STATUS_KIND_DEAD, false);
EffectModule::req_follow(boma, Hash40::new("sys_item_get"), Hash40::new("crown1"), &Vector3f::zero(), &Vector3f::zero(), 1.0, false, 0, 0, 0, 0, 0, false, false);
Expand Down
2 changes: 1 addition & 1 deletion fighters/common/src/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use globals::*;
#[skyline::hook(offset = 0xf13ddc, inline)]
unsafe fn steve_parry_stuff_fix(ctx: &mut skyline::hooks::InlineCtx) {
if ctx.registers[0].x() == 0x1D {
*((ctx as *mut _ as *mut u8).add(0x300).add(0x98) as *mut u32) = 0x1;
*((ctx.sp.x() as *const u8).add(0x98) as *mut u32) = 0x1;
}
}

Expand Down
Loading
Loading