1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-10 19:20:13 +00:00

Small doc for Item00 actor (#1268)

* EnItem00.unk_15A rename to despawnTimer

* func_8001E5C8 rename to EnItem00_BounceAfterCollected

* shorten to Item00_Collected
This commit is contained in:
Kenton M 2022-06-12 16:15:15 -07:00 committed by GitHub
parent be57b6bf4c
commit 4cb1c3345f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 27 deletions

View file

@ -282,7 +282,7 @@ typedef struct EnItem00 {
/* 0x154 */ s16 unk_154; /* 0x154 */ s16 unk_154;
/* 0x156 */ s16 unk_156; /* 0x156 */ s16 unk_156;
/* 0x158 */ s16 unk_158; /* 0x158 */ s16 unk_158;
/* 0x15A */ s16 unk_15A; /* 0x15A */ s16 despawnTimer;
/* 0x15C */ f32 scale; /* 0x15C */ f32 scale;
/* 0x160 */ ColliderCylinder collider; /* 0x160 */ ColliderCylinder collider;
} EnItem00; // size = 0x1AC } EnItem00; // size = 0x1AC

View file

@ -13,7 +13,7 @@ void EnItem00_Draw(Actor* thisx, PlayState* play);
void func_8001DFC8(EnItem00* this, PlayState* play); void func_8001DFC8(EnItem00* this, PlayState* play);
void func_8001E1C8(EnItem00* this, PlayState* play); void func_8001E1C8(EnItem00* this, PlayState* play);
void func_8001E304(EnItem00* this, PlayState* play); void func_8001E304(EnItem00* this, PlayState* play);
void func_8001E5C8(EnItem00* this, PlayState* play); void EnItem00_Collected(EnItem00* this, PlayState* play);
void EnItem00_DrawRupee(EnItem00* this, PlayState* play); void EnItem00_DrawRupee(EnItem00* this, PlayState* play);
void EnItem00_DrawCollectible(EnItem00* this, PlayState* play); void EnItem00_DrawCollectible(EnItem00* this, PlayState* play);
@ -273,11 +273,11 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
if (!spawnParam8000) { if (!spawnParam8000) {
EnItem00_SetupAction(this, func_8001DFC8); EnItem00_SetupAction(this, func_8001DFC8);
this->unk_15A = -1; this->despawnTimer = -1;
return; return;
} }
this->unk_15A = 15; this->despawnTimer = 15;
this->unk_154 = 35; this->unk_154 = 35;
this->actor.speedXZ = 0.0f; this->actor.speedXZ = 0.0f;
@ -354,7 +354,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
func_8002F554(&this->actor, play, getItemId); func_8002F554(&this->actor, play, getItemId);
} }
EnItem00_SetupAction(this, func_8001E5C8); EnItem00_SetupAction(this, EnItem00_Collected);
this->actionFunc(this, play); this->actionFunc(this, play);
} }
@ -365,20 +365,20 @@ void EnItem00_Destroy(Actor* thisx, PlayState* play) {
} }
void func_8001DFC8(EnItem00* this, PlayState* play) { void func_8001DFC8(EnItem00* this, PlayState* play) {
if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_HEART) && (this->unk_15A < 0)) || if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_HEART) && (this->despawnTimer < 0)) ||
(this->actor.params == ITEM00_HEART_PIECE)) { (this->actor.params == ITEM00_HEART_PIECE)) {
this->actor.shape.rot.y += 960; this->actor.shape.rot.y += 960;
} else { } else {
if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL)) { if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL)) {
if (this->unk_15A == -1) { if (this->despawnTimer == -1) {
if (Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.world.rot.x - 0x4000, 2, 3000, 1500) == if (Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.world.rot.x - 0x4000, 2, 3000, 1500) ==
0) { 0) {
this->unk_15A = -2; this->despawnTimer = -2;
} }
} else { } else {
if (Math_SmoothStepToS(&this->actor.shape.rot.x, -this->actor.world.rot.x - 0x4000, 2, 3000, 1500) == if (Math_SmoothStepToS(&this->actor.shape.rot.x, -this->actor.world.rot.x - 0x4000, 2, 3000, 1500) ==
0) { 0) {
this->unk_15A = -1; this->despawnTimer = -1;
} }
} }
Math_SmoothStepToS(&this->actor.world.rot.x, 0, 2, 2500, 500); Math_SmoothStepToS(&this->actor.world.rot.x, 0, 2, 2500, 500);
@ -398,7 +398,7 @@ void func_8001DFC8(EnItem00* this, PlayState* play) {
} }
} }
if (this->unk_15A == 0) { if (this->despawnTimer == 0) {
if ((this->actor.params != ITEM00_SMALL_KEY) && (this->actor.params != ITEM00_HEART_PIECE) && if ((this->actor.params != ITEM00_SMALL_KEY) && (this->actor.params != ITEM00_HEART_PIECE) &&
(this->actor.params != ITEM00_HEART_CONTAINER)) { (this->actor.params != ITEM00_HEART_CONTAINER)) {
Actor_Kill(&this->actor); Actor_Kill(&this->actor);
@ -443,7 +443,7 @@ void func_8001E304(EnItem00* this, PlayState* play) {
Vec3f pos; Vec3f pos;
s32 rotOffset; s32 rotOffset;
this->unk_15A++; this->despawnTimer++;
if (this->actor.params == ITEM00_HEART) { if (this->actor.params == ITEM00_HEART) {
if (this->actor.velocity.y < 0.0f) { if (this->actor.velocity.y < 0.0f) {
@ -492,19 +492,19 @@ void func_8001E304(EnItem00* this, PlayState* play) {
} }
} }
void func_8001E5C8(EnItem00* this, PlayState* play) { void EnItem00_Collected(EnItem00* this, PlayState* play) {
Player* player = GET_PLAYER(play); Player* player = GET_PLAYER(play);
if (this->getItemId != GI_NONE) { if (this->getItemId != GI_NONE) {
if (!Actor_HasParent(&this->actor, play)) { if (!Actor_HasParent(&this->actor, play)) {
func_8002F434(&this->actor, play, this->getItemId, 50.0f, 80.0f); func_8002F434(&this->actor, play, this->getItemId, 50.0f, 80.0f);
this->unk_15A++; this->despawnTimer++;
} else { } else {
this->getItemId = GI_NONE; this->getItemId = GI_NONE;
} }
} }
if (this->unk_15A == 0) { if (this->despawnTimer == 0) {
Actor_Kill(&this->actor); Actor_Kill(&this->actor);
return; return;
} }
@ -517,7 +517,8 @@ void func_8001E5C8(EnItem00* this, PlayState* play) {
this->actor.shape.rot.y = 0; this->actor.shape.rot.y = 0;
} }
this->actor.world.pos.y += 40.0f + Math_SinS(this->unk_15A * 15000) * (this->unk_15A * 0.3f); // bounces up and down above player's head
this->actor.world.pos.y += 40.0f + Math_SinS(this->despawnTimer * 15000) * (this->despawnTimer * 0.3f);
if (LINK_IS_ADULT) { if (LINK_IS_ADULT) {
this->actor.world.pos.y += 20.0f; this->actor.world.pos.y += 20.0f;
@ -537,12 +538,12 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {
EnItem00* this = (EnItem00*)thisx; EnItem00* this = (EnItem00*)thisx;
s32 pad; s32 pad;
if (this->unk_15A > 0) { if (this->despawnTimer > 0) {
this->unk_15A--; this->despawnTimer--;
} }
if ((this->unk_15A > 0) && (this->unk_15A < 41) && (this->unk_154 <= 0)) { if ((this->despawnTimer > 0) && (this->despawnTimer < 41) && (this->unk_154 <= 0)) {
this->unk_156 = this->unk_15A; this->unk_156 = this->despawnTimer;
} }
this->actionFunc(this, play); this->actionFunc(this, play);
@ -728,7 +729,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {
Flags_SetCollectible(play, this->collectibleFlag); Flags_SetCollectible(play, this->collectibleFlag);
this->unk_15A = 15; this->despawnTimer = 15;
this->unk_154 = 35; this->unk_154 = 35;
this->actor.shape.rot.z = 0; this->actor.shape.rot.z = 0;
this->actor.speedXZ = 0; this->actor.speedXZ = 0;
@ -738,7 +739,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {
Actor_SetScale(&this->actor, this->scale); Actor_SetScale(&this->actor, this->scale);
this->getItemId = GI_NONE; this->getItemId = GI_NONE;
EnItem00_SetupAction(this, func_8001E5C8); EnItem00_SetupAction(this, EnItem00_Collected);
} }
void EnItem00_Draw(Actor* thisx, PlayState* play) { void EnItem00_Draw(Actor* thisx, PlayState* play) {
@ -761,14 +762,14 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
EnItem00_DrawHeartContainer(this, play); EnItem00_DrawHeartContainer(this, play);
break; break;
case ITEM00_HEART: case ITEM00_HEART:
if (this->unk_15A < 0) { if (this->despawnTimer < 0) {
if (this->unk_15A == -1) { if (this->despawnTimer == -1) {
s8 bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEART); s8 bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEART);
if (Object_IsLoaded(&play->objectCtx, bankIndex)) { if (Object_IsLoaded(&play->objectCtx, bankIndex)) {
this->actor.objBankIndex = bankIndex; this->actor.objBankIndex = bankIndex;
Actor_SetObjectDependency(play, &this->actor); Actor_SetObjectDependency(play, &this->actor);
this->unk_15A = -2; this->despawnTimer = -2;
} }
} else { } else {
mtxScale = 16.0f; mtxScale = 16.0f;
@ -972,7 +973,7 @@ EnItem00* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, s16 params) {
spawnedActor->actor.world.rot.y = Rand_CenteredFloat(65536.0f); spawnedActor->actor.world.rot.y = Rand_CenteredFloat(65536.0f);
Actor_SetScale(&spawnedActor->actor, 0.0f); Actor_SetScale(&spawnedActor->actor, 0.0f);
EnItem00_SetupAction(spawnedActor, func_8001E304); EnItem00_SetupAction(spawnedActor, func_8001E304);
spawnedActor->unk_15A = 220; spawnedActor->despawnTimer = 220;
if ((spawnedActor->actor.params != ITEM00_SMALL_KEY) && if ((spawnedActor->actor.params != ITEM00_SMALL_KEY) &&
(spawnedActor->actor.params != ITEM00_HEART_PIECE) && (spawnedActor->actor.params != ITEM00_HEART_PIECE) &&
(spawnedActor->actor.params != ITEM00_HEART_CONTAINER)) { (spawnedActor->actor.params != ITEM00_HEART_CONTAINER)) {
@ -1128,7 +1129,7 @@ void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnP
(spawnedActor->actor.params != ITEM00_HEART_CONTAINER)) { (spawnedActor->actor.params != ITEM00_HEART_CONTAINER)) {
spawnedActor->actor.room = -1; spawnedActor->actor.room = -1;
} }
spawnedActor->unk_15A = 220; spawnedActor->despawnTimer = 220;
} }
} }
} else { } else {

View file

@ -173,7 +173,7 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, PlayState* play) {
collectible = Item_DropCollectible(play, &spawnPos, ITEM00_MAGIC_LARGE); collectible = Item_DropCollectible(play, &spawnPos, ITEM00_MAGIC_LARGE);
if (collectible != NULL) { if (collectible != NULL) {
collectible->unk_15A = 6000; collectible->despawnTimer = 6000;
collectible->actor.speedXZ = 0.0f; collectible->actor.speedXZ = 0.0f;
} }
} }