1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-25 01:34:18 +00:00

Minor en_changer and en_bom_bowl_man documentation update (#2272)

* minor en_changer documentation update

* rename EnChanger->chestOpened to selectedChest, formatting

* update asm comment on EnChanger_OpenChests

* use EnExItemType enum instead of EXITEM_COUNTER define
This commit is contained in:
mracsys 2024-10-12 23:52:55 -04:00 committed by GitHub
parent eee7ba9bd5
commit b275588728
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 19 deletions

View file

@ -417,7 +417,7 @@ void EnBomBowlMan_ChooseShowPrize(EnBomBowlMan* this, PlayState* play) {
this->exItem = (EnExItem*)Actor_SpawnAsChild(
&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, sPrizePosOffset[this->prizeIndex].x + 148.0f,
sPrizePosOffset[this->prizeIndex].y + 40.0f, sPrizePosOffset[this->prizeIndex].z + 300.0f, 0,
sPrizeRot[this->prizeIndex], 0, this->prizeIndex + EXITEM_COUNTER);
sPrizeRot[this->prizeIndex], 0, this->prizeIndex + EXITEM_BOMB_BAG_COUNTER);
if (!this->startedPlaying) {
this->bowlPit = (EnBomBowlPit*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play,

View file

@ -204,7 +204,7 @@ void EnChanger_Wait(EnChanger* this, PlayState* play) {
Flags_SetTreasure(play, this->rightChestNum & 0x1F);
this->actionFunc = EnChanger_OpenChests;
} else if (this->rightChest->unk_1F4 != 0) {
this->chestOpened = CHEST_RIGHT;
this->selectedChest = CHEST_RIGHT;
this->timer = 80;
Flags_SetTreasure(play, this->leftChestNum & 0x1F);
this->actionFunc = EnChanger_OpenChests;
@ -216,8 +216,8 @@ void EnChanger_OpenChests(EnChanger* this, PlayState* play) {
f32 zPos;
f32 yPos;
f32 xPos;
s16 temp_s0;
s16 temp_s0_2;
s16 selectedChest;
s16 unopenedChestItemType;
EnBox* left;
EnBox* right;
@ -225,22 +225,26 @@ void EnChanger_OpenChests(EnChanger* this, PlayState* play) {
right = this->rightChest;
if (this->timer == 0) {
temp_s0_2 = temp_s0 = this->chestOpened; // Required to use the right registers
// `unopenedChestItemType` being set here is required for matching, but doesn't do anything useful
unopenedChestItemType = selectedChest = this->selectedChest;
switch (temp_s0_2) {
switch (selectedChest) {
case CHEST_LEFT:
xPos = right->dyna.actor.world.pos.x;
yPos = right->dyna.actor.world.pos.y;
zPos = right->dyna.actor.world.pos.z;
if (this->rightChestGetItemId == GI_DOOR_KEY) {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, 0xF);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0,
EXITEM_SMALL_KEY_CHEST);
Flags_SetSwitch(play, 0x32);
} else {
temp_s0_2 = (s16)(this->rightChestGetItemId - GI_RUPEE_GREEN_LOSE) + EXITEM_CHEST;
unopenedChestItemType =
(s16)(this->rightChestGetItemId - GI_RUPEE_GREEN_LOSE) + EXITEM_GREEN_RUPEE_CHEST;
// "Open right treasure (chest)"
PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 右宝開く ☆☆☆☆☆ %d\n" VT_RST, temp_s0_2);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, temp_s0_2);
PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 右宝開く ☆☆☆☆☆ %d\n" VT_RST, unopenedChestItemType);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0,
unopenedChestItemType);
}
break;
case CHEST_RIGHT:
@ -249,13 +253,16 @@ void EnChanger_OpenChests(EnChanger* this, PlayState* play) {
zPos = left->dyna.actor.world.pos.z;
if (this->leftChestGetItemId == GI_DOOR_KEY) {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, 0xF);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0,
EXITEM_SMALL_KEY_CHEST);
Flags_SetSwitch(play, 0x32);
} else {
temp_s0_2 = (s16)(this->leftChestGetItemId - 0x72) + 0xA;
unopenedChestItemType =
(s16)(this->leftChestGetItemId - GI_RUPEE_GREEN_LOSE) + EXITEM_GREEN_RUPEE_CHEST;
// "Open left treasure (chest)"
PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 左宝開く ☆☆☆☆☆ %d\n" VT_RST, temp_s0_2);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, temp_s0_2);
PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 左宝開く ☆☆☆☆☆ %d\n" VT_RST, unopenedChestItemType);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0,
unopenedChestItemType);
}
break;
}

View file

@ -19,7 +19,7 @@ typedef struct EnChanger {
/* 0x015E */ s16 rightChestNum;
/* 0x0160 */ s16 leftChestGetItemId;
/* 0x0162 */ s16 rightChestGetItemId;
/* 0x0164 */ s16 chestOpened;
/* 0x0164 */ s16 selectedChest;
/* 0x0166 */ s16 timer;
/* 0x0168 */ s16 roomChestsOpened;
} EnChanger; // size = 0x016C

View file

@ -52,8 +52,4 @@ typedef enum EnExItemType {
/* 19 */ EXITEM_BULLET_BAG
} EnExItemType;
#define EXITEM_COUNTER 5
#define EXITEM_CHEST 10
#define EXITEM_MAGIC 16
#endif