mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-04 06:54:33 +00:00
More actor cleanup Part 3 (#118)
* Add custom types for actor specific functions (like actions) * Add a forward struct declaration for all other actors
This commit is contained in:
parent
f114df8929
commit
1425678d8a
477 changed files with 1817 additions and 792 deletions
|
@ -16,9 +16,13 @@ typedef enum {
|
|||
/* 0x0B */ A_OBJ_KNOB
|
||||
} AObjType;
|
||||
|
||||
typedef struct {
|
||||
struct EnAObj;
|
||||
|
||||
typedef void (*EnAObjActionFunc)(struct EnAObj*, GlobalContext*);
|
||||
|
||||
typedef struct EnAObj {
|
||||
/* 0x000 */ DynaPolyActor dyna;
|
||||
/* 0x164 */ ActorFunc actionFunc;
|
||||
/* 0x164 */ EnAObjActionFunc actionFunc;
|
||||
/* 0x168 */ s32 unk_168;
|
||||
/* 0x16C */ s16 textId;
|
||||
/* 0x16E */ s16 unk_16E;
|
||||
|
@ -66,7 +70,7 @@ extern ColliderCylinderInit D_80115440;
|
|||
extern u32 D_8011546C[];
|
||||
extern u32 D_80115484[];
|
||||
|
||||
void EnAObj_SetupAction(EnAObj* this, ActorFunc actionFunc) {
|
||||
void EnAObj_SetupAction(EnAObj* this, EnAObjActionFunc actionFunc) {
|
||||
this->actionFunc = actionFunc;
|
||||
}
|
||||
|
||||
|
@ -192,7 +196,7 @@ void func_8001D204(EnAObj* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
void func_8001D234(EnAObj* this, s16 params) {
|
||||
EnAObj_SetupAction(this, (ActorFunc)func_8001D25C);
|
||||
EnAObj_SetupAction(this, func_8001D25C);
|
||||
}
|
||||
|
||||
void func_8001D25C(EnAObj* this, GlobalContext* globalCtx) {
|
||||
|
@ -202,7 +206,7 @@ void func_8001D25C(EnAObj* this, GlobalContext* globalCtx) {
|
|||
var = this->dyna.actor.rotTowardsLinkY - this->dyna.actor.shape.rot.y;
|
||||
if ((ABS(var) < 0x2800) || ((this->dyna.actor.params == 0xA) && (ABS(var) > 0x5800))) {
|
||||
if (func_8002F194(&this->dyna.actor, globalCtx)) {
|
||||
EnAObj_SetupAction(this, (ActorFunc)func_8001D204);
|
||||
EnAObj_SetupAction(this, func_8001D204);
|
||||
} else {
|
||||
func_8002F2F4(&this->dyna.actor, globalCtx);
|
||||
}
|
||||
|
@ -215,7 +219,7 @@ void func_8001D310(EnAObj* this, s16 params) {
|
|||
this->unk_168 = 10;
|
||||
this->dyna.actor.posRot.rot.y = 0;
|
||||
this->dyna.actor.shape.rot = this->dyna.actor.posRot.rot;
|
||||
EnAObj_SetupAction(this, (ActorFunc)func_8001D360);
|
||||
EnAObj_SetupAction(this, func_8001D360);
|
||||
}
|
||||
|
||||
void func_8001D360(EnAObj* this, GlobalContext* globalCtx) {
|
||||
|
@ -258,7 +262,7 @@ void func_8001D360(EnAObj* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
void func_8001D480(EnAObj* this, s16 params) {
|
||||
EnAObj_SetupAction(this, (ActorFunc)func_8001D4A8);
|
||||
EnAObj_SetupAction(this, func_8001D4A8);
|
||||
}
|
||||
|
||||
void func_8001D4A8(EnAObj* this, GlobalContext* globalCtx) {
|
||||
|
@ -288,7 +292,7 @@ void func_8001D4A8(EnAObj* this, GlobalContext* globalCtx) {
|
|||
void func_8001D5C8(EnAObj* this, s16 params) {
|
||||
this->dyna.actor.unk_FC = 1200.0f;
|
||||
this->dyna.actor.unk_F8 = 720.0f;
|
||||
EnAObj_SetupAction(this, (ActorFunc)func_8001D608);
|
||||
EnAObj_SetupAction(this, func_8001D608);
|
||||
}
|
||||
|
||||
void func_8001D608(EnAObj* this, GlobalContext* globalCtx) {
|
||||
|
|
|
@ -30,9 +30,13 @@ typedef enum {
|
|||
/* 0x19 */ ITEM00_BOMBS_SPECIAL
|
||||
} Item00Type;
|
||||
|
||||
typedef struct {
|
||||
struct EnItem00;
|
||||
|
||||
typedef void (*EnItem00ActionFunc)(struct EnItem00*, GlobalContext*);
|
||||
|
||||
typedef struct EnItem00 {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x14C */ ActorFunc actionFunc;
|
||||
/* 0x14C */ EnItem00ActionFunc actionFunc;
|
||||
/* 0x150 */ s16 collectibleFlag;
|
||||
/* 0x152 */ s16 unk_152;
|
||||
/* 0x154 */ s16 unk_154;
|
||||
|
@ -83,7 +87,7 @@ extern u8 D_80115664[];
|
|||
|
||||
// Internal Actor Functions
|
||||
|
||||
void EnItem00_SetupAction(EnItem00* this, ActorFunc actionFunc) {
|
||||
void EnItem00_SetupAction(EnItem00* this, EnItem00ActionFunc actionFunc) {
|
||||
this->actionFunc = actionFunc;
|
||||
}
|
||||
|
||||
|
@ -228,7 +232,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
this->unk_152 = 0;
|
||||
|
||||
if (!spawnParam8000) {
|
||||
EnItem00_SetupAction(this, (ActorFunc)func_8001DFC8);
|
||||
EnItem00_SetupAction(this, func_8001DFC8);
|
||||
this->unk_15A = -1;
|
||||
return;
|
||||
}
|
||||
|
@ -310,7 +314,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
func_8002F554(&this->actor, globalCtx, getItemId);
|
||||
}
|
||||
|
||||
EnItem00_SetupAction(this, (ActorFunc)func_8001E5C8);
|
||||
EnItem00_SetupAction(this, func_8001E5C8);
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
|
||||
|
@ -362,7 +366,7 @@ void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
if ((this->actor.gravity != 0.0f) && !(this->actor.bgCheckFlags & 0x0001)) {
|
||||
EnItem00_SetupAction(this, (ActorFunc)func_8001E1C8);
|
||||
EnItem00_SetupAction(this, func_8001E1C8);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -384,7 +388,7 @@ void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) {
|
|||
if (this->actor.bgCheckFlags & 0x0003) {
|
||||
originalVelocity = this->actor.velocity.y;
|
||||
if (originalVelocity > -2.0f) {
|
||||
EnItem00_SetupAction(this, (ActorFunc)func_8001DFC8);
|
||||
EnItem00_SetupAction(this, func_8001DFC8);
|
||||
this->actor.velocity.y = 0.0f;
|
||||
} else {
|
||||
this->actor.velocity.y = originalVelocity * -0.8f;
|
||||
|
@ -440,7 +444,7 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
if (this->actor.bgCheckFlags & 0x0003) {
|
||||
EnItem00_SetupAction(this, (ActorFunc)func_8001DFC8);
|
||||
EnItem00_SetupAction(this, func_8001DFC8);
|
||||
this->actor.shape.rot.z = 0;
|
||||
this->actor.velocity.y = 0.0f;
|
||||
this->actor.speedXZ = 0.0f;
|
||||
|
@ -694,7 +698,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
Actor_SetScale(&this->actor, this->unk_15C);
|
||||
|
||||
this->unk_152 = 0;
|
||||
EnItem00_SetupAction(this, (ActorFunc)func_8001E5C8);
|
||||
EnItem00_SetupAction(this, func_8001E5C8);
|
||||
}
|
||||
|
||||
// Draw Function prototypes (used in EnItem00_Draw)
|
||||
|
@ -939,7 +943,7 @@ Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 param
|
|||
spawnedActor->actor.gravity = -0.9f;
|
||||
spawnedActor->actor.posRot.rot.y = Math_Rand_CenteredFloat(65536.0f);
|
||||
Actor_SetScale(&spawnedActor->actor, 0.0f);
|
||||
EnItem00_SetupAction(spawnedActor, (ActorFunc)func_8001E304);
|
||||
EnItem00_SetupAction(spawnedActor, func_8001E304);
|
||||
spawnedActor->unk_15A = 220;
|
||||
if ((spawnedActor->actor.params != ITEM00_SMALL_KEY) &&
|
||||
(spawnedActor->actor.params != ITEM00_HEART_PIECE) &&
|
||||
|
@ -1090,7 +1094,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
|
|||
spawnedActor->actor.gravity = -0.9f;
|
||||
spawnedActor->actor.posRot.rot.y = Math_Rand_ZeroOne() * 40000.0f;
|
||||
Actor_SetScale(&spawnedActor->actor, 0.0f);
|
||||
EnItem00_SetupAction(spawnedActor, (ActorFunc)func_8001E304);
|
||||
EnItem00_SetupAction(spawnedActor, func_8001E304);
|
||||
spawnedActor->actor.flags |= 0x0010;
|
||||
if ((spawnedActor->actor.params != ITEM00_SMALL_KEY) &&
|
||||
(spawnedActor->actor.params != ITEM00_HEART_PIECE) &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue