1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-11 03:39:59 +00:00

Item00 BSS OK (#881)

* bss OK

* Small fix

* Pr fixes (Dragorn) and some named symbols

* added the comment Fig requested

* rip jenkins box

* Update src/code/z_en_item00.c

Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>

* Change combined if to 2 ifs

* GI enum

Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
louist103 2021-08-04 12:41:56 -04:00 committed by GitHub
parent 50baf812ac
commit 75b72af8de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 113 additions and 134 deletions

View file

@ -1,17 +0,0 @@
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64 # allow use of 64-bit general purpose registers
.section .bss
.balign 16
glabel D_80157D90
glabel D_80157D90_
.space 0x4
glabel D_80157D94
.space 0xC

View file

@ -250,12 +250,12 @@ typedef struct EnItem00 {
/* 0x000 */ Actor actor; /* 0x000 */ Actor actor;
/* 0x14C */ EnItem00ActionFunc actionFunc; /* 0x14C */ EnItem00ActionFunc actionFunc;
/* 0x150 */ s16 collectibleFlag; /* 0x150 */ s16 collectibleFlag;
/* 0x152 */ s16 unk_152; /* 0x152 */ s16 getItemId;
/* 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 unk_15A;
/* 0x15C */ f32 unk_15C; /* 0x15C */ f32 scale;
/* 0x160 */ ColliderCylinder collider; /* 0x160 */ ColliderCylinder collider;
} EnItem00; // size = 0x1AC } EnItem00; // size = 0x1AC

1
spec
View file

@ -283,7 +283,6 @@ beginseg
after "dmadata" after "dmadata"
include "build/src/code/z_en_a_keep.o" include "build/src/code/z_en_a_keep.o"
include "build/src/code/z_en_item00.o" include "build/src/code/z_en_item00.o"
include "build/data/z_en_item00.bss.o"
include "build/src/code/z_eff_blure.o" include "build/src/code/z_eff_blure.o"
include "build/src/code/z_eff_shield_particle.o" include "build/src/code/z_eff_shield_particle.o"
include "build/src/code/z_eff_spark.o" include "build/src/code/z_eff_spark.o"

View file

@ -17,6 +17,11 @@ void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx);
void func_8001E304(EnItem00* this, GlobalContext* globalCtx); void func_8001E304(EnItem00* this, GlobalContext* globalCtx);
void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx); void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx);
void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx);
void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx);
void EnItem00_DrawHeartContainer(EnItem00* this, GlobalContext* globalCtx);
void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx);
const ActorInit En_Item00_InitVars = { const ActorInit En_Item00_InitVars = {
ACTOR_EN_ITEM00, ACTOR_EN_ITEM00,
ACTORCAT_MISC, ACTORCAT_MISC,
@ -55,7 +60,7 @@ static InitChainEntry sInitChain[] = {
static Color_RGBA8 sEffectPrimColor = { 255, 255, 127, 0 }; static Color_RGBA8 sEffectPrimColor = { 255, 255, 127, 0 };
static Color_RGBA8 sEffectEnvColor = { 255, 255, 255, 0 }; static Color_RGBA8 sEffectEnvColor = { 255, 255, 255, 0 };
static Vec3f sEffectPos = { 0.0f, 0.1f, 0.0f }; static Vec3f sEffectVelocity = { 0.0f, 0.1f, 0.0f };
static Vec3f sEffectAccel = { 0.0f, 0.01f, 0.0f }; static Vec3f sEffectAccel = { 0.0f, 0.01f, 0.0f };
static void* sRupeeTex[] = { static void* sRupeeTex[] = {
@ -327,14 +332,13 @@ void EnItem00_SetupAction(EnItem00* this, EnItem00ActionFunc actionFunc) {
void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
EnItem00* this = THIS; EnItem00* this = THIS;
s32 pad2; s32 pad;
f32 sp34 = 980.0f; f32 yOffset = 980.0f;
f32 sp30 = 6.0f; f32 shadowScale = 6.0f;
s32 getItemId = 0; s32 getItemId = GI_NONE;
s16 spawnParam8000; s16 spawnParam8000 = this->actor.params & 0x8000;
s32 pad3; s32 pad1;
spawnParam8000 = this->actor.params & 0x8000;
this->collectibleFlag = (this->actor.params & 0x3F00) >> 8; this->collectibleFlag = (this->actor.params & 0x3F00) >> 8;
this->actor.params &= 0xFF; this->actor.params &= 0xFF;
@ -355,44 +359,44 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
case ITEM00_RUPEE_BLUE: case ITEM00_RUPEE_BLUE:
case ITEM00_RUPEE_RED: case ITEM00_RUPEE_RED:
Actor_SetScale(&this->actor, 0.015f); Actor_SetScale(&this->actor, 0.015f);
this->unk_15C = 0.015f; this->scale = 0.015f;
sp34 = 750.0f; yOffset = 750.0f;
break; break;
case ITEM00_SMALL_KEY: case ITEM00_SMALL_KEY:
this->unk_158 = 0; this->unk_158 = 0;
Actor_SetScale(&this->actor, 0.03f); Actor_SetScale(&this->actor, 0.03f);
this->unk_15C = 0.03f; this->scale = 0.03f;
sp34 = 350.0f; yOffset = 350.0f;
break; break;
case ITEM00_HEART_PIECE: case ITEM00_HEART_PIECE:
this->unk_158 = 0; this->unk_158 = 0;
sp34 = 650.0f; yOffset = 650.0f;
Actor_SetScale(&this->actor, 0.02f); Actor_SetScale(&this->actor, 0.02f);
this->unk_15C = 0.02f; this->scale = 0.02f;
break; break;
case ITEM00_HEART: case ITEM00_HEART:
this->actor.home.rot.z = Rand_CenteredFloat(65535.0f); this->actor.home.rot.z = Rand_CenteredFloat(65535.0f);
sp34 = 430.0f; yOffset = 430.0f;
Actor_SetScale(&this->actor, 0.02f); Actor_SetScale(&this->actor, 0.02f);
this->unk_15C = 0.02f; this->scale = 0.02f;
break; break;
case ITEM00_HEART_CONTAINER: case ITEM00_HEART_CONTAINER:
sp34 = 430.0f; yOffset = 430.0f;
this->unk_158 = 0; this->unk_158 = 0;
Actor_SetScale(&this->actor, 0.02f); Actor_SetScale(&this->actor, 0.02f);
this->unk_15C = 0.02f; this->scale = 0.02f;
break; break;
case ITEM00_ARROWS_SINGLE: case ITEM00_ARROWS_SINGLE:
sp34 = 400.0f; yOffset = 400.0f;
Actor_SetScale(&this->actor, 0.02f); Actor_SetScale(&this->actor, 0.02f);
this->unk_15C = 0.02f; this->scale = 0.02f;
break; break;
case ITEM00_ARROWS_SMALL: case ITEM00_ARROWS_SMALL:
case ITEM00_ARROWS_MEDIUM: case ITEM00_ARROWS_MEDIUM:
case ITEM00_ARROWS_LARGE: case ITEM00_ARROWS_LARGE:
Actor_SetScale(&this->actor, 0.035f); Actor_SetScale(&this->actor, 0.035f);
this->unk_15C = 0.035f; this->scale = 0.035f;
sp34 = 250.0f; yOffset = 250.0f;
break; break;
case ITEM00_BOMBS_A: case ITEM00_BOMBS_A:
case ITEM00_BOMBS_B: case ITEM00_BOMBS_B:
@ -402,45 +406,45 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
case ITEM00_SEEDS: case ITEM00_SEEDS:
case ITEM00_BOMBS_SPECIAL: case ITEM00_BOMBS_SPECIAL:
Actor_SetScale(&this->actor, 0.03f); Actor_SetScale(&this->actor, 0.03f);
this->unk_15C = 0.03f; this->scale = 0.03f;
sp34 = 320.0f; yOffset = 320.0f;
break; break;
case ITEM00_MAGIC_LARGE: case ITEM00_MAGIC_LARGE:
Actor_SetScale(&this->actor, 0.045 - 1e-10); Actor_SetScale(&this->actor, 0.045 - 1e-10);
this->unk_15C = 0.045 - 1e-10; this->scale = 0.045 - 1e-10;
sp34 = 320.0f; yOffset = 320.0f;
break; break;
case ITEM00_RUPEE_ORANGE: case ITEM00_RUPEE_ORANGE:
Actor_SetScale(&this->actor, 0.045 - 1e-10); Actor_SetScale(&this->actor, 0.045 - 1e-10);
this->unk_15C = 0.045 - 1e-10; this->scale = 0.045 - 1e-10;
sp34 = 750.0f; yOffset = 750.0f;
break; break;
case ITEM00_RUPEE_PURPLE: case ITEM00_RUPEE_PURPLE:
Actor_SetScale(&this->actor, 0.03f); Actor_SetScale(&this->actor, 0.03f);
this->unk_15C = 0.03f; this->scale = 0.03f;
sp34 = 750.0f; yOffset = 750.0f;
break; break;
case ITEM00_FLEXIBLE: case ITEM00_FLEXIBLE:
sp34 = 500.0f; yOffset = 500.0f;
Actor_SetScale(&this->actor, 0.01f); Actor_SetScale(&this->actor, 0.01f);
this->unk_15C = 0.01f; this->scale = 0.01f;
break; break;
case ITEM00_SHIELD_DEKU: case ITEM00_SHIELD_DEKU:
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_1); this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_1);
Actor_SetObjectDependency(globalCtx, &this->actor); Actor_SetObjectDependency(globalCtx, &this->actor);
Actor_SetScale(&this->actor, 0.5f); Actor_SetScale(&this->actor, 0.5f);
this->unk_15C = 0.5f; this->scale = 0.5f;
sp34 = 0.0f; yOffset = 0.0f;
sp30 = 0.6f; shadowScale = 0.6f;
this->actor.world.rot.x = 0x4000; this->actor.world.rot.x = 0x4000;
break; break;
case ITEM00_SHIELD_HYLIAN: case ITEM00_SHIELD_HYLIAN:
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_2); this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_2);
Actor_SetObjectDependency(globalCtx, &this->actor); Actor_SetObjectDependency(globalCtx, &this->actor);
Actor_SetScale(&this->actor, 0.5f); Actor_SetScale(&this->actor, 0.5f);
this->unk_15C = 0.5f; this->scale = 0.5f;
sp34 = 0.0f; yOffset = 0.0f;
sp30 = 0.6f; shadowScale = 0.6f;
this->actor.world.rot.x = 0x4000; this->actor.world.rot.x = 0x4000;
break; break;
case ITEM00_TUNIC_ZORA: case ITEM00_TUNIC_ZORA:
@ -448,18 +452,18 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_CLOTHES); this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_CLOTHES);
Actor_SetObjectDependency(globalCtx, &this->actor); Actor_SetObjectDependency(globalCtx, &this->actor);
Actor_SetScale(&this->actor, 0.5f); Actor_SetScale(&this->actor, 0.5f);
this->unk_15C = 0.5f; this->scale = 0.5f;
sp34 = 0.0f; yOffset = 0.0f;
sp30 = 0.6f; shadowScale = 0.6f;
this->actor.world.rot.x = 0x4000; this->actor.world.rot.x = 0x4000;
break; break;
} }
this->unk_156 = 0; this->unk_156 = 0;
ActorShape_Init(&this->actor.shape, sp34, ActorShadow_DrawCircle, sp30); ActorShape_Init(&this->actor.shape, yOffset, ActorShadow_DrawCircle, shadowScale);
this->actor.shape.shadowAlpha = 180; this->actor.shape.shadowAlpha = 180;
this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos = this->actor.world.pos;
this->unk_152 = 0; this->getItemId = GI_NONE;
if (!spawnParam8000) { if (!spawnParam8000) {
EnItem00_SetupAction(this, func_8001DFC8); EnItem00_SetupAction(this, func_8001DFC8);
@ -540,7 +544,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
break; break;
} }
if ((getItemId != 0) && !Actor_HasParent(&this->actor, globalCtx)) { if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, globalCtx)) {
func_8002F554(&this->actor, globalCtx, getItemId); func_8002F554(&this->actor, globalCtx, getItemId);
} }
@ -561,11 +565,13 @@ void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) {
} 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->unk_15A == -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) {
this->unk_15A = -2; this->unk_15A = -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) {
this->unk_15A = -1; this->unk_15A = -1;
} }
} }
@ -600,17 +606,18 @@ void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) {
void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) { void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) {
f32 originalVelocity; f32 originalVelocity;
Vec3f pos; Vec3f effectPos;
if (this->actor.params <= ITEM00_RUPEE_RED) { if (this->actor.params <= ITEM00_RUPEE_RED) {
this->actor.shape.rot.y += 960; this->actor.shape.rot.y += 960;
} }
if (globalCtx->gameplayFrames & 1) { if (globalCtx->gameplayFrames & 1) {
pos.x = this->actor.world.pos.x + Rand_CenteredFloat(10.0f); effectPos.x = this->actor.world.pos.x + Rand_CenteredFloat(10.0f);
pos.y = this->actor.world.pos.y + Rand_CenteredFloat(10.0f); effectPos.y = this->actor.world.pos.y + Rand_CenteredFloat(10.0f);
pos.z = this->actor.world.pos.z + Rand_CenteredFloat(10.0f); effectPos.z = this->actor.world.pos.z + Rand_CenteredFloat(10.0f);
EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &sEffectPos, &sEffectAccel, &sEffectPrimColor, &sEffectEnvColor); EffectSsKiraKira_SpawnSmall(globalCtx, &effectPos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor,
&sEffectEnvColor);
} }
if (this->actor.bgCheckFlags & 0x0003) { if (this->actor.bgCheckFlags & 0x0003) {
@ -668,7 +675,8 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) {
pos.x = this->actor.world.pos.x + (Rand_ZeroOne() - 0.5f) * 10.0f; pos.x = this->actor.world.pos.x + (Rand_ZeroOne() - 0.5f) * 10.0f;
pos.y = this->actor.world.pos.y + (Rand_ZeroOne() - 0.5f) * 10.0f; pos.y = this->actor.world.pos.y + (Rand_ZeroOne() - 0.5f) * 10.0f;
pos.z = this->actor.world.pos.z + (Rand_ZeroOne() - 0.5f) * 10.0f; pos.z = this->actor.world.pos.z + (Rand_ZeroOne() - 0.5f) * 10.0f;
EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &sEffectPos, &sEffectAccel, &sEffectPrimColor, &sEffectEnvColor); EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor,
&sEffectEnvColor);
} }
if (this->actor.bgCheckFlags & 0x0003) { if (this->actor.bgCheckFlags & 0x0003) {
@ -682,12 +690,12 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) {
void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) { void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) {
Player* player = PLAYER; Player* player = PLAYER;
if (this->unk_152 != 0) { if (this->getItemId != GI_NONE) {
if (!Actor_HasParent(&this->actor, globalCtx)) { if (!Actor_HasParent(&this->actor, globalCtx)) {
func_8002F434(&this->actor, globalCtx, this->unk_152, 50.0f, 80.0f); func_8002F434(&this->actor, globalCtx, this->getItemId, 50.0f, 80.0f);
this->unk_15A++; this->unk_15A++;
} else { } else {
this->unk_152 = 0; this->getItemId = GI_NONE;
} }
} }
@ -711,17 +719,18 @@ void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) {
} }
} }
extern s32 D_80157D90; // The BSS in the function acted weird in the past. It is matching now but might cause issues in the future
extern u32 D_80157D90_; // these must be defined separately for EnItem00_Update to match.
extern s16 D_80157D94;
void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
EnItem00* this = THIS; static u32 D_80157D90;
static s16 D_80157D94[1];
s16* params; s16* params;
s32 getItemId = 0;
s16 sp3A = 0;
Actor* dynaActor; Actor* dynaActor;
s32 getItemId = GI_NONE;
s16 sp3A = 0;
s16 i; s16 i;
u32* temp;
EnItem00* this = THIS;
s32 pad;
if (this->unk_15A > 0) { if (this->unk_15A > 0) {
this->unk_15A--; this->unk_15A--;
@ -732,36 +741,38 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
} }
this->actionFunc(this, globalCtx); this->actionFunc(this, globalCtx);
Math_SmoothStepToF(&this->actor.scale.x, this->scale, 0.1f, this->scale * 0.1f, 0.0f);
temp = &D_80157D90;
Math_SmoothStepToF(&this->actor.scale.x, this->unk_15C, 0.1f, this->unk_15C * 0.1f, 0.0f);
this->actor.scale.z = this->actor.scale.x; this->actor.scale.z = this->actor.scale.x;
this->actor.scale.y = this->actor.scale.x; this->actor.scale.y = this->actor.scale.x;
if (this->actor.gravity) { if (this->actor.gravity) {
if (this->actor.bgCheckFlags & 0x0003) { if (this->actor.bgCheckFlags & 0x0003) {
// Separate symbols seem to be used here for 0x80157D90 since the loads and stores are completely separate if (*temp != globalCtx->gameplayFrames) {
if ((u32)D_80157D90 != globalCtx->gameplayFrames) { D_80157D90 = globalCtx->gameplayFrames;
D_80157D90_ = globalCtx->gameplayFrames; D_80157D94[0] = 0;
D_80157D94 = 0; for (i = 0; i < 50; i++) {
for (i = 0; i < BG_ACTOR_MAX; i++) {
if (globalCtx->colCtx.dyna.bgActorFlags[i] & 1) { if (globalCtx->colCtx.dyna.bgActorFlags[i] & 1) {
dynaActor = globalCtx->colCtx.dyna.bgActors[i].actor; dynaActor = globalCtx->colCtx.dyna.bgActors[i].actor;
if ((dynaActor != NULL) && (dynaActor->update != NULL) && if ((dynaActor != NULL) && (dynaActor->update != NULL)) {
((dynaActor->world.pos.x != dynaActor->prevPos.x) || if ((dynaActor->world.pos.x != dynaActor->prevPos.x) ||
(dynaActor->world.pos.y != dynaActor->prevPos.y) || (dynaActor->world.pos.y != dynaActor->prevPos.y) ||
(dynaActor->world.pos.z != dynaActor->prevPos.z))) { (dynaActor->world.pos.z != dynaActor->prevPos.z)) {
D_80157D94++; D_80157D94[0]++;
break; break;
}
} }
} }
} }
} }
} else { } else {
sp3A = 1; sp3A = 1;
Actor_MoveForward(&this->actor); Actor_MoveForward(&this->actor);
} }
if (sp3A || D_80157D94) { if (sp3A || D_80157D94[0]) {
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 15.0f, 15.0f, 0x1D); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 15.0f, 15.0f, 0x1D);
if (this->actor.floorHeight <= -10000.0f) { if (this->actor.floorHeight <= -10000.0f) {
@ -776,14 +787,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
if ((this->actor.params == ITEM00_SHIELD_DEKU) || (this->actor.params == ITEM00_SHIELD_HYLIAN) || 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)) { (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.yOffset = Math_CosS(this->actor.shape.rot.x) * 37.0f;
this->actor.shape.yOffset = ABS(this->actor.shape.yOffset);
this->actor.shape.yOffset = newUnkBC;
if (newUnkBC >= 0.0f) {
this->actor.shape.yOffset = this->actor.shape.yOffset;
} else {
this->actor.shape.yOffset = -this->actor.shape.yOffset;
}
} }
if (this->unk_154 > 0) { if (this->unk_154 > 0) {
@ -881,7 +886,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
params = &this->actor.params; params = &this->actor.params;
if ((getItemId != 0) && !Actor_HasParent(&this->actor, globalCtx)) { if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, globalCtx)) {
func_8002F554(&this->actor, globalCtx, getItemId); func_8002F554(&this->actor, globalCtx, getItemId);
} }
@ -902,7 +907,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
if ((*params <= ITEM00_RUPEE_RED) || (*params == ITEM00_RUPEE_ORANGE)) { if ((*params <= ITEM00_RUPEE_RED) || (*params == ITEM00_RUPEE_ORANGE)) {
Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
} else if (getItemId != 0) { } else if (getItemId != GI_NONE) {
if (Actor_HasParent(&this->actor, globalCtx)) { if (Actor_HasParent(&this->actor, globalCtx)) {
Flags_SetCollectible(globalCtx, this->collectibleFlag); Flags_SetCollectible(globalCtx, this->collectibleFlag);
Actor_Kill(&this->actor); Actor_Kill(&this->actor);
@ -921,21 +926,15 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
this->actor.velocity.y = 0; this->actor.velocity.y = 0;
this->actor.gravity = 0; this->actor.gravity = 0;
Actor_SetScale(&this->actor, this->unk_15C); Actor_SetScale(&this->actor, this->scale);
this->unk_152 = 0; this->getItemId = GI_NONE;
EnItem00_SetupAction(this, func_8001E5C8); EnItem00_SetupAction(this, func_8001E5C8);
} }
// 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 EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnItem00* this = THIS; EnItem00* this = THIS;
f32 unkFloat; f32 mtxScale;
if (!(this->unk_156 & this->unk_158)) { if (!(this->unk_156 & this->unk_158)) {
switch (this->actor.params) { switch (this->actor.params) {
@ -944,13 +943,13 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
case ITEM00_RUPEE_RED: case ITEM00_RUPEE_RED:
case ITEM00_RUPEE_ORANGE: case ITEM00_RUPEE_ORANGE:
case ITEM00_RUPEE_PURPLE: case ITEM00_RUPEE_PURPLE:
func_8001EF30(this, globalCtx); EnItem00_DrawRupee(this, globalCtx);
break; break;
case ITEM00_HEART_PIECE: case ITEM00_HEART_PIECE:
func_8001F334(this, globalCtx); EnItem00_DrawHeartPiece(this, globalCtx);
break; break;
case ITEM00_HEART_CONTAINER: case ITEM00_HEART_CONTAINER:
func_8001F1F4(this, globalCtx); EnItem00_DrawHeartContainer(this, globalCtx);
break; break;
case ITEM00_HEART: case ITEM00_HEART:
if (this->unk_15A < 0) { if (this->unk_15A < 0) {
@ -962,8 +961,8 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->unk_15A = -2; this->unk_15A = -2;
} }
} else { } else {
unkFloat = 16.0f; mtxScale = 16.0f;
Matrix_Scale(unkFloat, unkFloat, unkFloat, MTXMODE_APPLY); Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(globalCtx, GID_HEART); GetItem_Draw(globalCtx, GID_HEART);
} }
break; break;
@ -981,7 +980,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
case ITEM00_MAGIC_SMALL: case ITEM00_MAGIC_SMALL:
case ITEM00_SEEDS: case ITEM00_SEEDS:
case ITEM00_SMALL_KEY: case ITEM00_SMALL_KEY:
func_8001F080(this, globalCtx); EnItem00_DrawCollectible(this, globalCtx);
break; break;
case ITEM00_SHIELD_DEKU: case ITEM00_SHIELD_DEKU:
GetItem_Draw(globalCtx, GID_SHIELD_DEKU); GetItem_Draw(globalCtx, GID_SHIELD_DEKU);
@ -1004,9 +1003,9 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
/** /**
* Draw Function used for Rupee types of En_Item00. * Draw Function used for Rupee types of En_Item00.
*/ */
void func_8001EF30(EnItem00* this, GlobalContext* globalCtx) { void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx) {
s32 pad; s32 pad;
s32 iconNb; s32 texIndex;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1546); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1546);
@ -1014,16 +1013,15 @@ void func_8001EF30(EnItem00* this, GlobalContext* globalCtx) {
func_8002EBCC(&this->actor, globalCtx, 0); func_8002EBCC(&this->actor, globalCtx, 0);
if (this->actor.params <= ITEM00_RUPEE_RED) { if (this->actor.params <= ITEM00_RUPEE_RED) {
iconNb = this->actor.params; texIndex = this->actor.params;
} else { } else {
iconNb = this->actor.params - 0x10; texIndex = this->actor.params - 0x10;
} }
if (1) {} // Necessary to match
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1562), gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1562),
G_MTX_MODELVIEW | G_MTX_LOAD); G_MTX_MODELVIEW | G_MTX_LOAD);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sRupeeTex[iconNb])); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sRupeeTex[texIndex]));
gSPDisplayList(POLY_OPA_DISP++, &gRupeeDL); gSPDisplayList(POLY_OPA_DISP++, &gRupeeDL);
@ -1033,22 +1031,22 @@ void func_8001EF30(EnItem00* this, GlobalContext* globalCtx) {
/** /**
* Draw Function used for most collectible types of En_Item00 (ammo, bombs, sticks, nuts, magic...). * Draw Function used for most collectible types of En_Item00 (ammo, bombs, sticks, nuts, magic...).
*/ */
void func_8001F080(EnItem00* this, GlobalContext* globalCtx) { void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx) {
s32 iconNb = this->actor.params - 3; s32 texIndex = this->actor.params - 3;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1594); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1594);
POLY_OPA_DISP = func_800BC8A0(globalCtx, POLY_OPA_DISP); POLY_OPA_DISP = func_800BC8A0(globalCtx, POLY_OPA_DISP);
if (this->actor.params == ITEM00_BOMBS_SPECIAL) { if (this->actor.params == ITEM00_BOMBS_SPECIAL) {
iconNb = 1; texIndex = 1;
} else if (this->actor.params >= ITEM00_ARROWS_SMALL) { } else if (this->actor.params >= ITEM00_ARROWS_SMALL) {
iconNb -= 3; texIndex -= 3;
} }
POLY_OPA_DISP = func_800946E4(POLY_OPA_DISP); POLY_OPA_DISP = func_800946E4(POLY_OPA_DISP);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sItemDropTex[iconNb])); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sItemDropTex[texIndex]));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1607), gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1607),
G_MTX_MODELVIEW | G_MTX_LOAD); G_MTX_MODELVIEW | G_MTX_LOAD);
@ -1060,7 +1058,7 @@ void func_8001F080(EnItem00* this, GlobalContext* globalCtx) {
/** /**
* Draw Function used for the Heart Container type of En_Item00. * Draw Function used for the Heart Container type of En_Item00.
*/ */
void func_8001F1F4(EnItem00* this, GlobalContext* globalCtx) { void EnItem00_DrawHeartContainer(EnItem00* this, GlobalContext* globalCtx) {
s32 pad; s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1623); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1623);
@ -1083,7 +1081,7 @@ void func_8001F1F4(EnItem00* this, GlobalContext* globalCtx) {
/** /**
* Draw Function used for the Piece of Heart type of En_Item00. * Draw Function used for the Piece of Heart type of En_Item00.
*/ */
void func_8001F334(EnItem00* this, GlobalContext* globalCtx) { void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx) {
s32 pad; s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1658); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1658);
@ -1173,7 +1171,6 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 pa
} }
} }
} }
return spawnedActor; return spawnedActor;
} }