diff --git a/asm/ov00/Actor/Actor.s b/asm/ov00/Actor/Actor.s index 1b32e94e..0e210e92 100644 --- a/asm/ov00/Actor/Actor.s +++ b/asm/ov00/Actor/Actor.s @@ -956,9 +956,9 @@ _ZN5Actor18func_ov00_020c1ef8EP8CylinderP5Vec3pii: ; 0x020c1ef8 _020c1f58: .word gPlayer arm_func_end _ZN5Actor18func_ov00_020c1ef8EP8CylinderP5Vec3pii - .global _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii - arm_func_start _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii -_ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii: ; 0x020c1f5c + .global _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi + arm_func_start _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi +_ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi: ; 0x020c1f5c stmdb sp!, {r4, r5, r6, lr} mov r6, r1 mov r5, r2 @@ -987,7 +987,7 @@ _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii: ; 0x020c1f5c ldmia sp!, {r4, r5, r6, pc} .align 2, 0 _020c1fc4: .word gPlayer - arm_func_end _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii + arm_func_end _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi .global _ZN5Actor18func_ov00_020c1fc8Ej arm_func_start _ZN5Actor18func_ov00_020c1fc8Ej diff --git a/asm/ov12.inc b/asm/ov12.inc index a55f576a..9e4492b8 100644 --- a/asm/ov12.inc +++ b/asm/ov12.inc @@ -54,7 +54,7 @@ .extern _ZN5Actor16CollidesWithLinkEv .extern _ZN5Actor18CollidesWithPlayerEj .extern _ZN5Actor18func_Ov00_020c1bfcEi -.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii +.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi .extern _ZN5Actor18func_ov00_020c2988EP5Vec3piS1_ .extern _ZN5Actor18func_ov00_020c313cEj .extern _ZN5Actor4KillEv diff --git a/asm/ov12.s b/asm/ov12.s index 9fe97c0e..af89c4f4 100644 --- a/asm/ov12.s +++ b/asm/ov12.s @@ -2623,7 +2623,7 @@ _02114dc8: mov r0, r6 mov r3, #0x800 str r5, [sp, #8] - bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii + bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi mov r2, r5 movs r5, r0 strb r2, [r6, #0x77c] diff --git a/asm/ov14/ov14_0211f640.inc b/asm/ov14/ov14_0211f640.inc index 466c7412..e6c9ae7b 100644 --- a/asm/ov14/ov14_0211f640.inc +++ b/asm/ov14/ov14_0211f640.inc @@ -81,7 +81,7 @@ .extern _ZN5Actor18func_ov00_020c1c20Eii .extern _ZN5Actor18func_ov00_020c1cf8Ev .extern _ZN5Actor18func_ov00_020c1e2cEiP5Vec3p -.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii +.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi .extern _ZN5Actor18func_ov00_020c1fc8Ej .extern _ZN5Actor18func_ov00_020c23c4EP8ActorRefPS_ .extern _ZN5Actor18func_ov00_020c243cEiPi diff --git a/asm/ov14/ov14_0211f640.s b/asm/ov14/ov14_0211f640.s index e6cdda0f..36fbed9b 100644 --- a/asm/ov14/ov14_0211f640.s +++ b/asm/ov14/ov14_0211f640.s @@ -973,7 +973,7 @@ func_ov14_02120180: ; 0x02120180 add r1, sp, #0x3c add r2, sp, #0x30 mov r0, r4 - bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii + bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi cmp r0, #0 beq _02120248 mov r0, r4 diff --git a/asm/ov22.inc b/asm/ov22.inc index dedf31fc..ea627850 100644 --- a/asm/ov22.inc +++ b/asm/ov22.inc @@ -53,7 +53,7 @@ .extern _ZN5Actor18func_ov00_020c1c20Eii .extern _ZN5Actor18func_ov00_020c1da0EiP5Vec3p .extern _ZN5Actor18func_ov00_020c1e2cEiP5Vec3p -.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii +.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi .extern _ZN5Actor18func_ov00_020c2e7cEv .extern _ZN5Actor18func_ov00_020c2ed4Ev .extern _ZN5Actor18func_ov00_020c313cEj diff --git a/asm/ov22.s b/asm/ov22.s index 596292ee..90d7bcdb 100644 --- a/asm/ov22.s +++ b/asm/ov22.s @@ -12415,7 +12415,7 @@ func_ov22_02177814: ; 0x02177814 add r2, sp, #0x18 mov r0, r4 mov r3, r3, asr #0x1 - bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii + bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi cmp r0, #0 beq _02177908 mov r0, #1 diff --git a/asm/ov25.inc b/asm/ov25.inc index fdd8d363..76229273 100644 --- a/asm/ov25.inc +++ b/asm/ov25.inc @@ -44,7 +44,7 @@ .extern _ZN5Actor18func_ov00_020c1c20Eii .extern _ZN5Actor18func_ov00_020c1d58Ev .extern _ZN5Actor18func_ov00_020c1e2cEiP5Vec3p -.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii +.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi .extern _ZN5Actor18func_ov00_020c1fc8Ej .extern _ZN5Actor18func_ov00_020c23c4EP8ActorRefPS_ .extern _ZN5Actor18func_ov00_020c29ecEi diff --git a/asm/ov25.s b/asm/ov25.s index 501b6756..23151e23 100644 --- a/asm/ov25.s +++ b/asm/ov25.s @@ -2471,7 +2471,7 @@ _0216f780: add r1, r4, #0x48 add r2, r2, #0x400 str ip, [sp, #8] - bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii + bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi mov r0, #0 str r0, [sp] add r1, r4, #0x23c diff --git a/asm/ov27.inc b/asm/ov27.inc index a57567e3..e9f2833a 100644 --- a/asm/ov27.inc +++ b/asm/ov27.inc @@ -35,7 +35,7 @@ .extern _ZN5Actor18func_ov00_020c198cEv .extern _ZN5Actor18func_ov00_020c1e2cEiP5Vec3p .extern _ZN5Actor18func_ov00_020c1ef8EP8CylinderP5Vec3pii -.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii +.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi .extern _ZN5Actor18func_ov00_020c1fc8Ej .extern _ZN5Actor18func_ov00_020c243cEiPi .extern _ZN5Actor18func_ov00_020c313cEj diff --git a/asm/ov27.s b/asm/ov27.s index 5aa52791..01f087f5 100644 --- a/asm/ov27.s +++ b/asm/ov27.s @@ -5251,7 +5251,7 @@ func_ov27_02171f3c: ; 0x02171f3c add r2, r6, #0x368 mov r3, #0x400 str r5, [sp, #8] - bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii + bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi mov r0, r6 bl func_ov27_0217296c b _0217245c @@ -5297,7 +5297,7 @@ _02172018: add r2, r6, #0x368 mov r3, #0x400 str r5, [sp, #8] - bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii + bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi b _0217245c _021720c4: bl func_ov27_0216f358 diff --git a/asm/ov29.inc b/asm/ov29.inc index 9e53a55b..b4cd52c4 100644 --- a/asm/ov29.inc +++ b/asm/ov29.inc @@ -28,7 +28,7 @@ .extern _ZN5Actor15TrySetTransformEP9Transform .extern _ZN5Actor16CollidesWithLinkEv .extern _ZN5Actor18func_ov00_020c1e2cEiP5Vec3p -.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii +.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi .extern _ZN5Actor18func_ov00_020c1fc8Ej .extern _ZN5Actor18func_ov00_020c243cEiPi .extern _ZN5Actor18func_ov00_020c2ebcEv diff --git a/asm/ov29.s b/asm/ov29.s index 7fef7de9..046f26ce 100644 --- a/asm/ov29.s +++ b/asm/ov29.s @@ -5486,7 +5486,7 @@ _02171f74: mov r0, r5 mov r3, #0x800 str ip, [sp, #8] - bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii + bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi cmp r0, #0 movne r4, #0 _02172028: diff --git a/asm/ov34.inc b/asm/ov34.inc index 26e51b45..a902b49c 100644 --- a/asm/ov34.inc +++ b/asm/ov34.inc @@ -18,7 +18,7 @@ .extern _ZN5Actor18func_ov00_020c1c20Eii .extern _ZN5Actor18func_ov00_020c1da0EiP5Vec3p .extern _ZN5Actor18func_ov00_020c1e2cEiP5Vec3p -.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii +.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi .extern _ZN5Actor18func_ov00_020c1fc8Ej .extern _ZN5Actor18func_ov00_020c23c4EP8ActorRefPS_ .extern _ZN5Actor18func_ov00_020c243cEiPi diff --git a/asm/ov34.s b/asm/ov34.s index a8010676..04ab36df 100644 --- a/asm/ov34.s +++ b/asm/ov34.s @@ -5690,7 +5690,7 @@ _02180d84: add r1, r1, #0x1c00 add r2, r4, #0x1d40 str r5, [sp, #8] - bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii + bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi mov r0, r4 add r1, r4, #0x1000 mov r2, #0 diff --git a/asm/ov37.inc b/asm/ov37.inc index 242f8ae0..144bf70a 100644 --- a/asm/ov37.inc +++ b/asm/ov37.inc @@ -26,7 +26,7 @@ .extern _ZN5Actor18func_Ov00_020c1bfcEi .extern _ZN5Actor18func_ov00_020c1c20Eii .extern _ZN5Actor18func_ov00_020c1ef8EP8CylinderP5Vec3pii -.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii +.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi .extern _ZN5Actor18func_ov00_020c1fc8Ej .extern _ZN5Actor18func_ov00_020c243cEiPi .extern _ZN5Actor18func_ov00_020c313cEj diff --git a/asm/ov37.s b/asm/ov37.s index 44908421..c9b2bc87 100644 --- a/asm/ov37.s +++ b/asm/ov37.s @@ -9886,7 +9886,7 @@ func_ov37_02184758: ; 0x02184758 add r1, sp, #0x18 add r2, sp, #0xc mov r0, r4 - bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii + bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi cmp r0, #0 addeq sp, sp, #0x24 moveq r0, #0 diff --git a/asm/ov48.inc b/asm/ov48.inc index 7218e2b3..4e215910 100644 --- a/asm/ov48.inc +++ b/asm/ov48.inc @@ -20,7 +20,7 @@ .extern _ZN5Actor18CollidesWithShieldEP8Cylinder .extern _ZN5Actor18func_ov00_020c1cf8Ev .extern _ZN5Actor18func_ov00_020c1d58Ev -.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii +.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi .extern _ZN5Actor18func_ov00_020c1fc8Ej .extern _ZN5Actor18func_ov00_020c243cEiPi .extern _ZN5Actor18func_ov00_020c313cEj @@ -80,7 +80,7 @@ .extern _ZN5Actor18CollidesWithShieldEP8Cylinder .extern _ZN5Actor18func_ov00_020c1cf8Ev .extern _ZN5Actor18func_ov00_020c1d58Ev -.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii +.extern _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi .extern _ZN5Actor18func_ov00_020c1fc8Ej .extern _ZN5Actor18func_ov00_020c243cEiPi .extern _ZN5Actor18func_ov00_020c313cEj diff --git a/asm/ov48.s b/asm/ov48.s index 9b07ade1..1b7914bd 100644 --- a/asm/ov48.s +++ b/asm/ov48.s @@ -2133,7 +2133,7 @@ _02191984: mov r0, r4 rsb r3, r5, #0x334 str r5, [sp, #8] - bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii + bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi _021919dc: mov r0, #1 strb r0, [r4, #0x514] @@ -4724,7 +4724,7 @@ _02193924: str r5, [sp, #4] str r2, [sp, #8] add r2, r10, #0x1cc - bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii + bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi ldr r0, [r10, #0x158] cmp r0, #1 bne _02193b5c @@ -4809,7 +4809,7 @@ _02193924: ldr r3, _02193f30 ; =0x000004cd add r1, r10, #0x48 add r2, r10, #0x1d8 - bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_ii + bl _ZN5Actor18func_ov00_020c1f5cEP5Vec3pS1_iS1_hi _02193b5c: ldr r0, _02193f34 ; =data_ov48_02194688 add r3, sp, #0x94 diff --git a/include/Actor/Actor.hpp b/include/Actor/Actor.hpp index a7b174df..87c90905 100644 --- a/include/Actor/Actor.hpp +++ b/include/Actor/Actor.hpp @@ -118,11 +118,11 @@ public: /* 11a */ bool mVisible; /* 11b */ bool mUnk_11b; /* 11c */ unk8 mUnk_11c; - /* 11d */ unk8 mUnk_11d; + /* 11d */ bool mUnk_11d; /* 11e */ q4 mYOffset; /* 120 */ s16 mUnk_120; /* 122 */ unk16 mUnk_122; - /* 124 */ unk8 mUnk_124; + /* 124 */ u8 mUnk_124; /* 125 */ unk8 mUnk_125; /* 126 */ u16 mUnk_126; /* 128 */ bool mUnk_128; @@ -201,7 +201,7 @@ public: bool func_ov00_020c1da0(s32 param1, Vec3p *param2); bool func_ov00_020c1e2c(s32 param1, Vec3p *param2); bool func_ov00_020c1ef8(Cylinder *param1, Vec3p *param2, s32 param3, s32 param4); - bool func_ov00_020c1f5c(Vec3p *param1, Vec3p *param2, s32 param3, Vec3p *param4, s32 param5, s32 param6); + bool func_ov00_020c1f5c(Vec3p *param1, Vec3p *param2, s32 param3, Vec3p *param4, u8 param5, s32 param6); bool func_ov00_020c1fc8(PlayerCollide flags); bool CollidesWithShield(Cylinder *param1); bool CollidesWithPlayer(PlayerCollide flags); diff --git a/src/00_Core/Actor/Actor.cpp b/src/00_Core/Actor/Actor.cpp index 99180b91..651d3ae4 100644 --- a/src/00_Core/Actor/Actor.cpp +++ b/src/00_Core/Actor/Actor.cpp @@ -1,7 +1,12 @@ +extern "C" { + #include +} + #include "Actor/Actor.hpp" #include "Actor/ActorManager.hpp" #include "Map/MapManager.hpp" #include "Player/PlayerLinkBase.hpp" +#include "Save/AdventureFlags.hpp" KILL(_ZN5ActorC1Ev) Actor::Actor() {} @@ -224,15 +229,95 @@ void Actor::func_ov00_020c1c20(s32 param1, unk32 param2) { gMapManager->func_ov00_02084b38(mUnk_020.mUnk_0a[param1], mUnk_020.mUnk_08[param1], param2); } -bool Actor::vfunc_48(unk32 param1) {} -bool Actor::vfunc_4c(unk32 *param1) {} -bool Actor::IsNearLink() {} -void Actor::func_ov00_020c1cf8() {} -bool Actor::func_ov00_020c1d58() {} -bool Actor::func_ov00_020c1da0(s32 param1, Vec3p *param2) {} -bool Actor::func_ov00_020c1e2c(s32 param1, Vec3p *param2) {} -bool Actor::func_ov00_020c1ef8(Cylinder *param1, Vec3p *param2, s32 param3, s32 param4) {} -bool Actor::func_ov00_020c1f5c(Vec3p *param1, Vec3p *param2, s32 param3, Vec3p *param4, s32 param5, s32 param6) {} +bool Actor::vfunc_48(unk32 param1) { + return true; +} + +extern "C" void func_ov00_020c8398(ActorTypeId type, Vec3p *pos, unk32 param2); +bool Actor::vfunc_4c(unk32 *param1) { + if ((*param1 & 0x1f) == 0x8) { + func_ov00_020c8398(mType, &mPos, 1); + this->Kill(); + return true; + } + this->Kill(); + return true; +} + +bool Actor::IsNearLink() { + Vec3p playerPos = gPlayerPos; + q20 z = playerPos.z; + q20 dx = abs(playerPos.x - mPos.x); + if (dx > FLOAT_TO_Q20(10.0)) return false; + q20 dz = abs(playerPos.z - mPos.z); + return dz <= FLOAT_TO_Q20(10.0); +} + +void Actor::func_ov00_020c1cf8() { + if ((!mUnk_0a4.mUnk_00 && !mUnk_0a4.mUnk_01) || !(mUnk_129 != true && mUnk_11d != true && mUnk_11b != true)) { + mInactive = 0; + } else { + if (this->IsNearLink()) { + mInactive = 1; + } else { + mInactive = 2; + } + } +} + +bool Actor::func_ov00_020c1d58() { + if (gAdventureFlags->func_ov00_02097738()) return false; + return gPlayer->vfunc_04() != false; +} + +bool Actor::func_ov00_020c1da0(s32 param1, Vec3p *param2) { + if (!this->func_ov00_020c1d58()) return false; + + Vec3p vec; + if (param2) { + vec = *param2; + } else { + Vec3p_Sub(&gPlayerPos, &mPrevPos, &vec); + } + + return gPlayer->vfunc_30(mUnk_124, &vec, param1); +} + +bool Actor::func_ov00_020c1e2c(s32 param1, Vec3p *param2) { + if (!this->func_ov00_020c1d58()) return false; + if (mHitbox.size < 0) return false; + + Vec3p vec; + if (param2) { + vec = *param2; + } else { + Vec3p_Sub(&gPlayerPos, &mPrevPos, &vec); + } + + Cylinder hitbox; + this->GetHitbox(&hitbox); + if (gPlayer->CollidesWith(&hitbox)) { + return gPlayer->vfunc_30(mUnk_124, &vec, param1); + } + return false; +} + +bool Actor::func_ov00_020c1ef8(Cylinder *param1, Vec3p *param2, s32 param3, s32 param4) { + if (!this->func_ov00_020c1d58()) return false; + if (gPlayer->CollidesWith(param1)) { + return gPlayer->vfunc_30(param3, param2, param4); + } + return false; +} + +bool Actor::func_ov00_020c1f5c(Vec3p *param1, Vec3p *param2, s32 param3, Vec3p *param4, u8 param5, s32 param6) { + if (!this->func_ov00_020c1d58()) return false; + if (gPlayer->func_ov00_020a7c60(param1, param2, param3)) { + return gPlayer->vfunc_30(param5, param4, param6); + } + return false; +} + bool Actor::func_ov00_020c1fc8(PlayerCollide flags) {} bool Actor::CollidesWithShield(Cylinder *param1) {} bool Actor::CollidesWithPlayer(PlayerCollide flags) {}