diff options
| author | Roman971 <32455037+Roman971@users.noreply.github.com> | 2020-05-01 20:26:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-01 14:26:16 -0400 |
| commit | 3ca6082084fc51b44a2c68c2bd9e29c947223c64 (patch) | |
| tree | efb9539470705d6e944a93b94c437b98bda91366 /src/code | |
| parent | 2b38920d7e57387f7ace87317d9ef8f8872cfdf0 (diff) | |
More actor cleanup Part 1 (#107)
* Fix naming and structs in z_en_item00.c and z_en_a_keep.c
* Decompile init vars in z_en_item00.c and z_en_a_keep.c
* Create missing .h files for the last few actors
* Fix some collider member names in actor structs
* Fix old actors not properly using "actionFunc" / "SetupAction"
* Remove some local temporary actor structs
* Fix some actor header includes to be absolute instead of relative
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/z_actor.c | 29 | ||||
| -rw-r--r-- | src/code/z_en_a_keep.c | 308 | ||||
| -rw-r--r-- | src/code/z_en_item00.c | 524 |
3 files changed, 442 insertions, 419 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c index decdcc605..250402d45 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2,6 +2,8 @@ #include <global.h> #include <vt.h> +#include "overlays/actors/ovl_En_Part/z_en_part.h" + void ActorShape_Init(ActorShape* shape, f32 arg1, void* shadowDrawFunc, f32 arg3) { shape->unk_08 = arg1; shape->shadowDrawFunc = shadowDrawFunc; @@ -3155,17 +3157,8 @@ void func_80032F54(struct_80032E24* arg0, s32 arg1, s32 arg2, s32 arg3, u32 arg4 arg0->unk_14 = arg1; } -typedef struct { - /* 0x000 */ Actor actor; - /* 0x14C */ u8 unk_14C; - /* 0x14E */ s16 unk_14E; - /* 0x150 */ s32 unk_150; - /* 0x154 */ f32 unk_154; - /* 0x158 */ f32 unk_158; -} ActorEnPart; - s32 func_8003305C(Actor* actor, struct_80032E24* arg1, GlobalContext* globalCtx, s16 params) { - ActorEnPart* spawnedEnPart; + EnPart* spawnedEnPart; MtxF* mtx; s16 objBankIndex; @@ -3187,8 +3180,8 @@ s32 func_8003305C(Actor* actor, struct_80032E24* arg1, GlobalContext* globalCtx, } mtx = &arg1->unk_00[arg1->unk_08]; - spawnedEnPart = (ActorEnPart*)Actor_SpawnAttached(&globalCtx->actorCtx, actor, globalCtx, ACTOR_EN_PART, - mtx->wx, mtx->wy, mtx->wz, 0, 0, objBankIndex, params); + spawnedEnPart = (EnPart*)Actor_SpawnAttached(&globalCtx->actorCtx, actor, globalCtx, ACTOR_EN_PART, mtx->wx, + mtx->wy, mtx->wz, 0, 0, objBankIndex, params); if (spawnedEnPart != NULL) { func_800D20CC(&arg1->unk_00[arg1->unk_08], &spawnedEnPart->actor.shape.rot, 0); spawnedEnPart->unk_150 = arg1->unk_0C[arg1->unk_08]; @@ -4158,13 +4151,13 @@ void func_80035844(Vec3f* arg0, Vec3f* arg1, s16* arg2, s32 arg3) { /** * Spawns En_Part (Dissipating Flames) actor attached to the given actor. */ -ActorEnPart* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, Vec3f* arg3, s32 arg4, s32 unused, - GlobalContext* globalCtx, s16 params, s32 arg8) { - ActorEnPart* spawnedEnPart; +EnPart* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, Vec3f* arg3, s32 arg4, s32 unused, + GlobalContext* globalCtx, s16 params, s32 arg8) { + EnPart* spawnedEnPart; - spawnedEnPart = (ActorEnPart*)Actor_SpawnAttached(&globalCtx->actorCtx, actor, globalCtx, ACTOR_EN_PART, - spawnPos->x, spawnPos->y, spawnPos->z, spawnRot->x, spawnRot->y, - actor->objBankIndex, params); + spawnedEnPart = + (EnPart*)Actor_SpawnAttached(&globalCtx->actorCtx, actor, globalCtx, ACTOR_EN_PART, spawnPos->x, spawnPos->y, + spawnPos->z, spawnRot->x, spawnRot->y, actor->objBankIndex, params); if (spawnedEnPart != NULL) { spawnedEnPart->actor.scale = actor->scale; spawnedEnPart->actor.speedXZ = arg3->x; diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index 2e6aca502..8630b8bf3 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -17,14 +17,8 @@ typedef enum { } AObjType; typedef struct { - /* 0x000 */ Actor actor; - /* 0x14C */ u32 dynaPolyId; - /* 0x150 */ f32 unk_150; - /* 0x154 */ f32 unk_154; - /* 0x158 */ s16 unk_158; - /* 0x15C */ u32 unk_15C; - /* 0x160 */ u8 unk_160; - /* 0x164 */ ActorFunc updateFunc; + /* 0x000 */ DynaPolyActor dyna; + /* 0x164 */ ActorFunc actionFunc; /* 0x168 */ s32 unk_168; /* 0x16C */ s16 textId; /* 0x16E */ s16 unk_16E; @@ -32,33 +26,51 @@ typedef struct { /* 0x172 */ s16 unk_172; /* 0x174 */ s16 unk_174; /* 0x178 */ f32 unk_178; - /* 0x17C */ ColliderCylinder cylinderCollider; -} ActorEnAObj; // size = 0x1C8 - -void func_8001D204(ActorEnAObj* this, GlobalContext* globalCtx); -void func_8001D25C(ActorEnAObj* this, GlobalContext* globalCtx); -void func_8001D360(ActorEnAObj* this, GlobalContext* globalCtx); -void func_8001D4A8(ActorEnAObj* this, GlobalContext* globalCtx); -void func_8001D608(ActorEnAObj* this, GlobalContext* globalCtx); - -void func_8001D234(ActorEnAObj* this, s16 params); -void func_8001D310(ActorEnAObj* this, s16 params); -void func_8001D480(ActorEnAObj* this, s16 params); -void func_8001D5C8(ActorEnAObj* this, s16 params); - -// TODO: Define this part of code .data here and rename the symbols -extern ActorInit En_A_Obj_InitVars; + /* 0x17C */ ColliderCylinder collider; +} EnAObj; // size = 0x1C8 + +#define FLAGS 0x00000010 + +void func_8001D204(EnAObj* this, GlobalContext* globalCtx); +void func_8001D25C(EnAObj* this, GlobalContext* globalCtx); +void func_8001D360(EnAObj* this, GlobalContext* globalCtx); +void func_8001D4A8(EnAObj* this, GlobalContext* globalCtx); +void func_8001D608(EnAObj* this, GlobalContext* globalCtx); + +void func_8001D234(EnAObj* this, s16 params); +void func_8001D310(EnAObj* this, s16 params); +void func_8001D480(EnAObj* this, s16 params); +void func_8001D5C8(EnAObj* this, s16 params); + +void EnAObj_Init(EnAObj* this, GlobalContext* globalCtx); +void EnAObj_Destroy(EnAObj* this, GlobalContext* globalCtx); +void EnAObj_Update(EnAObj* this, GlobalContext* globalCtx); +void EnAObj_Draw(EnAObj* this, GlobalContext* globalCtx); + +const ActorInit En_A_Obj_InitVars = { + ACTOR_EN_A_OBJ, + ACTORTYPE_PROP, + FLAGS, + OBJECT_GAMEPLAY_KEEP, + sizeof(EnAObj), + (ActorFunc)EnAObj_Init, + (ActorFunc)EnAObj_Destroy, + (ActorFunc)EnAObj_Update, + (ActorFunc)EnAObj_Draw, +}; + +// TODO: Define this section of .data here and rename the symbols extern ColliderCylinderInit D_80115440; extern u32 D_8011546C[]; extern u32 D_80115484[]; -void En_A_Obj_SetNewUpdate(ActorEnAObj* this, ActorFunc newUpdateFunc) { - this->updateFunc = newUpdateFunc; +void EnAObj_SetupAction(EnAObj* this, ActorFunc actionFunc) { + this->actionFunc = actionFunc; } #ifdef NON_MATCHING // minor ordering and regalloc differences -void En_A_Obj_Init(ActorEnAObj* this, GlobalContext* globalCtx) { +void EnAObj_Init(EnAObj* this, GlobalContext* globalCtx) { u32 sp34; s16 type; s16 initialParams; @@ -68,164 +80,164 @@ void En_A_Obj_Init(ActorEnAObj* this, GlobalContext* globalCtx) { sp34 = 0; sp28 = 6.0f; - initialParams = this->actor.params; + initialParams = this->dyna.actor.params; type = initialParams & 0xFF; this->textId = (initialParams >> 8) & 0xFF; - this->actor.params = type; + this->dyna.actor.params = type; switch (type & 0xFFFF) { case A_OBJ_BLOCK_SMALL: - Actor_SetScale(&this->actor, 0.025f); + Actor_SetScale(&this->dyna.actor, 0.025f); break; case A_OBJ_BLOCK_LARGE: - Actor_SetScale(&this->actor, 0.05f); + Actor_SetScale(&this->dyna.actor, 0.05f); break; case A_OBJ_BLOCK_HUGE: case A_OBJ_CUBE_SMALL: case A_OBJ_UNKNOWN_6: - Actor_SetScale(&this->actor, 0.1f); + Actor_SetScale(&this->dyna.actor, 0.1f); break; case A_OBJ_BLOCK_SMALL_ROT: - Actor_SetScale(&this->actor, 0.005f); + Actor_SetScale(&this->dyna.actor, 0.005f); break; case A_OBJ_BLOCK_LARGE_ROT: default: - Actor_SetScale(&this->actor, 0.01f); + Actor_SetScale(&this->dyna.actor, 0.01f); break; } - if (this->actor.params >= 9) { + if (this->dyna.actor.params >= 9) { sp28 = 12.0f; } - ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, sp28); + ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, sp28); - this->dynaPolyId = -1; - this->unk_160 = 0; - this->unk_15C = 0; - this->actor.unk_FC = 1200.0f; - this->actor.unk_F8 = 200.0f; - params = this->actor.params; - this->actor.posRot2.pos = this->actor.posRot.pos; + this->dyna.dynaPolyId = -1; + this->dyna.unk_160 = 0; + this->dyna.unk_15C = 0; + this->dyna.actor.unk_FC = 1200.0f; + this->dyna.actor.unk_F8 = 200.0f; + params = this->dyna.actor.params; + this->dyna.actor.posRot2.pos = this->dyna.actor.posRot.pos; switch (params) { case A_OBJ_BLOCK_LARGE: case A_OBJ_BLOCK_HUGE: - this->dynaPolyId = 1; - Actor_ChangeType(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORTYPE_BG); - func_8001D5C8(this, this->actor.params); + this->dyna.dynaPolyId = 1; + Actor_ChangeType(globalCtx, &globalCtx->actorCtx, &this->dyna.actor, ACTORTYPE_BG); + func_8001D5C8(this, this->dyna.actor.params); break; case A_OBJ_BLOCK_SMALL_ROT: case A_OBJ_BLOCK_LARGE_ROT: - this->dynaPolyId = 3; - Actor_ChangeType(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORTYPE_BG); - func_8001D310(this, this->actor.params); + this->dyna.dynaPolyId = 3; + Actor_ChangeType(globalCtx, &globalCtx->actorCtx, &this->dyna.actor, ACTORTYPE_BG); + func_8001D310(this, this->dyna.actor.params); break; case A_OBJ_UNKNOWN_6: - this->actor.flags |= 0x1; - this->dynaPolyId = 5; + this->dyna.actor.flags |= 0x1; + this->dyna.dynaPolyId = 5; this->unk_178 = 10.0f; - this->actor.gravity = -2.0f; - func_8001D234(this, this->actor.params); + this->dyna.actor.gravity = -2.0f; + func_8001D234(this, this->dyna.actor.params); break; case A_OBJ_GRASS_CLUMP: case A_OBJ_TREE_STUMP: - this->dynaPolyId = 0; - func_8001D234(this, this->actor.params); + this->dyna.dynaPolyId = 0; + func_8001D234(this, this->dyna.actor.params); break; case A_OBJ_SIGNPOST_OBLONG: case A_OBJ_SIGNPOST_ARROW: - this->actor.textId = (this->textId & 0xFF) | 0x300; - this->actor.flags |= 0x8 | 0x1; - this->actor.unk_4C = 500.0f; + this->dyna.actor.textId = (this->textId & 0xFF) | 0x300; + this->dyna.actor.flags |= 0x8 | 0x1; + this->dyna.actor.unk_4C = 500.0f; this->unk_178 = 45.0f; - func_8001D234(this, this->actor.params); - Collider_InitCylinder(globalCtx, &this->cylinderCollider); - Collider_SetCylinder(globalCtx, &this->cylinderCollider, &this->actor, &D_80115440); - this->actor.colChkInfo.mass = 0xFF; - this->actor.unk_1F = 0; + func_8001D234(this, this->dyna.actor.params); + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &D_80115440); + this->dyna.actor.colChkInfo.mass = 0xFF; + this->dyna.actor.unk_1F = 0; break; case A_OBJ_KNOB: - this->actor.gravity = -1.5f; + this->dyna.actor.gravity = -1.5f; func_8001D480(this, params); break; default: - this->actor.gravity = -2.0f; + this->dyna.actor.gravity = -2.0f; func_8001D234(this, params); break; } - if (this->actor.params < 5) { - this->actor.colChkInfo.mass = 0xFF; + if (this->dyna.actor.params < 5) { + this->dyna.actor.colChkInfo.mass = 0xFF; } - if (this->dynaPolyId != -1) { - DynaPolyInfo_Alloc(D_8011546C[this->dynaPolyId], &sp34); - this->dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, sp34); + if (this->dyna.dynaPolyId != -1) { + DynaPolyInfo_Alloc(D_8011546C[this->dyna.dynaPolyId], &sp34); + this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp34); } } #else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_en_a_keep/En_A_Obj_Init.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_en_a_keep/EnAObj_Init.s") #endif -void En_A_Obj_Destroy(ActorEnAObj* this, GlobalContext* globalCtx) { - ColliderCylinder* cylinderCollider = &this->cylinderCollider; +void EnAObj_Destroy(EnAObj* this, GlobalContext* globalCtx) { + ColliderCylinder* collider = &this->collider; - DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dynaPolyId); + DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); - switch (this->actor.params) { + switch (this->dyna.actor.params) { case A_OBJ_SIGNPOST_OBLONG: case A_OBJ_SIGNPOST_ARROW: - Collider_DestroyCylinder(globalCtx, cylinderCollider); + Collider_DestroyCylinder(globalCtx, collider); } } -void func_8001D204(ActorEnAObj* this, GlobalContext* globalCtx) { - if (func_8002F334(&this->actor, globalCtx)) { - func_8001D234(this, this->actor.params); +void func_8001D204(EnAObj* this, GlobalContext* globalCtx) { + if (func_8002F334(&this->dyna.actor, globalCtx)) { + func_8001D234(this, this->dyna.actor.params); } } -void func_8001D234(ActorEnAObj* this, s16 params) { - En_A_Obj_SetNewUpdate(this, (ActorFunc)func_8001D25C); +void func_8001D234(EnAObj* this, s16 params) { + EnAObj_SetupAction(this, (ActorFunc)func_8001D25C); } -void func_8001D25C(ActorEnAObj* this, GlobalContext* globalCtx) { +void func_8001D25C(EnAObj* this, GlobalContext* globalCtx) { s16 var; - if (this->actor.textId != 0) { - var = this->actor.rotTowardsLinkY - this->actor.shape.rot.y; - if ((ABS(var) < 0x2800) || ((this->actor.params == 0xA) && (ABS(var) > 0x5800))) { - if (func_8002F194(&this->actor, globalCtx)) { - En_A_Obj_SetNewUpdate(this, (ActorFunc)func_8001D204); + if (this->dyna.actor.textId != 0) { + 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); } else { - func_8002F2F4(&this->actor, globalCtx); + func_8002F2F4(&this->dyna.actor, globalCtx); } } } } -void func_8001D310(ActorEnAObj* this, s16 params) { +void func_8001D310(EnAObj* this, s16 params) { this->unk_16E = 0; this->unk_168 = 10; - this->actor.posRot.rot.y = 0; - this->actor.shape.rot = this->actor.posRot.rot; - En_A_Obj_SetNewUpdate(this, (ActorFunc)func_8001D360); + this->dyna.actor.posRot.rot.y = 0; + this->dyna.actor.shape.rot = this->dyna.actor.posRot.rot; + EnAObj_SetupAction(this, (ActorFunc)func_8001D360); } -void func_8001D360(ActorEnAObj* this, GlobalContext* globalCtx) { +void func_8001D360(EnAObj* this, GlobalContext* globalCtx) { if (this->unk_16E == 0) { - if (this->unk_160 != 0) { + if (this->dyna.unk_160 != 0) { this->unk_16E++; this->unk_170 = 20; - if ((s16)(this->actor.rotTowardsLinkY + 0x4000) < 0) { + if ((s16)(this->dyna.actor.rotTowardsLinkY + 0x4000) < 0) { this->unk_174 = -1000; } else { this->unk_174 = 1000; } - if (this->actor.rotTowardsLinkY < 0) { + if (this->dyna.actor.rotTowardsLinkY < 0) { this->unk_172 = -this->unk_174; } else { this->unk_172 = this->unk_174; @@ -235,101 +247,103 @@ void func_8001D360(ActorEnAObj* this, GlobalContext* globalCtx) { if (this->unk_168 != 0) { this->unk_168--; } else { - this->actor.shape.rot.y += this->unk_172; - this->actor.shape.rot.x += this->unk_174; + this->dyna.actor.shape.rot.y += this->unk_172; + this->dyna.actor.shape.rot.x += this->unk_174; this->unk_170--; - this->actor.gravity = -1.0f; + this->dyna.actor.gravity = -1.0f; if (this->unk_170 == 0) { - this->actor.posRot.pos = this->actor.initPosRot.pos; + this->dyna.actor.posRot.pos = this->dyna.actor.initPosRot.pos; this->unk_16E = 0; this->unk_168 = 10; - this->actor.velocity.y = 0.0f; - this->actor.gravity = 0.0f; - this->actor.shape.rot = this->actor.posRot.rot; + this->dyna.actor.velocity.y = 0.0f; + this->dyna.actor.gravity = 0.0f; + this->dyna.actor.shape.rot = this->dyna.actor.posRot.rot; } } } } -void func_8001D480(ActorEnAObj* this, s16 params) { - En_A_Obj_SetNewUpdate(this, (ActorFunc)func_8001D4A8); +void func_8001D480(EnAObj* this, s16 params) { + EnAObj_SetupAction(this, (ActorFunc)func_8001D4A8); } -void func_8001D4A8(ActorEnAObj* this, GlobalContext* globalCtx) { - Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 1.0f, 1.0f, 0.5f, 0.0f); - this->actor.shape.rot.x = this->actor.shape.rot.x + (this->actor.posRot.rot.x >> 1); - this->actor.shape.rot.z = this->actor.shape.rot.z + (this->actor.posRot.rot.z >> 1); +void func_8001D4A8(EnAObj* this, GlobalContext* globalCtx) { + Math_SmoothScaleMaxMinF(&this->dyna.actor.speedXZ, 1.0f, 1.0f, 0.5f, 0.0f); + this->dyna.actor.shape.rot.x = this->dyna.actor.shape.rot.x + (this->dyna.actor.posRot.rot.x >> 1); + this->dyna.actor.shape.rot.z = this->dyna.actor.shape.rot.z + (this->dyna.actor.posRot.rot.z >> 1); - if ((this->actor.speedXZ != 0.0f) && (this->actor.bgCheckFlags & 0x8)) { + if ((this->dyna.actor.speedXZ != 0.0f) && (this->dyna.actor.bgCheckFlags & 0x8)) { if (1) { // Necessary to match - this->actor.posRot.rot.y = ((this->actor.unk_7E - this->actor.posRot.rot.y) + this->actor.unk_7E) - 0x8000; + this->dyna.actor.posRot.rot.y = + ((this->dyna.actor.unk_7E - this->dyna.actor.posRot.rot.y) + this->dyna.actor.unk_7E) - 0x8000; } - this->actor.bgCheckFlags &= ~0x8; + this->dyna.actor.bgCheckFlags &= ~0x8; } - if (this->actor.bgCheckFlags & 0x2) { - if (this->actor.velocity.y < -8.0f) { - this->actor.velocity.y *= -0.6f; - this->actor.speedXZ *= 0.6f; - this->actor.bgCheckFlags &= ~0x3; + if (this->dyna.actor.bgCheckFlags & 0x2) { + if (this->dyna.actor.velocity.y < -8.0f) { + this->dyna.actor.velocity.y *= -0.6f; + this->dyna.actor.speedXZ *= 0.6f; + this->dyna.actor.bgCheckFlags &= ~0x3; } else { - Actor_Kill(&this->actor); + Actor_Kill(&this->dyna.actor); } } } -void func_8001D5C8(ActorEnAObj* this, s16 params) { - this->actor.unk_FC = 1200.0f; - this->actor.unk_F8 = 720.0f; - En_A_Obj_SetNewUpdate(this, (ActorFunc)func_8001D608); +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); } -void func_8001D608(ActorEnAObj* this, GlobalContext* globalCtx) { - this->actor.speedXZ += this->unk_150; - this->actor.posRot.rot.y = this->unk_158; +void func_8001D608(EnAObj* this, GlobalContext* globalCtx) { + this->dyna.actor.speedXZ += this->dyna.unk_150; + this->dyna.actor.posRot.rot.y = this->dyna.unk_158; - this->actor.speedXZ = - (this->actor.speedXZ < -2.5f) ? -2.5f : ((this->actor.speedXZ > 2.5f) ? 2.5f : this->actor.speedXZ); + this->dyna.actor.speedXZ = (this->dyna.actor.speedXZ < -2.5f) + ? -2.5f + : ((this->dyna.actor.speedXZ > 2.5f) ? 2.5f : this->dyna.actor.speedXZ); - Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); + Math_SmoothScaleMaxMinF(&this->dyna.actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); - if (this->actor.speedXZ != 0.0f) { - Audio_PlayActorSound2(&this->actor, 0x200A); + if (this->dyna.actor.speedXZ != 0.0f) { + Audio_PlayActorSound2(&this->dyna.actor, 0x200A); } - this->unk_154 = 0.0f; - this->unk_150 = 0.0f; + this->dyna.unk_154 = 0.0f; + this->dyna.unk_150 = 0.0f; } -void En_A_Obj_Update(ActorEnAObj* this, GlobalContext* globalCtx) { +void EnAObj_Update(EnAObj* this, GlobalContext* globalCtx) { Collider* collider; - this->updateFunc(this, globalCtx); - Actor_MoveForward(&this->actor); + this->actionFunc(this, globalCtx); + Actor_MoveForward(&this->dyna.actor); - if (this->actor.gravity != 0.0f) { - if (this->actor.params != A_OBJ_KNOB) { - func_8002E4B4(globalCtx, &this->actor, 5.0f, 40.0f, 0.0f, 0x1D); + if (this->dyna.actor.gravity != 0.0f) { + if (this->dyna.actor.params != A_OBJ_KNOB) { + func_8002E4B4(globalCtx, &this->dyna.actor, 5.0f, 40.0f, 0.0f, 0x1D); } else { - func_8002E4B4(globalCtx, &this->actor, 5.0f, 20.0f, 0.0f, 0x1D); + func_8002E4B4(globalCtx, &this->dyna.actor, 5.0f, 20.0f, 0.0f, 0x1D); } } - this->actor.posRot2.pos = this->actor.posRot.pos; - this->actor.posRot2.pos.y += this->unk_178; + this->dyna.actor.posRot2.pos = this->dyna.actor.posRot.pos; + this->dyna.actor.posRot2.pos.y += this->unk_178; - switch (this->actor.params) { + switch (this->dyna.actor.params) { case A_OBJ_SIGNPOST_OBLONG: case A_OBJ_SIGNPOST_ARROW: - collider = (Collider*)&this->cylinderCollider; - Collider_CylinderUpdate(&this->actor, &this->cylinderCollider); + collider = (Collider*)&this->collider; + Collider_CylinderUpdate(&this->dyna.actor, &this->collider); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, collider); } } -void En_A_Obj_Draw(ActorEnAObj* this, GlobalContext* globalCtx) { - s32 type = this->actor.params; +void EnAObj_Draw(EnAObj* this, GlobalContext* globalCtx) { + s32 type = this->dyna.actor.params; GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* dispRefs[4]; @@ -341,7 +355,7 @@ void En_A_Obj_Draw(ActorEnAObj* this, GlobalContext* globalCtx) { type = A_OBJ_KNOB; } - if (this->actor.params == A_OBJ_KNOB) { + if (this->dyna.actor.params == A_OBJ_KNOB) { gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 1, 0x3C, 0x3C, 0x3C, 0x32); } diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 917e5fece..3ae8282c0 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -2,37 +2,37 @@ #include <global.h> typedef enum { - /* 0x00 */ DROP_RUPEE_GREEN, - /* 0x01 */ DROP_RUPEE_BLUE, - /* 0x02 */ DROP_RUPEE_RED, - /* 0x03 */ DROP_HEART, - /* 0x04 */ DROP_BOMBS_A, - /* 0x05 */ DROP_ARROWS_SINGLE, - /* 0x06 */ DROP_HEART_PIECE, - /* 0x07 */ DROP_HEART_CONTAINER, - /* 0x08 */ DROP_ARROWS_SMALL, - /* 0x09 */ DROP_ARROWS_MEDIUM, - /* 0x0A */ DROP_ARROWS_LARGE, - /* 0x0B */ DROP_BOMBS_B, - /* 0x0C */ DROP_NUTS, - /* 0x0D */ DROP_STICK, - /* 0x0E */ DROP_MAGIC_LARGE, - /* 0x0F */ DROP_MAGIC_SMALL, - /* 0x10 */ DROP_SEEDS, - /* 0x11 */ DROP_SMALL_KEY, - /* 0x12 */ DROP_FLEXIBLE, - /* 0x13 */ DROP_RUPEE_ORANGE, - /* 0x14 */ DROP_RUPEE_PURPLE, - /* 0x15 */ DROP_SHIELD_DEKU, - /* 0x16 */ DROP_SHIELD_HYLIAN, - /* 0x17 */ DROP_TUNIC_ZORA, - /* 0x18 */ DROP_TUNIC_GORON, - /* 0x19 */ DROP_BOMBS_SPECIAL -} DropType; + /* 0x00 */ ITEM00_RUPEE_GREEN, + /* 0x01 */ ITEM00_RUPEE_BLUE, + /* 0x02 */ ITEM00_RUPEE_RED, + /* 0x03 */ ITEM00_HEART, + /* 0x04 */ ITEM00_BOMBS_A, + /* 0x05 */ ITEM00_ARROWS_SINGLE, + /* 0x06 */ ITEM00_HEART_PIECE, + /* 0x07 */ ITEM00_HEART_CONTAINER, + /* 0x08 */ ITEM00_ARROWS_SMALL, + /* 0x09 */ ITEM00_ARROWS_MEDIUM, + /* 0x0A */ ITEM00_ARROWS_LARGE, + /* 0x0B */ ITEM00_BOMBS_B, + /* 0x0C */ ITEM00_NUTS, + /* 0x0D */ ITEM00_STICK, + /* 0x0E */ ITEM00_MAGIC_LARGE, + /* 0x0F */ ITEM00_MAGIC_SMALL, + /* 0x10 */ ITEM00_SEEDS, + /* 0x11 */ ITEM00_SMALL_KEY, + /* 0x12 */ ITEM00_FLEXIBLE, + /* 0x13 */ ITEM00_RUPEE_ORANGE, + /* 0x14 */ ITEM00_RUPEE_PURPLE, + /* 0x15 */ ITEM00_SHIELD_DEKU, + /* 0x16 */ ITEM00_SHIELD_HYLIAN, + /* 0x17 */ ITEM00_TUNIC_ZORA, + /* 0x18 */ ITEM00_TUNIC_GORON, + /* 0x19 */ ITEM00_BOMBS_SPECIAL +} Item00Type; typedef struct { /* 0x000 */ Actor actor; - /* 0x14C */ ActorFunc updateFunc; + /* 0x14C */ ActorFunc actionFunc; /* 0x150 */ s16 collectibleFlag; /* 0x152 */ s16 unk_152; /* 0x154 */ s16 unk_154; @@ -40,16 +40,34 @@ typedef struct { /* 0x158 */ s16 unk_158; /* 0x15A */ s16 unk_15A; /* 0x15C */ f32 unk_15C; - /* 0x160 */ ColliderCylinder cylinderCollider; -} ActorEnItem00; - -void func_8001DFC8(ActorEnItem00* this, GlobalContext* globalCtx); -void func_8001E1C8(ActorEnItem00* this, GlobalContext* globalCtx); -void func_8001E304(ActorEnItem00* this, GlobalContext* globalCtx); -void func_8001E5C8(ActorEnItem00* this, GlobalContext* globalCtx); - -// TODO: Define this part of code .data here and rename the symbols -extern ActorInit En_Item00_InitVars; + /* 0x160 */ ColliderCylinder collider; +} EnItem00; // size = 0x1AC + +#define FLAGS 0x00000000 + +void EnItem00_Init(EnItem00* this, GlobalContext* globalCtx); +void EnItem00_Destroy(EnItem00* this, GlobalContext* globalCtx); +void EnItem00_Update(EnItem00* this, GlobalContext* globalCtx); +void EnItem00_Draw(EnItem00* this, GlobalContext* globalCtx); + +void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx); +void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx); +void func_8001E304(EnItem00* this, GlobalContext* globalCtx); +void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx); + +const ActorInit En_Item00_InitVars = { + ACTOR_EN_ITEM00, + ACTORTYPE_MISC, + FLAGS, + OBJECT_GAMEPLAY_KEEP, + sizeof(EnItem00), + (ActorFunc)EnItem00_Init, + (ActorFunc)EnItem00_Destroy, + (ActorFunc)EnItem00_Update, + (ActorFunc)EnItem00_Draw, +}; + +// TODO: Define this section of .data here and rename the symbols extern ColliderCylinderInit D_801154E0; extern InitChainEntry D_8011550C[]; extern Color_RGB8 D_80115510; @@ -63,13 +81,13 @@ extern u8 D_80115664[]; // Internal Actor Functions -void En_Item00_SetNewUpdate(ActorEnItem00* this, ActorFunc newUpdateFunc) { - this->updateFunc = newUpdateFunc; +void EnItem00_SetupAction(EnItem00* this, ActorFunc actionFunc) { + this->actionFunc = actionFunc; } #ifdef NON_MATCHING // Very close to matching, just a single ordering issue -void En_Item00_Init(ActorEnItem00* this, GlobalContext* globalCtx) { +void EnItem00_Init(EnItem00* this, GlobalContext* globalCtx) { s32 pad1; s32 pad2; f32 sp34; @@ -93,87 +111,87 @@ void En_Item00_Init(ActorEnItem00* this, GlobalContext* globalCtx) { } Actor_ProcessInitChain(&this->actor, D_8011550C); - Collider_InitCylinder(globalCtx, &this->cylinderCollider); - Collider_SetCylinder(globalCtx, &this->cylinderCollider, &this->actor, &D_801154E0); + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &D_801154E0); this->unk_158 = 1; switch (this->actor.params) { - case DROP_RUPEE_GREEN: - case DROP_RUPEE_BLUE: - case DROP_RUPEE_RED: + case ITEM00_RUPEE_GREEN: + case ITEM00_RUPEE_BLUE: + case ITEM00_RUPEE_RED: Actor_SetScale(&this->actor, 0.015f); this->unk_15C = 0.015f; sp34 = 750.0f; break; - case DROP_SMALL_KEY: + case ITEM00_SMALL_KEY: this->unk_158 = 0; Actor_SetScale(&this->actor, 0.03f); this->unk_15C = 0.03f; sp34 = 350.0f; break; - case DROP_HEART_PIECE: + case ITEM00_HEART_PIECE: this->unk_158 = 0; sp34 = 650.0f; Actor_SetScale(&this->actor, 0.02f); this->unk_15C = 0.02f; break; - case DROP_HEART: + case ITEM00_HEART: this->actor.initPosRot.rot.z = Math_Rand_CenteredFloat(65535.0f); sp34 = 430.0f; Actor_SetScale(&this->actor, 0.02f); this->unk_15C = 0.02f; break; - case DROP_HEART_CONTAINER: + case ITEM00_HEART_CONTAINER: sp34 = 430.0f; this->unk_158 = 0; Actor_SetScale(&this->actor, 0.02f); this->unk_15C = 0.02f; break; - case DROP_ARROWS_SINGLE: + case ITEM00_ARROWS_SINGLE: sp34 = 400.0f; Actor_SetScale(&this->actor, 0.02f); this->unk_15C = 0.02f; break; - case DROP_ARROWS_SMALL: - case DROP_ARROWS_MEDIUM: - case DROP_ARROWS_LARGE: + case ITEM00_ARROWS_SMALL: + case ITEM00_ARROWS_MEDIUM: + case ITEM00_ARROWS_LARGE: Actor_SetScale(&this->actor, 0.035f); this->unk_15C = 0.035f; sp34 = 250.0f; break; - case DROP_BOMBS_A: - case DROP_BOMBS_B: - case DROP_NUTS: - case DROP_STICK: - case DROP_MAGIC_SMALL: - case DROP_SEEDS: - case DROP_BOMBS_SPECIAL: + case ITEM00_BOMBS_A: + case ITEM00_BOMBS_B: + case ITEM00_NUTS: + case ITEM00_STICK: + case ITEM00_MAGIC_SMALL: + case ITEM00_SEEDS: + case ITEM00_BOMBS_SPECIAL: Actor_SetScale(&this->actor, 0.03f); this->unk_15C = 0.03f; sp34 = 320.0f; break; - case DROP_MAGIC_LARGE: + case ITEM00_MAGIC_LARGE: Actor_SetScale(&this->actor, 0.045 - 1e-10); this->unk_15C = 0.045 - 1e-10; sp34 = 320.0f; break; - case DROP_RUPEE_ORANGE: + case ITEM00_RUPEE_ORANGE: Actor_SetScale(&this->actor, 0.045 - 1e-10); this->unk_15C = 0.045 - 1e-10; sp34 = 750.0f; break; - case DROP_RUPEE_PURPLE: + case ITEM00_RUPEE_PURPLE: Actor_SetScale(&this->actor, 0.03f); this->unk_15C = 0.03f; sp34 = 750.0f; break; - case DROP_FLEXIBLE: + case ITEM00_FLEXIBLE: sp34 = 500.0f; Actor_SetScale(&this->actor, 0.01f); this->unk_15C = 0.01f; break; - case DROP_SHIELD_DEKU: + case ITEM00_SHIELD_DEKU: this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_1); Actor_SetObjectDependency(globalCtx, &this->actor); Actor_SetScale(&this->actor, 0.5f); @@ -182,7 +200,7 @@ void En_Item00_Init(ActorEnItem00* this, GlobalContext* globalCtx) { sp30 = 0.6f; this->actor.posRot.rot.x = 0x4000; break; - case DROP_SHIELD_HYLIAN: + case ITEM00_SHIELD_HYLIAN: this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_2); Actor_SetObjectDependency(globalCtx, &this->actor); Actor_SetScale(&this->actor, 0.5f); @@ -191,8 +209,8 @@ void En_Item00_Init(ActorEnItem00* this, GlobalContext* globalCtx) { sp30 = 0.6f; this->actor.posRot.rot.x = 0x4000; break; - case DROP_TUNIC_ZORA: - case DROP_TUNIC_GORON: + case ITEM00_TUNIC_ZORA: + case ITEM00_TUNIC_GORON: this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_CLOTHES); Actor_SetObjectDependency(globalCtx, &this->actor); Actor_SetScale(&this->actor, 0.5f); @@ -211,7 +229,7 @@ void En_Item00_Init(ActorEnItem00* this, GlobalContext* globalCtx) { // MISMATCH: minor ordering issues here if (!spawnParam8000) { - En_Item00_SetNewUpdate(this, (ActorFunc)func_8001DFC8); + EnItem00_SetupAction(this, (ActorFunc)func_8001DFC8); this->unk_15A = -1; return; } @@ -224,68 +242,68 @@ void En_Item00_Init(ActorEnItem00* this, GlobalContext* globalCtx) { this->actor.gravity = 0.0f; switch (this->actor.params) { - case DROP_RUPEE_GREEN: + case ITEM00_RUPEE_GREEN: Item_Give(globalCtx, ITEM_RUPEE_GREEN); break; - case DROP_RUPEE_BLUE: + case ITEM00_RUPEE_BLUE: Item_Give(globalCtx, ITEM_RUPEE_BLUE); break; - case DROP_RUPEE_RED: + case ITEM00_RUPEE_RED: Item_Give(globalCtx, ITEM_RUPEE_RED); break; - case DROP_RUPEE_PURPLE: + case ITEM00_RUPEE_PURPLE: Item_Give(globalCtx, ITEM_RUPEE_PURPLE); break; - case DROP_RUPEE_ORANGE: + case ITEM00_RUPEE_ORANGE: Item_Give(globalCtx, ITEM_RUPEE_GOLD); break; - case DROP_HEART: + case ITEM00_HEART: Item_Give(globalCtx, ITEM_HEART); break; - case DROP_FLEXIBLE: + case ITEM00_FLEXIBLE: Health_ChangeBy(globalCtx, 0x70); break; - case DROP_BOMBS_A: - case DROP_BOMBS_B: + case ITEM00_BOMBS_A: + case ITEM00_BOMBS_B: Item_Give(globalCtx, ITEM_BOMBS_5); break; - case DROP_ARROWS_SINGLE: + case ITEM00_ARROWS_SINGLE: Item_Give(globalCtx, ITEM_BOW); break; - case DROP_ARROWS_SMALL: + case ITEM00_ARROWS_SMALL: Item_Give(globalCtx, ITEM_ARROWS_SMALL); break; - case DROP_ARROWS_MEDIUM: + case ITEM00_ARROWS_MEDIUM: Item_Give(globalCtx, ITEM_ARROWS_MEDIUM); break; - case DROP_ARROWS_LARGE: + case ITEM00_ARROWS_LARGE: Item_Give(globalCtx, ITEM_ARROWS_LARGE); break; - case DROP_MAGIC_SMALL: + case ITEM00_MAGIC_SMALL: sp2C = GI_MAGIC_SMALL; break; - case DROP_MAGIC_LARGE: + case ITEM00_MAGIC_LARGE: sp2C = GI_MAGIC_LARGE; break; - case DROP_SMALL_KEY: + case ITEM00_SMALL_KEY: Item_Give(globalCtx, ITEM_KEY_SMALL); break; - case DROP_SEEDS: + case ITEM00_SEEDS: sp2C = GI_SEEDS_5; break; - case DROP_NUTS: + case ITEM00_NUTS: sp2C = GI_NUTS_5; break; - case DROP_STICK: + case ITEM00_STICK: sp2C = GI_STICKS_1; break; - case DROP_HEART_PIECE: - case DROP_HEART_CONTAINER: - case DROP_SHIELD_DEKU: - case DROP_SHIELD_HYLIAN: - case DROP_TUNIC_ZORA: - case DROP_TUNIC_GORON: - case DROP_BOMBS_SPECIAL: + case ITEM00_HEART_PIECE: + case ITEM00_HEART_CONTAINER: + case ITEM00_SHIELD_DEKU: + case ITEM00_SHIELD_HYLIAN: + case ITEM00_TUNIC_ZORA: + case ITEM00_TUNIC_GORON: + case ITEM00_BOMBS_SPECIAL: break; } @@ -293,24 +311,24 @@ void En_Item00_Init(ActorEnItem00* this, GlobalContext* globalCtx) { func_8002F554(&this->actor, globalCtx, sp2C); } - En_Item00_SetNewUpdate(this, (ActorFunc)func_8001E5C8); - this->updateFunc(this, globalCtx); + EnItem00_SetupAction(this, (ActorFunc)func_8001E5C8); + this->actionFunc(this, globalCtx); } #else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_en_item00/En_Item00_Init.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_en_item00/EnItem00_Init.s") #endif -void En_Item00_Destroy(ActorEnItem00* this, GlobalContext* globalCtx) { - ColliderCylinder* cylinderCollider = &this->cylinderCollider; - Collider_DestroyCylinder(globalCtx, cylinderCollider); +void EnItem00_Destroy(EnItem00* this, GlobalContext* globalCtx) { + ColliderCylinder* collider = &this->collider; + Collider_DestroyCylinder(globalCtx, collider); } -void func_8001DFC8(ActorEnItem00* this, GlobalContext* globalCtx) { - if ((this->actor.params <= DROP_RUPEE_RED) || ((this->actor.params == DROP_HEART) && (this->unk_15A < 0)) || - (this->actor.params == DROP_HEART_PIECE)) { +void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) { + if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_HEART) && (this->unk_15A < 0)) || + (this->actor.params == ITEM00_HEART_PIECE)) { this->actor.shape.rot.y += 960; } else { - if ((this->actor.params >= DROP_SHIELD_DEKU) && (this->actor.params != DROP_BOMBS_SPECIAL)) { + if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL)) { if (this->unk_15A == -1) { if (!Math_SmoothScaleMaxMinS(&this->actor.shape.rot.x, this->actor.posRot.rot.x - 0x4000, 2, 3000, 1500)) { @@ -326,36 +344,36 @@ void func_8001DFC8(ActorEnItem00* this, GlobalContext* globalCtx) { } } - if (this->actor.params == DROP_HEART_PIECE) { + if (this->actor.params == ITEM00_HEART_PIECE) { this->actor.shape.unk_08 = Math_Sins(this->actor.shape.rot.y) * 150.0f + 850.0f; } Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); if (this->unk_154 == 0) { - if ((this->actor.params != DROP_SMALL_KEY) && (this->actor.params != DROP_HEART_PIECE) && - (this->actor.params != DROP_HEART_CONTAINER)) { + if ((this->actor.params != ITEM00_SMALL_KEY) && (this->actor.params != ITEM00_HEART_PIECE) && + (this->actor.params != ITEM00_HEART_CONTAINER)) { this->unk_154 = -1; } } if (this->unk_15A == 0) { - if ((this->actor.params != DROP_SMALL_KEY) && (this->actor.params != DROP_HEART_PIECE) && - (this->actor.params != DROP_HEART_CONTAINER)) { + if ((this->actor.params != ITEM00_SMALL_KEY) && (this->actor.params != ITEM00_HEART_PIECE) && + (this->actor.params != ITEM00_HEART_CONTAINER)) { Actor_Kill(&this->actor); } } if ((this->actor.gravity != 0.0f) && !(this->actor.bgCheckFlags & 0x0001)) { - En_Item00_SetNewUpdate(this, (ActorFunc)func_8001E1C8); + EnItem00_SetupAction(this, (ActorFunc)func_8001E1C8); } } -void func_8001E1C8(ActorEnItem00* this, GlobalContext* globalCtx) { +void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) { f32 originalVelocity; Vec3f pos; - if (this->actor.params <= DROP_RUPEE_RED) { + if (this->actor.params <= ITEM00_RUPEE_RED) { this->actor.shape.rot.y += 960; } @@ -369,7 +387,7 @@ void func_8001E1C8(ActorEnItem00* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 0x0003) { originalVelocity = this->actor.velocity.y; if (originalVelocity > -2.0f) { - En_Item00_SetNewUpdate(this, (ActorFunc)func_8001DFC8); + EnItem00_SetupAction(this, (ActorFunc)func_8001DFC8); this->actor.velocity.y = 0.0f; } else { this->actor.velocity.y = originalVelocity * -0.8f; @@ -378,14 +396,14 @@ void func_8001E1C8(ActorEnItem00* this, GlobalContext* globalCtx) { } } -void func_8001E304(ActorEnItem00* this, GlobalContext* globalCtx) { +void func_8001E304(EnItem00* this, GlobalContext* globalCtx) { s32 pad; Vec3f pos; s32 var1; this->unk_15A++; - if (this->actor.params == DROP_HEART) { + if (this->actor.params == ITEM00_HEART) { if (this->actor.velocity.y < 0.0f) { this->actor.speedXZ = 0.0f; this->actor.gravity = -0.4f; @@ -400,9 +418,9 @@ void func_8001E304(ActorEnItem00* this, GlobalContext* globalCtx) { } } - if (this->actor.params <= DROP_RUPEE_RED) { + if (this->actor.params <= ITEM00_RUPEE_RED) { this->actor.shape.rot.y += 960; - } else if ((this->actor.params >= DROP_SHIELD_DEKU) && (this->actor.params != DROP_BOMBS_SPECIAL)) { + } else if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL)) { this->actor.posRot.rot.x -= 700; this->actor.shape.rot.y += 400; this->actor.shape.rot.x = this->actor.posRot.rot.x - 0x4000; @@ -425,14 +443,14 @@ void func_8001E304(ActorEnItem00* this, GlobalContext* globalCtx) { } if (this->actor.bgCheckFlags & 0x0003) { - En_Item00_SetNewUpdate(this, (ActorFunc)func_8001DFC8); + EnItem00_SetupAction(this, (ActorFunc)func_8001DFC8); this->actor.shape.rot.z = 0; this->actor.velocity.y = 0.0f; this->actor.speedXZ = 0.0f; } } -void func_8001E5C8(ActorEnItem00* this, GlobalContext* globalCtx) { +void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) { Player* player = PLAYER; if (this->unk_152 != 0) { @@ -451,9 +469,9 @@ void func_8001E5C8(ActorEnItem00* this, GlobalContext* globalCtx) { this->actor.posRot.pos = player->actor.posRot.pos; - if (this->actor.params <= DROP_RUPEE_RED) { + if (this->actor.params <= ITEM00_RUPEE_RED) { this->actor.shape.rot.y += 960; - } else if (this->actor.params == DROP_HEART) { + } else if (this->actor.params == ITEM00_HEART) { this->actor.shape.rot.y = 0; } @@ -465,12 +483,12 @@ void func_8001E5C8(ActorEnItem00* this, GlobalContext* globalCtx) { } extern s32 D_80157D90; -extern u32 D_80157D90_; // these must be defined separately for En_Item00_Update to match +extern u32 D_80157D90_; // these must be defined separately for EnItem00_Update to match extern s16 D_80157D94; #ifdef NON_MATCHING // Almost matching, just a few minor ordering issues -void En_Item00_Update(ActorEnItem00* this, GlobalContext* globalCtx) { +void EnItem00_Update(EnItem00* this, GlobalContext* globalCtx) { s32 pad1; s32 pad2; s32 sp3C; @@ -489,7 +507,7 @@ void En_Item00_Update(ActorEnItem00* this, GlobalContext* globalCtx) { this->unk_156 = this->unk_15A; } - this->updateFunc(this, globalCtx); + this->actionFunc(this, globalCtx); Math_SmoothScaleMaxMinF(&this->actor.scale.x, this->unk_15C, 0.1f, this->unk_15C * 0.1f, 0.0f); this->actor.scale.z = this->actor.scale.x; @@ -529,11 +547,11 @@ void En_Item00_Update(ActorEnItem00* this, GlobalContext* globalCtx) { } } - Collider_CylinderUpdate(&this->actor, &this->cylinderCollider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->cylinderCollider); + Collider_CylinderUpdate(&this->actor, &this->collider); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider); - if ((this->actor.params == DROP_SHIELD_DEKU) || (this->actor.params == DROP_SHIELD_HYLIAN) || - (this->actor.params == DROP_TUNIC_ZORA) || (this->actor.params == DROP_TUNIC_GORON)) { + if ((this->actor.params == ITEM00_SHIELD_DEKU) || (this->actor.params == ITEM00_SHIELD_HYLIAN) || + (this->actor.params == ITEM00_TUNIC_ZORA) || (this->actor.params == ITEM00_TUNIC_GORON)) { f32 newUnkBC = Math_Coss(this->actor.shape.rot.x) * 37.0f; this->actor.shape.unk_08 = newUnkBC; if (newUnkBC >= 0.0f) { @@ -560,80 +578,80 @@ void En_Item00_Update(ActorEnItem00* this, GlobalContext* globalCtx) { } switch (this->actor.params) { - case DROP_RUPEE_GREEN: + case ITEM00_RUPEE_GREEN: Item_Give(globalCtx, ITEM_RUPEE_GREEN); break; - case DROP_RUPEE_BLUE: + case ITEM00_RUPEE_BLUE: Item_Give(globalCtx, ITEM_RUPEE_BLUE); break; - case DROP_RUPEE_RED: + case ITEM00_RUPEE_RED: Item_Give(globalCtx, ITEM_RUPEE_RED); break; - case DROP_RUPEE_PURPLE: + case ITEM00_RUPEE_PURPLE: Item_Give(globalCtx, ITEM_RUPEE_PURPLE); break; - case DROP_RUPEE_ORANGE: + case ITEM00_RUPEE_ORANGE: Item_Give(globalCtx, ITEM_RUPEE_GOLD); break; - case DROP_STICK: + case ITEM00_STICK: sp3C = GI_STICKS_1; break; - case DROP_NUTS: + case ITEM00_NUTS: sp3C = GI_NUTS_5; break; - case DROP_HEART: + case ITEM00_HEART: Item_Give(globalCtx, ITEM_HEART); break; - case DROP_FLEXIBLE: + case ITEM00_FLEXIBLE: Health_ChangeBy(globalCtx, 0x70); break; - case DROP_BOMBS_A: - case DROP_BOMBS_B: + case ITEM00_BOMBS_A: + case ITEM00_BOMBS_B: Item_Give(globalCtx, ITEM_BOMBS_5); break; - case DROP_ARROWS_SINGLE: + case ITEM00_ARROWS_SINGLE: Item_Give(globalCtx, ITEM_BOW); break; - case DROP_ARROWS_SMALL: + case ITEM00_ARROWS_SMALL: Item_Give(globalCtx, ITEM_ARROWS_SMALL); break; - case DROP_ARROWS_MEDIUM: + case ITEM00_ARROWS_MEDIUM: Item_Give(globalCtx, ITEM_ARROWS_MEDIUM); break; - case DROP_ARROWS_LARGE: + case ITEM00_ARROWS_LARGE: Item_Give(globalCtx, ITEM_ARROWS_LARGE); break; - case DROP_SEEDS: + case ITEM00_SEEDS: sp3C = GI_SEEDS_5; break; - case DROP_SMALL_KEY: + case ITEM00_SMALL_KEY: sp3C = GI_KEY_SMALL; break; - case DROP_HEART_PIECE: + case ITEM00_HEART_PIECE: sp3C = GI_HEART_PIECE; break; - case DROP_HEART_CONTAINER: + case ITEM00_HEART_CONTAINER: sp3C = GI_HEART_CONTAINER; break; - case DROP_MAGIC_LARGE: + case ITEM00_MAGIC_LARGE: sp3C = GI_MAGIC_LARGE; break; - case DROP_MAGIC_SMALL: + case ITEM00_MAGIC_SMALL: sp3C = GI_MAGIC_SMALL; break; - case DROP_SHIELD_DEKU: + case ITEM00_SHIELD_DEKU: sp3C = GI_SHIELD_DEKU; break; - case DROP_SHIELD_HYLIAN: + case ITEM00_SHIELD_HYLIAN: sp3C = GI_SHIELD_HYLIAN; break; - case DROP_TUNIC_ZORA: + case ITEM00_TUNIC_ZORA: sp3C = GI_TUNIC_ZORA; break; - case DROP_TUNIC_GORON: + case ITEM00_TUNIC_GORON: sp3C = GI_TUNIC_GORON; break; - case DROP_BOMBS_SPECIAL: + case ITEM00_BOMBS_SPECIAL: break; } @@ -643,13 +661,13 @@ void En_Item00_Update(ActorEnItem00* this, GlobalContext* globalCtx) { } switch (this->actor.params) { - case DROP_HEART_PIECE: - case DROP_HEART_CONTAINER: - case DROP_SMALL_KEY: - case DROP_SHIELD_DEKU: - case DROP_SHIELD_HYLIAN: - case DROP_TUNIC_ZORA: - case DROP_TUNIC_GORON: + case ITEM00_HEART_PIECE: + case ITEM00_HEART_CONTAINER: + case ITEM00_SMALL_KEY: + case ITEM00_SHIELD_DEKU: + case ITEM00_SHIELD_HYLIAN: + case ITEM00_TUNIC_ZORA: + case ITEM00_TUNIC_GORON: if (func_8002F410(&this->actor, globalCtx)) { Flags_SetCollectible(globalCtx, this->collectibleFlag); Actor_Kill(&this->actor); @@ -657,7 +675,7 @@ void En_Item00_Update(ActorEnItem00* this, GlobalContext* globalCtx) { return; } - if ((this->actor.params <= DROP_RUPEE_RED) || (this->actor.params == DROP_RUPEE_ORANGE)) { + if ((this->actor.params <= ITEM00_RUPEE_RED) || (this->actor.params == ITEM00_RUPEE_ORANGE)) { Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } else if (sp3C != 0) { if (func_8002F410(&this->actor, globalCtx)) { @@ -681,38 +699,38 @@ void En_Item00_Update(ActorEnItem00* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->unk_15C); this->unk_152 = 0; - En_Item00_SetNewUpdate(this, (ActorFunc)func_8001E5C8); + EnItem00_SetupAction(this, (ActorFunc)func_8001E5C8); } #else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_en_item00/En_Item00_Update.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_en_item00/EnItem00_Update.s") #endif -// Draw Function prototypes (used in En_Item00_Draw) -void func_8001EF30(ActorEnItem00* this, GlobalContext* globalCtx); -void func_8001F080(ActorEnItem00* this, GlobalContext* globalCtx); -void func_8001F1F4(ActorEnItem00* this, GlobalContext* globalCtx); -void func_8001F334(ActorEnItem00* this, GlobalContext* globalCtx); +// Draw Function prototypes (used in EnItem00_Draw) +void func_8001EF30(EnItem00* this, GlobalContext* globalCtx); +void func_8001F080(EnItem00* this, GlobalContext* globalCtx); +void func_8001F1F4(EnItem00* this, GlobalContext* globalCtx); +void func_8001F334(EnItem00* this, GlobalContext* globalCtx); -void En_Item00_Draw(ActorEnItem00* this, GlobalContext* globalCtx) { +void EnItem00_Draw(EnItem00* this, GlobalContext* globalCtx) { s32 pad; f32 unkFloat; if (!(this->unk_156 & this->unk_158)) { switch (this->actor.params) { - case DROP_RUPEE_GREEN: - case DROP_RUPEE_BLUE: - case DROP_RUPEE_RED: - case DROP_RUPEE_ORANGE: - case DROP_RUPEE_PURPLE: + case ITEM00_RUPEE_GREEN: + case ITEM00_RUPEE_BLUE: + case ITEM00_RUPEE_RED: + case ITEM00_RUPEE_ORANGE: + case ITEM00_RUPEE_PURPLE: func_8001EF30(this, globalCtx); break; - case DROP_HEART_PIECE: + case ITEM00_HEART_PIECE: func_8001F334(this, globalCtx); break; - case DROP_HEART_CONTAINER: + case ITEM00_HEART_CONTAINER: func_8001F1F4(this, globalCtx); break; - case DROP_HEART: + case ITEM00_HEART: if (this->unk_15A < 0) { if (this->unk_15A == -1) { s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART); @@ -728,34 +746,34 @@ void En_Item00_Draw(ActorEnItem00* this, GlobalContext* globalCtx) { } break; } - case DROP_BOMBS_A: - case DROP_BOMBS_B: - case DROP_BOMBS_SPECIAL: - case DROP_ARROWS_SINGLE: - case DROP_ARROWS_SMALL: - case DROP_ARROWS_MEDIUM: - case DROP_ARROWS_LARGE: - case DROP_NUTS: - case DROP_STICK: - case DROP_MAGIC_LARGE: - case DROP_MAGIC_SMALL: - case DROP_SEEDS: - case DROP_SMALL_KEY: + case ITEM00_BOMBS_A: + case ITEM00_BOMBS_B: + case ITEM00_BOMBS_SPECIAL: + case ITEM00_ARROWS_SINGLE: + case ITEM00_ARROWS_SMALL: + case ITEM00_ARROWS_MEDIUM: + case ITEM00_ARROWS_LARGE: + case ITEM00_NUTS: + case ITEM00_STICK: + case ITEM00_MAGIC_LARGE: + case ITEM00_MAGIC_SMALL: + case ITEM00_SEEDS: + case ITEM00_SMALL_KEY: func_8001F080(this, globalCtx); break; - case DROP_SHIELD_DEKU: + case ITEM00_SHIELD_DEKU: func_800694A0(globalCtx, 0x1C); break; - case DROP_SHIELD_HYLIAN: + case ITEM00_SHIELD_HYLIAN: func_800694A0(globalCtx, 0x2B); break; - case DROP_TUNIC_ZORA: + case ITEM00_TUNIC_ZORA: func_800694A0(globalCtx, 0x3C); break; - case DROP_TUNIC_GORON: + case ITEM00_TUNIC_GORON: func_800694A0(globalCtx, 0x3B); break; - case DROP_FLEXIBLE: + case ITEM00_FLEXIBLE: break; } } @@ -764,7 +782,7 @@ void En_Item00_Draw(ActorEnItem00* this, GlobalContext* globalCtx) { /** * Draw Function used for Rupee types of En_Item00. */ -void func_8001EF30(ActorEnItem00* this, GlobalContext* globalCtx) { +void func_8001EF30(EnItem00* this, GlobalContext* globalCtx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s32 iconNb; Gfx* dispRefs[5]; @@ -775,7 +793,7 @@ void func_8001EF30(ActorEnItem00* this, GlobalContext* globalCtx) { func_8002EBCC(&this->actor, globalCtx, 0); if (1) { // Necessary to match - if (this->actor.params <= DROP_RUPEE_RED) { + if (this->actor.params <= ITEM00_RUPEE_RED) { iconNb = this->actor.params; } else { iconNb = this->actor.params - 0x10; @@ -795,7 +813,7 @@ void func_8001EF30(ActorEnItem00* this, GlobalContext* globalCtx) { /** * Draw Function used for most collectible types of En_Item00 (ammo, bombs, sticks, nuts, magic...). */ -void func_8001F080(ActorEnItem00* this, GlobalContext* globalCtx) { +void func_8001F080(EnItem00* this, GlobalContext* globalCtx) { s32 iconNb; GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* dispRefs[4]; @@ -806,9 +824,9 @@ void func_8001F080(ActorEnItem00* this, GlobalContext* globalCtx) { gfxCtx->polyOpa.p = func_800BC8A0(globalCtx, gfxCtx->polyOpa.p); - if (this->actor.params == DROP_BOMBS_SPECIAL) { + if (this->actor.params == ITEM00_BOMBS_SPECIAL) { iconNb = 1; - } else if (this->actor.params >= DROP_ARROWS_SMALL) { + } else if (this->actor.params >= ITEM00_ARROWS_SMALL) { iconNb -= 3; } @@ -826,7 +844,7 @@ void func_8001F080(ActorEnItem00* this, GlobalContext* globalCtx) { /** * Draw Function used for the Heart Container type of En_Item00. */ -void func_8001F1F4(ActorEnItem00* this, GlobalContext* globalCtx) { +void func_8001F1F4(EnItem00* this, GlobalContext* globalCtx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* dispRefs[5]; @@ -850,7 +868,7 @@ void func_8001F1F4(ActorEnItem00* this, GlobalContext* globalCtx) { /** * Draw Function used for the Piece of Heart type of En_Item00. */ -void func_8001F334(ActorEnItem00* this, GlobalContext* globalCtx) { +void func_8001F334(EnItem00* this, GlobalContext* globalCtx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* dispRefs[5]; @@ -871,29 +889,29 @@ void func_8001F334(ActorEnItem00* this, GlobalContext* globalCtx) { */ s16 func_8001F404(s16 dropId) { if (LINK_IS_ADULT) { - if (dropId == DROP_SEEDS) { - dropId = DROP_ARROWS_SMALL; - } else if (dropId == DROP_STICK) { - dropId = DROP_RUPEE_GREEN; + if (dropId == ITEM00_SEEDS) { + dropId = ITEM00_ARROWS_SMALL; + } else if (dropId == ITEM00_STICK) { + dropId = ITEM00_RUPEE_GREEN; } } else { - if (dropId == DROP_ARROWS_SMALL || dropId == DROP_ARROWS_MEDIUM || dropId == DROP_ARROWS_LARGE) { - dropId = DROP_SEEDS; + if (dropId == ITEM00_ARROWS_SMALL || dropId == ITEM00_ARROWS_MEDIUM || dropId == ITEM00_ARROWS_LARGE) { + dropId = ITEM00_SEEDS; } } // This is convoluted but it seems like it must be a single condition to match // clang-format off - if (((dropId == DROP_BOMBS_A || dropId == DROP_BOMBS_SPECIAL || dropId == DROP_BOMBS_B) && INV_CONTENT(ITEM_BOMB) == ITEM_NONE) || - ((dropId == DROP_ARROWS_SMALL || dropId == DROP_ARROWS_MEDIUM || dropId == DROP_ARROWS_LARGE) && INV_CONTENT(ITEM_BOW) == ITEM_NONE) || - ((dropId == DROP_MAGIC_LARGE || dropId == DROP_MAGIC_SMALL) && gSaveContext.magicLevel == 0) || - ((dropId == DROP_SEEDS) && INV_CONTENT(ITEM_SLINGSHOT) == ITEM_NONE)) { + if (((dropId == ITEM00_BOMBS_A || dropId == ITEM00_BOMBS_SPECIAL || dropId == ITEM00_BOMBS_B) && INV_CONTENT(ITEM_BOMB) == ITEM_NONE) || + ((dropId == ITEM00_ARROWS_SMALL || dropId == ITEM00_ARROWS_MEDIUM || dropId == ITEM00_ARROWS_LARGE) && INV_CONTENT(ITEM_BOW) == ITEM_NONE) || + ((dropId == ITEM00_MAGIC_LARGE || dropId == ITEM00_MAGIC_SMALL) && gSaveContext.magicLevel == 0) || + ((dropId == ITEM00_SEEDS) && INV_CONTENT(ITEM_SLINGSHOT) == ITEM_NONE)) { return -1; } // clang-format on - if (dropId == DROP_HEART && gSaveContext.healthCapacity == gSaveContext.health) { - return DROP_RUPEE_GREEN; + if (dropId == ITEM00_HEART && gSaveContext.healthCapacity == gSaveContext.health) { + return ITEM00_RUPEE_GREEN; } return dropId; @@ -903,17 +921,17 @@ s16 func_8001F404(s16 dropId) { Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params) { s32 pad[2]; - ActorEnItem00* spawnedActor = NULL; + EnItem00* spawnedActor = NULL; s16 param4000 = params & 0x4000; s16 param8000 = params & 0x8000; s16 param3F00 = params & 0x3F00; params = params & 0x3FFF; - if (((params & 0x00FF) == DROP_FLEXIBLE) && !param4000) { - // TODO: Prevent the cast to ActorEnItem00 here since this is a different actor (En_Elf) - spawnedActor = (ActorEnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, - spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, 0x0002); + if (((params & 0x00FF) == ITEM00_FLEXIBLE) && !param4000) { + // TODO: Prevent the cast to EnItem00 here since this is a different actor (En_Elf) + spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, + spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, 0x0002); func_8002A9F4(globalCtx, spawnPos, 0x28E7, 1, 1, 0x28); } else { if (!param8000) { @@ -921,20 +939,19 @@ Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 param } if (params != -1) { - spawnedActor = - (ActorEnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, - spawnPos->z, 0, 0, 0, params | param8000 | param3F00); + spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, + spawnPos->y, spawnPos->z, 0, 0, 0, params | param8000 | param3F00); if ((spawnedActor != NULL) && !param8000) { spawnedActor->actor.velocity.y = !param4000 ? 8.0f : -2.0f; spawnedActor->actor.speedXZ = 2.0f; spawnedActor->actor.gravity = -0.9f; spawnedActor->actor.posRot.rot.y = Math_Rand_CenteredFloat(65536.0f); Actor_SetScale(&spawnedActor->actor, 0.0f); - En_Item00_SetNewUpdate(spawnedActor, (ActorFunc)func_8001E304); + EnItem00_SetupAction(spawnedActor, (ActorFunc)func_8001E304); spawnedActor->unk_15A = 220; - if ((spawnedActor->actor.params != DROP_SMALL_KEY) && - (spawnedActor->actor.params != DROP_HEART_PIECE) && - (spawnedActor->actor.params != DROP_HEART_CONTAINER)) { + if ((spawnedActor->actor.params != ITEM00_SMALL_KEY) && + (spawnedActor->actor.params != ITEM00_HEART_PIECE) && + (spawnedActor->actor.params != ITEM00_HEART_CONTAINER)) { spawnedActor->actor.room = -1; } spawnedActor->actor.flags |= 0x0010; @@ -946,7 +963,7 @@ Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 param } Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params) { - ActorEnItem00* spawnedActor = NULL; + EnItem00* spawnedActor = NULL; s32 pad; s16 param4000 = params & 0x4000; s16 param8000 = params & 0x8000; @@ -954,17 +971,16 @@ Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 para params = params & 0x3FFF; - if (((params & 0x00FF) == DROP_FLEXIBLE) && !param4000) { - // TODO: Prevent the cast to ActorEnItem00 here since this is a different actor (En_Elf) - spawnedActor = (ActorEnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, - spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, 0x0002); + if (((params & 0x00FF) == ITEM00_FLEXIBLE) && !param4000) { + // TODO: Prevent the cast to EnItem00 here since this is a different actor (En_Elf) + spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, + spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, 0x0002); func_8002A9F4(globalCtx, spawnPos, 0x28E7, 1, 1, 0x28); } else { params = func_8001F404(params & 0x00FF); if (params != -1) { - spawnedActor = - (ActorEnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, - spawnPos->z, 0, 0, 0, params | param8000 | param3F00); + spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, + spawnPos->y, spawnPos->z, 0, 0, 0, params | param8000 | param3F00); if ((spawnedActor != NULL) && !param8000) { spawnedActor->actor.velocity.y = 0.0f; spawnedActor->actor.speedXZ = 0.0f; @@ -980,7 +996,7 @@ Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 para void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3f* spawnPos, s16 params) { s32 pad; - ActorEnItem00* spawnedActor; + EnItem00* spawnedActor; s16 dropQuantity; s16 param8000; s16 dropTableIndex; @@ -1016,7 +1032,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 } } if (fromActor->unk_116 & 0x20) { - dropId = DROP_RUPEE_PURPLE; + dropId = ITEM00_RUPEE_PURPLE; } else { dropId = D_80115574[params + dropTableIndex]; } @@ -1024,7 +1040,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 dropId = D_80115574[params + dropTableIndex]; } - if (dropId == DROP_FLEXIBLE) { + if (dropId == ITEM00_FLEXIBLE) { if (gSaveContext.health <= 0x10) { // 1 heart or less Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, 0x0002); @@ -1033,36 +1049,36 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 } else if (gSaveContext.health <= 0x30) { // 3 hearts or less params = 0xB * 0x10; dropTableIndex = 0x0; - dropId = DROP_HEART; + dropId = ITEM00_HEART; } else if (gSaveContext.health <= 0x50) { // 5 hearts or less params = 0xA * 0x10; dropTableIndex = 0x0; - dropId = DROP_HEART; + dropId = ITEM00_HEART; } else if ((gSaveContext.magicLevel != 0) && (gSaveContext.magic == 0)) { // Empty magic meter params = 0xA * 0x10; dropTableIndex = 0x0; - dropId = DROP_MAGIC_LARGE; + dropId = ITEM00_MAGIC_LARGE; } else if ((gSaveContext.magicLevel != 0) && (gSaveContext.magic <= (gSaveContext.magicLevel >> 1))) { // Half magic or less params = 0xA * 0x10; dropTableIndex = 0x0; - dropId = DROP_MAGIC_SMALL; + dropId = ITEM00_MAGIC_SMALL; } else if (LINK_IS_CHILD && (AMMO(ITEM_SLINGSHOT) < 6)) { // Child and less then 6 deku seeds params = 0xA * 0x10; dropTableIndex = 0x0; - dropId = DROP_SEEDS; + dropId = ITEM00_SEEDS; } else if (LINK_IS_ADULT && (AMMO(ITEM_BOW) < 6)) { // Adult and less than 6 arrows params = 0xA * 0x10; dropTableIndex = 0x0; - dropId = DROP_ARROWS_MEDIUM; + dropId = ITEM00_ARROWS_MEDIUM; } else if (AMMO(ITEM_BOMB) < 6) { // Less than 6 bombs params = 0xD * 0x10; dropTableIndex = 0x0; - dropId = DROP_BOMBS_A; + dropId = ITEM00_BOMBS_A; } else if (gSaveContext.rupees < 11) { // Less than 11 Rupees params = 0xA * 0x10; dropTableIndex = 0x0; - dropId = DROP_RUPEE_RED; + dropId = ITEM00_RUPEE_RED; } else { return; } @@ -1074,19 +1090,19 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 if (!param8000) { dropId = func_8001F404(dropId); if (dropId != 0xFF) { - spawnedActor = (ActorEnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, - spawnPos->x, spawnPos->y, spawnPos->z, 0, 0, 0, dropId); + spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, + spawnPos->y, spawnPos->z, 0, 0, 0, dropId); if ((spawnedActor != NULL) && (dropId != 0xFF)) { spawnedActor->actor.velocity.y = 8.0f; spawnedActor->actor.speedXZ = 2.0f; spawnedActor->actor.gravity = -0.9f; spawnedActor->actor.posRot.rot.y = Math_Rand_ZeroOne() * 40000.0f; Actor_SetScale(&spawnedActor->actor, 0.0f); - En_Item00_SetNewUpdate(spawnedActor, (ActorFunc)func_8001E304); + EnItem00_SetupAction(spawnedActor, (ActorFunc)func_8001E304); spawnedActor->actor.flags |= 0x0010; - if ((spawnedActor->actor.params != DROP_SMALL_KEY) && - (spawnedActor->actor.params != DROP_HEART_PIECE) && - (spawnedActor->actor.params != DROP_HEART_CONTAINER)) { + if ((spawnedActor->actor.params != ITEM00_SMALL_KEY) && + (spawnedActor->actor.params != ITEM00_HEART_PIECE) && + (spawnedActor->actor.params != ITEM00_HEART_CONTAINER)) { spawnedActor->actor.room = -1; } spawnedActor->unk_15A = 220; |
