mirror of
https://github.com/zeldaret/ph
synced 2026-07-04 04:30:45 -04:00
Decomp Actor
This commit is contained in:
+10
-11
@@ -49,20 +49,13 @@ struct Actor_UnkStruct_0a4 {
|
||||
Actor_UnkStruct_0a4(q20 x, q20 y, q20 z, s32 unk_10);
|
||||
};
|
||||
|
||||
class KillPickupsFilter : public FilterActorBase {
|
||||
class KillPickupsFilter: FilterActorReturn, public FilterActorBase {
|
||||
public:
|
||||
/* 00 (base) */
|
||||
/* 04 */ ActorRef mUnk_4[10];
|
||||
/* a4 */
|
||||
/* 04 */
|
||||
|
||||
/* 0 */ virtual bool Filter(Actor *actor) override;
|
||||
/* 4 */
|
||||
|
||||
inline KillPickupsFilter() {
|
||||
for (s32 i = 0; i < 10; ++i) {
|
||||
mUnk_4[i].Reset();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
typedef u32 PlayerCollide;
|
||||
@@ -78,7 +71,13 @@ struct Knockback {
|
||||
/* 00 */ u8 mUnk_00;
|
||||
/* 04 */ Vec3p vec;
|
||||
/* 10 */ unk32 mUnk_10;
|
||||
/* 14 */ unk32 mUnk_14;
|
||||
/* 14 */ Actor *actor;
|
||||
|
||||
inline Knockback():
|
||||
mUnk_00(0),
|
||||
mUnk_10(0xb),
|
||||
actor(NULL)
|
||||
{}
|
||||
};
|
||||
|
||||
class Actor : public SysObject {
|
||||
@@ -139,7 +138,7 @@ public:
|
||||
/* 120 */ s16 mUnk_120;
|
||||
/* 122 */ unk16 mUnk_122;
|
||||
/* 124 */ u8 mUnk_124;
|
||||
/* 125 */ unk8 mUnk_125;
|
||||
/* 125 */ u8 mUnk_125;
|
||||
/* 126 */ u16 mUnk_126;
|
||||
/* 128 */ bool mUnk_128;
|
||||
/* 129 */ bool mUnk_129;
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "global.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "Actor/ActorRef.hpp"
|
||||
|
||||
class Actor;
|
||||
|
||||
class FilterActorBase {
|
||||
@@ -13,3 +15,18 @@ public:
|
||||
/* 0 */ virtual bool Filter(Actor *actor) = 0;
|
||||
/* 4 */
|
||||
};
|
||||
|
||||
class FilterActorReturn {
|
||||
public:
|
||||
/* 00 */ ActorRef refs[20];
|
||||
|
||||
inline FilterActorReturn() {
|
||||
ActorRef *ref = refs;
|
||||
ActorRef *end;
|
||||
do {
|
||||
end = &refs[20];
|
||||
ref->Reset();
|
||||
ref++;
|
||||
} while (ref < end);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -252,7 +252,7 @@ public:
|
||||
void Shield_vfunc_38(unk32 param1);
|
||||
void EquipItem_vfunc_38(unk32 param1);
|
||||
bool EquipCollidesWith(Cylinder *cylinder, ItemFlag equipId);
|
||||
void EquipItem_vfunc_2c(ItemFlag equipId);
|
||||
s32 EquipItem_vfunc_2c(ItemFlag equipId);
|
||||
EquipItem* GetEquipItem(ItemFlag equipId);
|
||||
bool func_ov00_020ad790(unk32 param1);
|
||||
bool SetEquippedItem(ItemFlag equipId);
|
||||
|
||||
@@ -14,6 +14,8 @@ struct EquipRope_Unk_18 {
|
||||
/* 1c */
|
||||
};
|
||||
|
||||
class Actor;
|
||||
|
||||
class EquipRope : public EquipItem {
|
||||
public:
|
||||
/* 00 (base) */
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
bool CollidesWith(Cylinder *cylinder);
|
||||
bool func_ov00_020a7c60(Vec3p *param1, Vec3p *param2, s32 param3);
|
||||
bool EquipCollidesWith(Cylinder *cylinder, ItemFlag equipId);
|
||||
void EquipItem_vfunc_2c();
|
||||
s32 EquipItem_vfunc_2c();
|
||||
void SetHealth(s16 health);
|
||||
};
|
||||
|
||||
|
||||
@@ -65,6 +65,12 @@ inline void Vec3p_CopyXZ(Vec3p *vec, Vec3p *out) {
|
||||
out->z = z;
|
||||
}
|
||||
|
||||
inline void Vec3p_Copy(Vec3p *vec, Vec3p *out) {
|
||||
out->x = vec->x;
|
||||
out->y = vec->y;
|
||||
out->z = vec->z;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
/* 00 */ q20 x;
|
||||
/* 04 */ q20 y;
|
||||
|
||||
+40
-43
@@ -80,6 +80,7 @@ ARM Actor::Actor():
|
||||
mUnk_106(0),
|
||||
mUnk_107(0),
|
||||
mUnk_108(0),
|
||||
mUnk_109(0),
|
||||
mUnk_110(0),
|
||||
mUnk_111(0),
|
||||
mUnk_112(0),
|
||||
@@ -367,7 +368,7 @@ ARM bool Actor::IsNearLink() {
|
||||
}
|
||||
|
||||
ARM void Actor::func_ov00_020c1cf8() {
|
||||
if ((!mUnk_0a4.mUnk_00 && !mUnk_0a4.mUnk_01) || !(mUnk_129 != true && mUnk_11d != true && mUnk_11b != true)) {
|
||||
if (mUnk_0a4.mUnk_00 || mUnk_0a4.mUnk_01 || mUnk_129 == true || mUnk_11d == true || mUnk_11b == true) {
|
||||
mInactive = 0;
|
||||
} else {
|
||||
if (this->IsNearLink()) {
|
||||
@@ -439,45 +440,39 @@ ARM bool Actor::func_ov00_020c1fc8(PlayerCollide flags) {
|
||||
Vec3p_Sub(&mPos, &gPlayerPos, &vecFromPlayer);
|
||||
if (this->CollidesWithPlayer(flags & PlayerCollide_Sword)) {
|
||||
Knockback knockback;
|
||||
knockback.mUnk_00 = 0;
|
||||
knockback.mUnk_10 = 0xb;
|
||||
knockback.mUnk_14 = 0;
|
||||
gPlayer->EquipItem_vfunc_2c();
|
||||
knockback.mUnk_00 = gPlayer->EquipItem_vfunc_2c();
|
||||
knockback.vec = vecFromPlayer;
|
||||
knockback.mUnk_10 = 0;
|
||||
knockback.actor = NULL;
|
||||
result = this->vfunc_48(&knockback);
|
||||
} else if (this->CollidesWithPlayer(flags & PlayerCollide_Shield)) {
|
||||
Knockback knockback;
|
||||
knockback.mUnk_10 = 0xb;
|
||||
knockback.mUnk_14 = 0;
|
||||
knockback.mUnk_00 = 0;
|
||||
knockback.vec = vecFromPlayer;
|
||||
s32 wisdomLvl = gItemManager->GetActiveFairyLevel(FairyId_Wisdom);
|
||||
if (wisdomLvl >= 1) {
|
||||
if ((s32) gItemManager->GetActiveFairyLevel(FairyId_Wisdom) >= 1) {
|
||||
knockback.mUnk_10 = 3;
|
||||
} else {
|
||||
knockback.mUnk_10 = 2;
|
||||
}
|
||||
knockback.actor = NULL;
|
||||
result = this->vfunc_48(&knockback);
|
||||
} else if (this->CollidesWithPlayer(flags & PlayerCollide_Hammer)) {
|
||||
Knockback knockback;
|
||||
knockback.mUnk_00 = 0;
|
||||
knockback.mUnk_10 = 0xb;
|
||||
knockback.mUnk_14 = 0;
|
||||
gPlayer->EquipItem_vfunc_2c();
|
||||
knockback.mUnk_00 = gPlayer->EquipItem_vfunc_2c();
|
||||
knockback.vec = vecFromPlayer;
|
||||
knockback.mUnk_10 = 4;
|
||||
knockback.actor = NULL;
|
||||
result = this->vfunc_48(&knockback);
|
||||
} else if (this->CollidesWithPlayer(flags & PlayerCollide_Gongoron)) {
|
||||
Knockback knockback;
|
||||
knockback.mUnk_00 = 0;
|
||||
knockback.mUnk_10 = 0xb;
|
||||
knockback.mUnk_14 = 0;
|
||||
u8 unk1 = gPlayerLink->vfunc_78();
|
||||
knockback.mUnk_00 = gPlayerLink->vfunc_78();
|
||||
knockback.vec = vecFromPlayer;
|
||||
if (unk1 != 0) {
|
||||
if (knockback.mUnk_00 != 0) {
|
||||
knockback.mUnk_10 = 9;
|
||||
} else {
|
||||
knockback.mUnk_10 = 2;
|
||||
}
|
||||
knockback.actor = NULL;
|
||||
result = this->vfunc_48(&knockback);
|
||||
}
|
||||
}
|
||||
@@ -533,25 +528,26 @@ ARM void Actor::func_ov00_020c23d4(ActorRef *ref, Actor *actor, Cylinder *cylind
|
||||
gActorManager->func_ov00_020c399c(actor->mRef.index, cylinder);
|
||||
}
|
||||
|
||||
ARM bool Actor::func_ov00_020c243c(ActorTypeId *actorTypes, Actor **result) {
|
||||
if (result) *result = NULL;
|
||||
ARM bool Actor::func_ov00_020c243c(ActorTypeId *actorTypes, Actor **out) {
|
||||
if (out) *out = NULL;
|
||||
if (gAdventureFlags->func_ov00_02097738()) return false;
|
||||
|
||||
bool result = false;
|
||||
if (mHitbox.size >= 0) {
|
||||
Actor *actor = gActorManager->func_ov00_020c39ac(mRef.index, actorTypes, false);
|
||||
if (actor) {
|
||||
Knockback knockback;
|
||||
knockback.mUnk_10 = 0xb;
|
||||
knockback.mUnk_00 = 0;
|
||||
knockback.mUnk_14 = 0;
|
||||
|
||||
Vec3p vec;
|
||||
if (actor->mType != ActorTypeId_Arrow && actor->mType != ActorTypeId_SBEM) {
|
||||
Vec3p_Sub(&mPos, &actor->mPrevPos, &vec);
|
||||
if (actor->mType == ActorTypeId_Arrow || actor->mType == ActorTypeId_SBEM) {
|
||||
q20 cos = COS(actor->mAngle);
|
||||
q20 sin = SIN(actor->mAngle);
|
||||
knockback.vec.x = sin;
|
||||
knockback.vec.y = 0;
|
||||
knockback.vec.z = cos;
|
||||
} else {
|
||||
vec.x = SIN(actor->mAngle);
|
||||
vec.z = COS(actor->mAngle);
|
||||
vec.y = 0;
|
||||
Vec3p_Sub(&mPos, &actor->mPrevPos, &knockback.vec);
|
||||
}
|
||||
knockback.mUnk_00 = actor->mUnk_125;
|
||||
knockback.actor = actor;
|
||||
|
||||
switch (actor->mType) {
|
||||
case ActorTypeId_SBEM: {
|
||||
@@ -585,6 +581,7 @@ ARM bool Actor::func_ov00_020c243c(ActorTypeId *actorTypes, Actor **result) {
|
||||
case ActorTypeId_BKEY:
|
||||
case ActorTypeId_FORC:
|
||||
case ActorTypeId_FLTB:
|
||||
case ActorTypeId_TSUB:
|
||||
{
|
||||
knockback.mUnk_10 = 10;
|
||||
} break;
|
||||
@@ -593,19 +590,19 @@ ARM bool Actor::func_ov00_020c243c(ActorTypeId *actorTypes, Actor **result) {
|
||||
knockback.mUnk_10 = 4;
|
||||
} break;
|
||||
|
||||
case ActorTypeId_TSUB: {
|
||||
default: {
|
||||
knockback.mUnk_10 = 11;
|
||||
} break;
|
||||
}
|
||||
|
||||
if (this->vfunc_48(&knockback)) {
|
||||
result = this->vfunc_48(&knockback);
|
||||
if (result) {
|
||||
actor->mUnk_040 = this->mRef;
|
||||
if (result) *result = actor;
|
||||
return true;
|
||||
if (out) *out = actor;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ARM bool Actor::CollidesWith(Actor *other) {
|
||||
@@ -713,7 +710,11 @@ ARM void Actor::GetHitbox(Cylinder *hitbox) {
|
||||
|
||||
q20 sin = SIN(angle);
|
||||
q20 cos = COS(angle);
|
||||
Vec3p_Rotate(&mHitbox.pos, sin, cos, &hitbox->pos);
|
||||
// Vec3p_Rotate(&mHitbox.pos, sin, cos, &hitbox->pos);
|
||||
hitbox->pos.x += MUL_Q20(mHitbox.pos.z, sin);
|
||||
hitbox->pos.z += MUL_Q20(mHitbox.pos.z, cos);
|
||||
hitbox->pos.x += MUL_Q20(mHitbox.pos.x, cos);
|
||||
hitbox->pos.z += MUL_Q20(mHitbox.pos.x, -sin);
|
||||
}
|
||||
|
||||
ARM void Actor::GetUnk_08c(Cylinder *param1) {
|
||||
@@ -876,12 +877,8 @@ ARM void Actor::ApplyGravity() {
|
||||
ARM bool Actor::func_ov00_020c3094() {
|
||||
bool result = false;
|
||||
Vec3p pos, prevPos;
|
||||
pos.x = mPos.x;
|
||||
pos.y = mPos.y;
|
||||
pos.z = mPos.z;
|
||||
prevPos.x = mPrevPos.x;
|
||||
prevPos.y = mPrevPos.y;
|
||||
prevPos.z = mPrevPos.z;
|
||||
Vec3p_Copy(&mPos, &pos);
|
||||
Vec3p_Copy(&mPrevPos, &prevPos);
|
||||
s32 unk1 = gMapManager->func_ov00_02083ef8(&pos, &prevPos);
|
||||
if (mPos.y <= unk1) {
|
||||
result = true;
|
||||
|
||||
@@ -211,8 +211,8 @@ ARM bool ItemManager::EquipCollidesWith(Cylinder *hitbox, ItemFlag equipId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ARM void ItemManager::EquipItem_vfunc_2c(ItemFlag equipId) {
|
||||
(*mEquipItems)[equipId]->vfunc_2c();
|
||||
ARM s32 ItemManager::EquipItem_vfunc_2c(ItemFlag equipId) {
|
||||
return (*mEquipItems)[equipId]->vfunc_2c();
|
||||
}
|
||||
|
||||
ARM EquipItem* ItemManager::GetEquipItem(ItemFlag equipId) {
|
||||
|
||||
@@ -14,7 +14,7 @@ bool PlayerBase::func_ov00_020a7c00(s32 param1) {}
|
||||
bool PlayerBase::CollidesWith(Cylinder *cylinder) {}
|
||||
bool PlayerBase::func_ov00_020a7c60(Vec3p *param1, Vec3p *param2, s32 param3) {}
|
||||
void PlayerBase::EquipItem_vfunc_3c(Cylinder *cylinder, ItemFlag equipId) {}
|
||||
void PlayerBase::EquipItem_vfunc_2c() {}
|
||||
s32 PlayerBase::EquipItem_vfunc_2c() {}
|
||||
void PlayerBase::SetHealth(s16 health) {}
|
||||
void PlayerBase::AddHealth(s16 amount) {}
|
||||
bool PlayerBase::Teleport(Vec3p *pos, s16 angle, unk32 param3, bool param4, bool param5) {}
|
||||
|
||||
Reference in New Issue
Block a user