diff --git a/assets/xml/objects/object_cne.xml b/assets/xml/objects/object_cne.xml
index a4c8b28e2c..135aae7a20 100644
--- a/assets/xml/objects/object_cne.xml
+++ b/assets/xml/objects/object_cne.xml
@@ -38,12 +38,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/assets/xml/objects/object_trt.xml b/assets/xml/objects/object_trt.xml
index c7fb813214..826aa1ef07 100644
--- a/assets/xml/objects/object_trt.xml
+++ b/assets/xml/objects/object_trt.xml
@@ -1,94 +1,106 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c
index fe7a91667e..0c00c60404 100644
--- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c
+++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c
@@ -261,26 +261,26 @@ u8 EnFsn_SetCursorIndexFromNeutral(EnFsn* this) {
}
void EnFsn_CursorLeftRight(EnFsn* this) {
- u8 cursorScan = this->cursorIdx;
+ u8 cursorScan = this->cursorIndex;
if (this->stickAccumX > 0) {
if (cursorScan != this->totalSellingItems - 1) {
while (cursorScan != this->totalSellingItems - 1) {
cursorScan++;
if (this->itemIds[cursorScan] != -1) {
- this->cursorIdx = cursorScan;
+ this->cursorIndex = cursorScan;
break;
}
}
} else if (this->itemIds[cursorScan] != -1) {
- this->cursorIdx = cursorScan;
+ this->cursorIndex = cursorScan;
}
} else if (this->stickAccumX < 0) {
if (cursorScan != 0) {
while (cursorScan != 0) {
cursorScan--;
if (this->itemIds[cursorScan] != -1) {
- this->cursorIdx = cursorScan;
+ this->cursorIndex = cursorScan;
break;
} else if (cursorScan == 0) {
play_sound(NA_SE_SY_CURSOR);
@@ -294,7 +294,7 @@ void EnFsn_CursorLeftRight(EnFsn* this) {
this->drawCursor = 0;
this->actionFunc = EnFsn_LookToShopkeeperFromShelf;
if (this->itemIds[cursorScan] != -1) {
- this->cursorIdx = cursorScan;
+ this->cursorIndex = cursorScan;
}
}
}
@@ -417,7 +417,7 @@ s32 EnFsn_TestEndInteraction(EnFsn* this, PlayState* play, Input* input) {
s32 EnFsn_TestCancelOption(EnFsn* this, PlayState* play, Input* input) {
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
this->actionFunc = this->prevActionFunc;
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
return true;
}
return false;
@@ -429,7 +429,7 @@ void EnFsn_UpdateCursorPos(EnFsn* this, PlayState* play) {
f32 xOffset = 0.0f;
f32 yOffset = 17.0f;
- Actor_GetScreenPos(play, &this->items[this->cursorIdx]->actor, &x, &y);
+ Actor_GetScreenPos(play, &this->items[this->cursorIndex]->actor, &x, &y);
this->cursorPos.x = x + xOffset;
this->cursorPos.y = y + yOffset;
this->cursorPos.z = 1.2f;
@@ -466,9 +466,9 @@ s32 EnFsn_HasPlayerSelectedItem(EnFsn* this, PlayState* play, Input* input) {
return true;
}
if (EnFsn_TestItemSelected(play)) {
- if (!this->items[this->cursorIdx]->isOutOfStock) {
+ if (!this->items[this->cursorIndex]->isOutOfStock) {
this->prevActionFunc = this->actionFunc;
- func_80151938(play, this->items[this->cursorIdx]->choiceTextId);
+ func_80151938(play, this->items[this->cursorIndex]->choiceTextId);
play_sound(NA_SE_SY_DECIDE);
this->stickLeftPrompt.isEnabled = false;
this->stickRightPrompt.isEnabled = false;
@@ -522,7 +522,7 @@ void EnFsn_UpdateJoystickInputState(EnFsn* this, PlayState* play) {
void EnFsn_PositionSelectedItem(EnFsn* this) {
Vec3f selectedItemPosition = { 13.0f, 38.0f, -71.0f };
- u8 i = this->cursorIdx;
+ u8 i = this->cursorIndex;
EnGirlA* item = this->items[i];
Vec3f worldPos;
@@ -572,7 +572,7 @@ void EnFsn_UpdateItemSelectedProperty(EnFsn* this) {
this->drawCursor == 0) {
(*items)->isSelected = false;
} else {
- (*items)->isSelected = (i == this->cursorIdx) ? true : false;
+ (*items)->isSelected = (i == this->cursorIndex) ? true : false;
}
}
}
@@ -712,7 +712,7 @@ void EnFsn_InitShop(EnFsn* this, PlayState* play) {
}
this->blinkTimer = 20;
this->animIndex = FSN_ANIM_HANDS_ON_COUNTER_START;
- this->eyeTextureIdx = 0;
+ this->eyeTexIndex = 0;
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex);
this->actionFunc = EnFsn_Idle;
}
@@ -995,7 +995,7 @@ void EnFsn_MakeOffer(EnFsn* this, PlayState* play) {
void EnFsn_GiveItem(EnFsn* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
- if ((this->isSelling == true) && (this->items[this->cursorIdx]->getItemId == GI_MASK_ALL_NIGHT)) {
+ if ((this->isSelling == true) && (this->items[this->cursorIndex]->getItemId == GI_MASK_ALL_NIGHT)) {
func_80151BB4(play, 45);
func_80151BB4(play, 3);
}
@@ -1005,7 +1005,7 @@ void EnFsn_GiveItem(EnFsn* this, PlayState* play) {
}
this->actionFunc = EnFsn_SetupResumeInteraction;
} else if (this->isSelling == true) {
- Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f);
+ Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f);
} else {
Actor_PickUp(&this->actor, play, this->getItemId, 300.0f, 300.0f);
}
@@ -1086,7 +1086,7 @@ void EnFsn_LookToShelf(EnFsn* this, PlayState* play) {
this->cutsceneState = ENFSN_CUTSCENESTATE_PLAYING;
EnFsn_UpdateCursorPos(this, play);
this->actionFunc = EnFsn_BrowseShelf;
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
} else {
ActorCutscene_SetIntentToPlay(this->cutscene);
}
@@ -1096,7 +1096,7 @@ void EnFsn_LookToShelf(EnFsn* this, PlayState* play) {
void EnFsn_BrowseShelf(EnFsn* this, PlayState* play) {
u8 talkstate = Message_GetState(&play->msgCtx);
s32 pad;
- u8 prevCursorIdx = this->cursorIdx;
+ u8 prevCursorIdx = this->cursorIndex;
if (!EnFsn_ReturnItemToShelf(this)) {
this->delayTimer = 3;
@@ -1110,9 +1110,9 @@ void EnFsn_BrowseShelf(EnFsn* this, PlayState* play) {
func_8011552C(play, 6);
if (!EnFsn_HasPlayerSelectedItem(this, play, CONTROLLER1(&play->state))) {
EnFsn_CursorLeftRight(this);
- if (this->cursorIdx != prevCursorIdx) {
+ if (this->cursorIndex != prevCursorIdx) {
play_sound(NA_SE_SY_CURSOR);
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
}
}
}
@@ -1144,7 +1144,7 @@ void EnFsn_LookToShopkeeperFromShelf(EnFsn* this, PlayState* play) {
}
void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, PlayState* play) {
- EnGirlA* item = this->items[this->cursorIdx];
+ EnGirlA* item = this->items[this->cursorIndex];
switch (item->canBuyFunc(play, item)) {
case CANBUY_RESULT_SUCCESS_2:
@@ -1156,23 +1156,23 @@ void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, PlayState* play) {
this->cutsceneState = ENFSN_CUTSCENESTATE_STOPPED;
}
func_8019F208();
- item = this->items[this->cursorIdx];
+ item = this->items[this->cursorIndex];
item->buyFanfareFunc(play, item);
- Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f);
+ Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f);
play->msgCtx.msgMode = 0x43;
play->msgCtx.stateTimer = 4;
Interface_ChangeAlpha(50);
this->drawCursor = 0;
this->shopItemSelectedTween = 0.0f;
- item = this->items[this->cursorIdx];
+ item = this->items[this->cursorIndex];
item->boughtFunc(play, item);
- if (this->stolenItem1 == this->cursorIdx) {
+ if (this->stolenItem1 == this->cursorIndex) {
SET_STOLEN_ITEM_1(STOLEN_ITEM_NONE);
- } else if (this->stolenItem2 == this->cursorIdx) {
+ } else if (this->stolenItem2 == this->cursorIndex) {
SET_STOLEN_ITEM_2(STOLEN_ITEM_NONE);
}
this->numSellingItems--;
- this->itemIds[this->cursorIdx] = -1;
+ this->itemIds[this->cursorIndex] = -1;
this->actionFunc = EnFsn_GiveItem;
break;
case CANBUY_RESULT_NEED_RUPEES:
@@ -1218,7 +1218,7 @@ void EnFsn_SelectItem(EnFsn* this, PlayState* play) {
case 1:
func_8019F230();
this->actionFunc = this->prevActionFunc;
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
}
}
}
@@ -1227,7 +1227,7 @@ void EnFsn_SelectItem(EnFsn* this, PlayState* play) {
void EnFsn_PlayerCannotBuy(EnFsn* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
this->actionFunc = this->prevActionFunc;
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
}
}
@@ -1326,16 +1326,16 @@ void EnFsn_AskCanBuyAterRunningOutOfItems(EnFsn* this, PlayState* play) {
void EnFsn_FaceShopkeeperSelling(EnFsn* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
- u8 cursorIdx;
+ u8 cursorIndex;
if (talkState == TEXT_STATE_CHOICE) {
func_8011552C(play, 6);
if (!EnFsn_TestEndInteraction(this, play, CONTROLLER1(&play->state)) &&
(!Message_ShouldAdvance(play) || !EnFsn_FacingShopkeeperDialogResult(this, play)) &&
this->stickAccumX > 0) {
- cursorIdx = EnFsn_SetCursorIndexFromNeutral(this);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnFsn_SetCursorIndexFromNeutral(this);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
this->actionFunc = EnFsn_LookToShelf;
func_8011552C(play, 6);
this->stickRightPrompt.isEnabled = false;
@@ -1394,13 +1394,13 @@ void EnFsn_Blink(EnFsn* this) {
s16 decr = this->blinkTimer - 1;
if (decr >= 3) {
- this->eyeTextureIdx = 0;
+ this->eyeTexIndex = 0;
this->blinkTimer = decr;
} else if (decr == 0) {
- this->eyeTextureIdx = 2;
+ this->eyeTexIndex = 2;
this->blinkTimer = (s32)(Rand_ZeroOne() * 60.0f) + 20;
} else {
- this->eyeTextureIdx = 1;
+ this->eyeTexIndex = 1;
this->blinkTimer = decr;
}
}
@@ -1427,7 +1427,7 @@ void EnFsn_Init(Actor* thisx, PlayState* play) {
Collider_InitCylinder(play, &this->collider);
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->blinkTimer = 20;
- this->eyeTextureIdx = 0;
+ this->eyeTexIndex = 0;
this->actor.flags |= ACTOR_FLAG_1;
this->actor.targetMode = 0;
this->animIndex = FSN_ANIM_IDLE;
@@ -1472,6 +1472,7 @@ void EnFsn_DrawCursor(EnFsn* this, PlayState* play, f32 x, f32 y, f32 z, u8 draw
s32 pad;
OPEN_DISPS(play->state.gfxCtx);
+
if (drawCursor != 0) {
func_8012C654(play->state.gfxCtx);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColor.r, this->cursorColor.g, this->cursorColor.b,
@@ -1486,6 +1487,7 @@ void EnFsn_DrawCursor(EnFsn* this, PlayState* play, f32 x, f32 y, f32 z, u8 draw
dsdx = (1.0f / z) * 1024.0f;
gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, 0, 0, dsdx, dsdx);
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1501,6 +1503,7 @@ void EnFsn_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32 y
s32 dtdy;
OPEN_DISPS(play->state.gfxCtx);
+
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, r, g, b, a);
@@ -1517,6 +1520,7 @@ void EnFsn_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32 y
dtdy = dy * unk;
gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, s, t, dsdx, dtdy);
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1525,6 +1529,7 @@ void EnFsn_DrawStickDirectionPrompts(EnFsn* this, PlayState* play) {
s32 drawStickLeftPrompt = this->stickRightPrompt.isEnabled;
OPEN_DISPS(play->state.gfxCtx);
+
if (drawStickRightPrompt || drawStickLeftPrompt) {
func_8012C654(play->state.gfxCtx);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
@@ -1559,6 +1564,7 @@ void EnFsn_DrawStickDirectionPrompts(EnFsn* this, PlayState* play) {
this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f);
}
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1604,8 +1610,10 @@ void EnFsn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
this->actor.focus.pos.z = this->actor.world.pos.z;
OPEN_DISPS(play->state.gfxCtx);
+
gSPDisplayList(POLY_OPA_DISP++, gFsnGlassesFrameDL);
gSPDisplayList(POLY_OPA_DISP++, gFsnGlassesLensesDL);
+
CLOSE_DISPS(play->state.gfxCtx);
}
}
@@ -1617,9 +1625,10 @@ void EnFsn_Draw(Actor* thisx, PlayState* play) {
s16 i;
OPEN_DISPS(play->state.gfxCtx);
+
func_8012C5B0(play->state.gfxCtx);
- gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTextureIdx]));
- gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTextureIdx]));
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
+ gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnFsn_OverrideLimbDraw, EnFsn_PostLimbDraw, &this->actor);
@@ -1631,5 +1640,6 @@ void EnFsn_Draw(Actor* thisx, PlayState* play) {
EnFsn_DrawCursor(this, play, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnFsn_DrawStickDirectionPrompts(this, play);
+
CLOSE_DISPS(play->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h
index 9479e982ea..6bf337be73 100644
--- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h
+++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h
@@ -30,7 +30,7 @@ typedef struct EnFsn {
/* 0x27A */ Vec3s unk27A; // Set but never used
/* 0x280 */ Vec3s jointTable[FSN_LIMB_MAX + 1]; // Note: adding 1 to FSN_LIMB_MAX due to bug in object_fsn, see bug in object_fsn.xml
/* 0x2F2 */ Vec3s morphTable[FSN_LIMB_MAX + 1];
- /* 0x364 */ s16 eyeTextureIdx;
+ /* 0x364 */ s16 eyeTexIndex;
/* 0x366 */ s16 blinkTimer;
/* 0x368 */ s16 cutsceneState;
/* 0x36A */ s16 cutscene;
@@ -41,7 +41,7 @@ typedef struct EnFsn {
/* 0x374 */ s16 price;
/* 0x376 */ u16 textId;
/* 0x378 */ u8 isSelling;
- /* 0x379 */ u8 cursorIdx;
+ /* 0x379 */ u8 cursorIndex;
/* 0x37C */ s32 getItemId;
/* 0x380 */ s16 stolenItem1;
/* 0x382 */ s16 stolenItem2;
diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c
index fc5a2a724a..ef46c5e816 100644
--- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c
+++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c
@@ -291,7 +291,7 @@ void EnOssan_UpdateCursorPos(PlayState* play, EnOssan* this) {
s16 x;
s16 y;
- Actor_GetScreenPos(play, &this->items[this->cursorIdx]->actor, &x, &y);
+ Actor_GetScreenPos(play, &this->items[this->cursorIndex]->actor, &x, &y);
this->cursorPos.x = x;
this->cursorPos.y = y;
}
@@ -332,7 +332,7 @@ s32 EnOssan_TestEndInteraction(EnOssan* this, PlayState* play, Input* input) {
s32 EnOssan_TestCancelOption(EnOssan* this, PlayState* play, Input* input) {
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
this->actionFunc = this->prevActionFunc;
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
return true;
}
return false;
@@ -500,7 +500,7 @@ u8 EnOssan_SetCursorIndexFromNeutral(EnOssan* this, u8 shelfOffset) {
u8 i;
// if cursor is on the top shelf
- if (this->cursorIdx & 1) {
+ if (this->cursorIndex & 1) {
// scan top shelf
for (i = shelfOffset + 1; i < shelfOffset + 4; i += 2) {
if (this->items[i] != NULL) {
@@ -530,26 +530,26 @@ u8 EnOssan_SetCursorIndexFromNeutral(EnOssan* this, u8 shelfOffset) {
return CURSOR_INVALID;
}
-u8 EnOssan_CursorRight(EnOssan* this, u8 cursorIdx, u8 shelfSlotMin) {
+u8 EnOssan_CursorRight(EnOssan* this, u8 cursorIndex, u8 shelfSlotMin) {
u8 end = shelfSlotMin + 4;
- while (cursorIdx >= shelfSlotMin && cursorIdx < end) {
- cursorIdx -= 2;
- if (cursorIdx >= shelfSlotMin && cursorIdx < end) {
- if (this->items[cursorIdx] != NULL) {
- return cursorIdx;
+ while (cursorIndex >= shelfSlotMin && cursorIndex < end) {
+ cursorIndex -= 2;
+ if (cursorIndex >= shelfSlotMin && cursorIndex < end) {
+ if (this->items[cursorIndex] != NULL) {
+ return cursorIndex;
}
}
}
return CURSOR_INVALID;
}
-u8 EnOssan_CursorLeft(EnOssan* this, u8 cursorIdx, u8 shelfSlotMax) {
- while (cursorIdx < shelfSlotMax) {
- cursorIdx += 2;
- if (cursorIdx < shelfSlotMax) {
- if (this->items[cursorIdx] != NULL) {
- return cursorIdx;
+u8 EnOssan_CursorLeft(EnOssan* this, u8 cursorIndex, u8 shelfSlotMax) {
+ while (cursorIndex < shelfSlotMax) {
+ cursorIndex += 2;
+ if (cursorIndex < shelfSlotMax) {
+ if (this->items[cursorIndex] != NULL) {
+ return cursorIndex;
}
}
}
@@ -619,7 +619,7 @@ void EnOssan_FaceShopkeeper(EnOssan* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
s32 pad;
Player* player = GET_PLAYER(play);
- u8 cursorIdx;
+ u8 cursorIndex;
if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) {
if (ActorCutscene_GetCurrentIndex() == 0x7C) {
@@ -634,18 +634,18 @@ void EnOssan_FaceShopkeeper(EnOssan* this, PlayState* play) {
if (!EnOssan_TestEndInteraction(this, play, CONTROLLER1(&play->state)) &&
(!Message_ShouldAdvance(play) || !EnOssan_FacingShopkeeperDialogResult(this, play))) {
if (this->stickAccumX < 0) {
- cursorIdx = EnOssan_SetCursorIndexFromNeutral(this, 4);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_SetCursorIndexFromNeutral(this, 4);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
EnOssan_SetupAction(this, EnOssan_LookToLeftShelf);
func_8011552C(play, 6);
this->stickLeftPrompt.isEnabled = false;
play_sound(NA_SE_SY_CURSOR);
}
} else if (this->stickAccumX > 0) {
- cursorIdx = EnOssan_SetCursorIndexFromNeutral(this, 0);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_SetCursorIndexFromNeutral(this, 0);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
EnOssan_SetupAction(this, EnOssan_LookToRightShelf);
func_8011552C(play, 6);
this->stickRightPrompt.isEnabled = false;
@@ -693,7 +693,7 @@ void EnOssan_LookToLeftShelf(EnOssan* this, PlayState* play) {
this->cutsceneState = ENOSSAN_CUTSCENESTATE_PLAYING;
EnOssan_UpdateCursorPos(play, this);
EnOssan_SetupAction(this, EnOssan_BrowseLeftShelf);
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
} else {
ActorCutscene_SetIntentToPlay(this->cutscene);
}
@@ -721,7 +721,7 @@ void EnOssan_LookToRightShelf(EnOssan* this, PlayState* play) {
this->cutsceneState = ENOSSAN_CUTSCENESTATE_PLAYING;
EnOssan_UpdateCursorPos(play, this);
EnOssan_SetupAction(this, EnOssan_BrowseRightShelf);
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
} else {
ActorCutscene_SetIntentToPlay(this->cutscene);
}
@@ -731,16 +731,16 @@ void EnOssan_LookToRightShelf(EnOssan* this, PlayState* play) {
}
void EnOssan_CursorUpDown(EnOssan* this) {
- u8 curTemp = this->cursorIdx;
+ u8 curTemp = this->cursorIndex;
u8 curScanTemp;
if (this->stickAccumY < 0) {
curTemp &= (u8)~1;
if (this->items[curTemp] != NULL) {
- this->cursorIdx = curTemp;
+ this->cursorIndex = curTemp;
return;
}
- // cursorIdx on right shelf
+ // cursorIndex on right shelf
if (curTemp < 4) {
curScanTemp = curTemp + 2;
if (curScanTemp >= 4) {
@@ -748,7 +748,7 @@ void EnOssan_CursorUpDown(EnOssan* this) {
}
while (curScanTemp != curTemp) {
if (this->items[curScanTemp] != NULL) {
- this->cursorIdx = curScanTemp;
+ this->cursorIndex = curScanTemp;
return;
}
curScanTemp += 2;
@@ -757,14 +757,14 @@ void EnOssan_CursorUpDown(EnOssan* this) {
}
}
} else {
- // cursorIdx on left shelf
+ // cursorIndex on left shelf
curScanTemp = curTemp + 2;
if (curScanTemp >= 8) {
curScanTemp = 4;
}
while (curScanTemp != curTemp) {
if (this->items[curScanTemp] != NULL) {
- this->cursorIdx = curScanTemp;
+ this->cursorIndex = curScanTemp;
return;
}
curScanTemp += 2;
@@ -776,10 +776,10 @@ void EnOssan_CursorUpDown(EnOssan* this) {
} else if (this->stickAccumY > 0) {
curTemp |= 1;
if (this->items[curTemp] != NULL) {
- this->cursorIdx = curTemp;
+ this->cursorIndex = curTemp;
return;
}
- // cursorIdx on right shelf
+ // cursorIndex on right shelf
if (curTemp < 4) {
curScanTemp = curTemp + 2;
if (curScanTemp >= 4) {
@@ -787,7 +787,7 @@ void EnOssan_CursorUpDown(EnOssan* this) {
}
while (curScanTemp != curTemp) {
if (this->items[curScanTemp] != NULL) {
- this->cursorIdx = curScanTemp;
+ this->cursorIndex = curScanTemp;
return;
}
curScanTemp += 2;
@@ -796,14 +796,14 @@ void EnOssan_CursorUpDown(EnOssan* this) {
}
}
} else {
- // cursorIdx on left shelf
+ // cursorIndex on left shelf
curScanTemp = curTemp + 2;
if (curScanTemp >= 8) {
curScanTemp = 5;
}
while (curScanTemp != curTemp) {
if (this->items[curScanTemp] != NULL) {
- this->cursorIdx = curScanTemp;
+ this->cursorIndex = curScanTemp;
return;
}
curScanTemp += 2;
@@ -816,7 +816,7 @@ void EnOssan_CursorUpDown(EnOssan* this) {
}
s32 EnOssan_HasPlayerSelectedItem(PlayState* play, EnOssan* this, Input* input) {
- EnGirlA* item = this->items[this->cursorIdx];
+ EnGirlA* item = this->items[this->cursorIndex];
if (EnOssan_TestEndInteraction(this, play, input)) {
return true;
@@ -824,7 +824,7 @@ s32 EnOssan_HasPlayerSelectedItem(PlayState* play, EnOssan* this, Input* input)
if (EnOssan_TestItemSelected(play)) {
if (!item->isOutOfStock) {
this->prevActionFunc = this->actionFunc;
- func_80151938(play, this->items[this->cursorIdx]->choiceTextId);
+ func_80151938(play, this->items[this->cursorIndex]->choiceTextId);
this->stickLeftPrompt.isEnabled = false;
this->stickRightPrompt.isEnabled = false;
play_sound(NA_SE_SY_DECIDE);
@@ -841,8 +841,8 @@ s32 EnOssan_HasPlayerSelectedItem(PlayState* play, EnOssan* this, Input* input)
void EnOssan_BrowseLeftShelf(EnOssan* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
s32 pad;
- u8 prevCursorIndex = this->cursorIdx;
- u8 cursorIdx;
+ u8 prevCursorIndex = this->cursorIndex;
+ u8 cursorIndex;
if (!EnOssan_ReturnItemToShelf(this)) {
this->delayTimer = 3;
@@ -857,38 +857,38 @@ void EnOssan_BrowseLeftShelf(EnOssan* this, PlayState* play) {
if (!EnOssan_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) {
if (this->moveHorizontal) {
if (this->stickAccumX > 0) {
- cursorIdx = EnOssan_CursorRight(this, this->cursorIdx, 4);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_CursorRight(this, this->cursorIndex, 4);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
} else {
EnOssan_SetupLookToShopkeeperFromShelf(play, this);
return;
}
} else if (this->stickAccumX < 0) {
- cursorIdx = EnOssan_CursorLeft(this, this->cursorIdx, 8);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_CursorLeft(this, this->cursorIndex, 8);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
}
}
} else {
if (this->stickAccumX > 0 && this->stickAccumX > 500) {
- cursorIdx = EnOssan_CursorRight(this, this->cursorIdx, 4);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_CursorRight(this, this->cursorIndex, 4);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
} else {
EnOssan_SetupLookToShopkeeperFromShelf(play, this);
return;
}
} else if (this->stickAccumX < 0 && this->stickAccumX < -500) {
- cursorIdx = EnOssan_CursorLeft(this, this->cursorIdx, 8);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_CursorLeft(this, this->cursorIndex, 8);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
}
}
}
EnOssan_CursorUpDown(this);
- if (this->cursorIdx != prevCursorIndex) {
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ if (this->cursorIndex != prevCursorIndex) {
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
play_sound(NA_SE_SY_CURSOR);
}
}
@@ -899,8 +899,8 @@ void EnOssan_BrowseLeftShelf(EnOssan* this, PlayState* play) {
void EnOssan_BrowseRightShelf(EnOssan* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
s32 pad;
- u8 prevCursorIndex = this->cursorIdx;
- u8 cursorIdx;
+ u8 prevCursorIndex = this->cursorIndex;
+ u8 cursorIndex;
if (!EnOssan_ReturnItemToShelf(this)) {
this->delayTimer = 3;
@@ -915,38 +915,38 @@ void EnOssan_BrowseRightShelf(EnOssan* this, PlayState* play) {
if (!EnOssan_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) {
if (this->moveHorizontal != 0) {
if (this->stickAccumX < 0) {
- cursorIdx = EnOssan_CursorRight(this, this->cursorIdx, 0);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_CursorRight(this, this->cursorIndex, 0);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
} else {
EnOssan_SetupLookToShopkeeperFromShelf(play, this);
return;
}
} else if (this->stickAccumX > 0) {
- cursorIdx = EnOssan_CursorLeft(this, this->cursorIdx, 4);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_CursorLeft(this, this->cursorIndex, 4);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
}
}
} else {
if (this->stickAccumX < 0 && this->stickAccumX < -500) {
- cursorIdx = EnOssan_CursorRight(this, this->cursorIdx, 0);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_CursorRight(this, this->cursorIndex, 0);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
} else {
EnOssan_SetupLookToShopkeeperFromShelf(play, this);
return;
}
} else if (this->stickAccumX > 0 && this->stickAccumX > 500) {
- cursorIdx = EnOssan_CursorLeft(this, this->cursorIdx, 4);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_CursorLeft(this, this->cursorIndex, 4);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
}
}
}
EnOssan_CursorUpDown(this);
- if (this->cursorIdx != prevCursorIndex) {
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ if (this->cursorIndex != prevCursorIndex) {
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
play_sound(NA_SE_SY_CURSOR);
}
}
@@ -981,7 +981,7 @@ void EnOssan_LookToShopkeeperFromShelf(EnOssan* this, PlayState* play) {
void EnOssan_SetupBuyItemWithFanfare(PlayState* play, EnOssan* this) {
Player* player = GET_PLAYER(play);
- Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f);
+ Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f);
play->msgCtx.msgMode = 0x43;
play->msgCtx.stateTimer = 4;
player->stateFlags2 &= ~0x20000000;
@@ -1001,7 +1001,7 @@ void EnOssan_SetupBuy(PlayState* play, EnOssan* this, u16 textId) {
}
void EnOssan_HandleCanBuyItem(PlayState* play, EnOssan* this) {
- EnGirlA* item = this->items[this->cursorIdx];
+ EnGirlA* item = this->items[this->cursorIndex];
switch (item->canBuyFunc(play, item)) {
case CANBUY_RESULT_SUCCESS_1:
@@ -1061,7 +1061,7 @@ void EnOssan_SelectItem(EnOssan* this, PlayState* play) {
case 1:
func_8019F230();
this->actionFunc = this->prevActionFunc;
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
break;
}
}
@@ -1071,7 +1071,7 @@ void EnOssan_SelectItem(EnOssan* this, PlayState* play) {
void EnOssan_CannotBuy(EnOssan* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
this->actionFunc = this->prevActionFunc;
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
}
}
@@ -1081,10 +1081,10 @@ void EnOssan_CanBuy(EnOssan* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
this->shopItemSelectedTween = 0.0f;
EnOssan_ResetItemPosition(this);
- item = this->items[this->cursorIdx];
+ item = this->items[this->cursorIndex];
item->restockFunc(play, item);
this->actionFunc = this->prevActionFunc;
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
}
}
@@ -1093,7 +1093,7 @@ void EnOssan_BuyItemWithFanfare(EnOssan* this, PlayState* play) {
this->actor.parent = NULL;
EnOssan_SetupAction(this, EnOssan_SetupItemPurchased);
} else {
- Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f);
+ Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f);
}
}
@@ -1122,7 +1122,7 @@ void EnOssan_ContinueShopping(EnOssan* this, PlayState* play) {
func_8011552C(play, 6);
if (Message_ShouldAdvance(play)) {
EnOssan_ResetItemPosition(this);
- item = this->items[this->cursorIdx];
+ item = this->items[this->cursorIndex];
item->restockFunc(play, item);
if (!EnOssan_TestEndInteraction(this, play, CONTROLLER1(&play->state))) {
switch (play->msgCtx.choiceIndex) {
@@ -1144,7 +1144,7 @@ void EnOssan_ContinueShopping(EnOssan* this, PlayState* play) {
}
} else if (talkState == TEXT_STATE_5 && Message_ShouldAdvance(play)) {
EnOssan_ResetItemPosition(this);
- item = this->items[this->cursorIdx];
+ item = this->items[this->cursorIndex];
item->restockFunc(play, item);
player->actor.shape.rot.y = BINANG_ROT180(player->actor.shape.rot.y);
player->stateFlags2 |= 0x20000000;
@@ -1184,7 +1184,7 @@ void EnOssan_PositionSelectedItem(EnOssan* this) {
{ -35.0f, 68.0f, -130.0f },
};
EnGirlA* item;
- u8 i = this->cursorIdx;
+ u8 i = this->cursorIndex;
u8 i2;
ShopItem* shopItem = &sShops[this->actor.params][i];
Vec3f worldPos;
@@ -1245,7 +1245,7 @@ void EnOssan_UpdateItemSelectedProperty(EnOssan* this) {
this->drawCursor == 0) {
item->isSelected = false;
} else {
- item->isSelected = this->cursorIdx == i ? true : false;
+ item->isSelected = this->cursorIndex == i ? true : false;
}
}
}
@@ -1479,7 +1479,7 @@ void EnOssan_InitShop(EnOssan* this, PlayState* play) {
this->actor.colChkInfo.cylRadius = 50;
this->stickAccumX = this->stickAccumY = 0;
- this->cursorIdx = 0;
+ this->cursorIndex = 0;
this->cursorPos.z = 1.5f;
this->cursorColor.r = 0;
this->cursorColor.g = 80;
@@ -1573,6 +1573,7 @@ void EnOssan_DrawCursor(PlayState* play, EnOssan* this, f32 x, f32 y, f32 z, u8
(void)"../z_en_oB1.c";
OPEN_DISPS(play->state.gfxCtx);
+
if (drawCursor != 0) {
func_8012C654(play->state.gfxCtx);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColor.r, this->cursorColor.g, this->cursorColor.b,
@@ -1587,6 +1588,7 @@ void EnOssan_DrawCursor(PlayState* play, EnOssan* this, f32 x, f32 y, f32 z, u8
dsdx = (1.0f / z) * 1024.0f;
gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, 0, 0, dsdx, dsdx);
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1605,6 +1607,7 @@ void EnOssan_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32
(void)"../z_en_oB1.c";
OPEN_DISPS(play->state.gfxCtx);
+
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, r, g, b, a);
@@ -1621,6 +1624,7 @@ void EnOssan_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32
dtdy = dy * unk;
gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, s, t, dsdx, dtdy);
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1631,6 +1635,7 @@ void EnOssan_DrawStickDirectionPrompts(PlayState* play, EnOssan* this) {
(void)"../z_en_oB1.c";
OPEN_DISPS(play->state.gfxCtx);
+
if (drawStickRightPrompt || drawStickLeftPrompt) {
func_8012C654(play->state.gfxCtx);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
@@ -1665,6 +1670,7 @@ void EnOssan_DrawStickDirectionPrompts(PlayState* play, EnOssan* this) {
this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f);
}
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1713,6 +1719,7 @@ void EnOssan_CuriosityShopMan_Draw(Actor* thisx, PlayState* play) {
EnOssan* this = THIS;
OPEN_DISPS(play->state.gfxCtx);
+
func_8012C28C(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
@@ -1720,6 +1727,7 @@ void EnOssan_CuriosityShopMan_Draw(Actor* thisx, PlayState* play) {
&this->actor);
EnOssan_DrawCursor(play, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnOssan_DrawStickDirectionPrompts(play, this);
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1729,11 +1737,13 @@ void EnOssan_PartTimer_Draw(Actor* thisx, PlayState* play) {
EnOssan* this = THIS;
OPEN_DISPS(play->state.gfxCtx);
+
func_8012C28C(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnOssan_PartTimer_OverrideLimbDraw, EnOssan_PartTimer_PostLimbDraw, &this->actor);
EnOssan_DrawCursor(play, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnOssan_DrawStickDirectionPrompts(play, this);
+
CLOSE_DISPS(play->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h
index 539906ea85..20d669ea40 100644
--- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h
+++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h
@@ -35,7 +35,7 @@ typedef struct EnOssan {
/* 0x230 */ f32 cursorAnimTween;
/* 0x234 */ u8 cursorAnimState;
/* 0x235 */ u8 drawCursor;
- /* 0x236 */ u8 cursorIdx;
+ /* 0x236 */ u8 cursorIndex;
/* 0x238 */ StickDirectionPrompt stickLeftPrompt;
/* 0x270 */ StickDirectionPrompt stickRightPrompt;
/* 0x2A8 */ f32 arrowAnimTween;
diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c
index aa8f651ec5..4f17b98806 100644
--- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c
+++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c
@@ -1479,6 +1479,7 @@ void EnSob1_DrawCursor(PlayState* play, EnSob1* this, f32 x, f32 y, f32 z, u8 dr
s32 pad;
OPEN_DISPS(play->state.gfxCtx);
+
if (drawCursor != 0) {
func_8012C654(play->state.gfxCtx);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColor.r, this->cursorColor.g, this->cursorColor.b,
@@ -1493,6 +1494,7 @@ void EnSob1_DrawCursor(PlayState* play, EnSob1* this, f32 x, f32 y, f32 z, u8 dr
dsdx = (1.0f / z) * 1024.0f;
gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, 0, 0, dsdx, dsdx);
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1511,6 +1513,7 @@ void EnSob1_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32
(void)"../z_en_soB1.c";
OPEN_DISPS(play->state.gfxCtx);
+
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, r, g, b, a);
@@ -1527,6 +1530,7 @@ void EnSob1_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32
dtdy = dy * unk;
gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, s, t, dsdx, dtdy);
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1537,6 +1541,7 @@ void EnSob1_DrawStickDirectionPrompt(PlayState* play, EnSob1* this) {
(void)"../z_en_soB1.c";
OPEN_DISPS(play->state.gfxCtx);
+
if (drawStickRightPrompt || drawStickLeftPrompt) {
func_8012C654(play->state.gfxCtx);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
@@ -1571,6 +1576,7 @@ void EnSob1_DrawStickDirectionPrompt(PlayState* play, EnSob1* this) {
this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f);
}
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1596,9 +1602,11 @@ s32 EnSob1_BombShopkeeper_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx**
void EnSob1_BombShopkeeper_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
OPEN_DISPS(play->state.gfxCtx);
+
if (limbIndex == BOMB_SHOPKEEPER_LIMB_LEFT_HAND) {
gSPDisplayList(POLY_OPA_DISP++, gBombShopkeeperBombDL);
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1619,6 +1627,7 @@ void EnSob1_ZoraShopkeeper_Draw(Actor* thisx, PlayState* play) {
s32 i;
OPEN_DISPS(play->state.gfxCtx);
+
func_8012C28C(play->state.gfxCtx);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
gSPSegment(POLY_OPA_DISP++, 0x0C, EnSob1_EndDList(play->state.gfxCtx));
@@ -1632,6 +1641,7 @@ void EnSob1_ZoraShopkeeper_Draw(Actor* thisx, PlayState* play) {
}
EnSob1_DrawCursor(play, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnSob1_DrawStickDirectionPrompt(play, this);
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1642,6 +1652,7 @@ void EnSob1_GoronShopkeeper_Draw(Actor* thisx, PlayState* play) {
s32 i;
OPEN_DISPS(play->state.gfxCtx);
+
func_8012C28C(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sGoronShopkeeperEyeTextures[this->eyeTexIndex]));
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL,
@@ -1653,6 +1664,7 @@ void EnSob1_GoronShopkeeper_Draw(Actor* thisx, PlayState* play) {
}
EnSob1_DrawCursor(play, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnSob1_DrawStickDirectionPrompt(play, this);
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1663,6 +1675,7 @@ void EnSob1_BombShopkeeper_Draw(Actor* thisx, PlayState* play) {
s32 i;
OPEN_DISPS(play->state.gfxCtx);
+
func_8012C28C(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gBombShopkeeperEyeTex));
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
@@ -1683,5 +1696,6 @@ void EnSob1_BombShopkeeper_Draw(Actor* thisx, PlayState* play) {
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, -frames * 20, 32, 128));
gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 0, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0);
+
CLOSE_DISPS(play->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.c b/src/overlays/actors/ovl_En_Trt/z_en_trt.c
index 6402e5920b..39a16dea9e 100644
--- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c
+++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c
@@ -23,7 +23,7 @@ void EnTrt_Draw(Actor* thisx, PlayState* play);
void EnTrt_GetCutscenes(EnTrt* this, PlayState* play);
void EnTrt_ResetItemPosition(EnTrt* this);
-void EnTrt_UpdateHeadYawAndPitch(EnTrt* this, PlayState* play);
+void EnTrt_TrackPlayer(EnTrt* this, PlayState* play);
s32 EnTrt_ReturnItemToShelf(EnTrt* this);
s32 EnTrt_FacingShopkeeperDialogResult(EnTrt* this, PlayState* play);
s32 EnTrt_TakeItemOffShelf(EnTrt* this);
@@ -64,17 +64,30 @@ void EnTrt_Blink(EnTrt* this);
void EnTrt_OpenEyes2(EnTrt* this);
void EnTrt_NodOff(EnTrt* this);
+typedef enum {
+ /* 0 */ TRT_ANIM_IDLE,
+ /* 1 */ TRT_ANIM_HALF_AWAKE,
+ /* 2 */ TRT_ANIM_SLEEPING,
+ /* 3 */ TRT_ANIM_WAKE_UP,
+ /* 4 */ TRT_ANIM_SURPRISED,
+ /* 5 */ TRT_ANIM_HANDS_ON_COUNTER,
+ /* 6 */ TRT_ANIM_HOVER,
+ /* 7 */ TRT_ANIM_FLY_LOOK_AROUND,
+ /* 8 */ TRT_ANIM_FLY_DOWN,
+ /* 9 */ TRT_ANIM_FLY
+} TrtAnimation;
+
static AnimationInfoS sAnimationInfo[] = {
- { &object_trt_Anim_00DE68, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_trt_Anim_00EE98, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_trt_Anim_00FD34, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_0030EC, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_trt_Anim_003D78, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_trt_Anim_00D52C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_000A44, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_001EF4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_002224, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_002CB0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeIdleAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
+ { &gKotakeHalfAwakeAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
+ { &gKotakeSleepingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeWakeUpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
+ { &gKotakeSurprisedAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
+ { &gKotakeHandsOnCounterAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeHoverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeFlyLookAroundAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeFlyDownAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeFlyAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
};
const ActorInit En_Trt_InitVars = {
@@ -149,7 +162,7 @@ void EnTrt_UpdateCursorPos(PlayState* play, EnTrt* this) {
f32 xOffset = 0.0f;
f32 yOffset = 17.0f;
- Actor_GetScreenPos(play, &this->items[this->cursorIdx]->actor, &x, &y);
+ Actor_GetScreenPos(play, &this->items[this->cursorIndex]->actor, &x, &y);
this->cursorPos.x = x + xOffset;
this->cursorPos.y = y + yOffset;
this->cursorPos.z = 1.2f;
@@ -178,18 +191,18 @@ void EnTrt_SetupGetMushroomCutscene(EnTrt* this) {
}
u16 EnTrt_GetItemTextId(EnTrt* this) {
- EnGirlA* item = this->items[this->cursorIdx];
+ EnGirlA* item = this->items[this->cursorIndex];
- if (item->actor.params == SI_POTION_BLUE && !(this->flags & ENTRT_GIVEN_MUSHROOM)) {
+ if ((item->actor.params == SI_POTION_BLUE) && !(this->flags & ENTRT_GIVEN_MUSHROOM)) {
return 0x880;
}
return item->actor.textId;
}
u16 EnTrt_GetItemChoiceTextId(EnTrt* this) {
- EnGirlA* item = this->items[this->cursorIdx];
+ EnGirlA* item = this->items[this->cursorIndex];
- if (item->actor.params == SI_POTION_BLUE && !(gSaveContext.save.weekEventReg[53] & 0x10)) {
+ if ((item->actor.params == SI_POTION_BLUE) && !(gSaveContext.save.weekEventReg[53] & 0x10)) {
this->textId = 0x881;
return 0x881;
}
@@ -384,7 +397,7 @@ void EnTrt_Goodbye(EnTrt* this, PlayState* play) {
}
}
-void EnTrt_SetupTryToGiveRedPotion(EnTrt* this, PlayState* play) {
+void EnTrt_StartRedPotionConversation(EnTrt* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
if (this->textId == 0x88F) {
if (Inventory_HasEmptyBottle() || !(gSaveContext.save.weekEventReg[12] & 0x10)) {
@@ -501,7 +514,7 @@ s32 EnTrt_FacingShopkeeperDialogResult(EnTrt* this, PlayState* play) {
void EnTrt_FaceShopkeeper(EnTrt* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
- u8 cursorIdx;
+ u8 cursorIndex;
if (this->cutsceneState == ENTRT_CUTSCENESTATE_WAITING) {
if (ActorCutscene_GetCanPlayNext(this->cutscene)) {
@@ -523,9 +536,9 @@ void EnTrt_FaceShopkeeper(EnTrt* this, PlayState* play) {
if (!EnTrt_TestEndInteraction(this, play, CONTROLLER1(&play->state))) {
if ((!Message_ShouldAdvance(play) || !EnTrt_FacingShopkeeperDialogResult(this, play)) &&
(this->stickAccumX > 0)) {
- cursorIdx = EnTrt_SetCursorIndexFromNeutral(this, 2);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnTrt_SetCursorIndexFromNeutral(this, 2);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
this->actionFunc = EnTrt_LookToShelf;
func_8011552C(play, 6);
this->stickRightPrompt.isEnabled = false;
@@ -562,7 +575,7 @@ void EnTrt_LookToShelf(EnTrt* this, PlayState* play) {
}
void EnTrt_CursorLeftRight(PlayState* play, EnTrt* this) {
- u8 curTemp = this->cursorIdx;
+ u8 curTemp = this->cursorIndex;
if (this->stickAccumX < 0) {
if (curTemp != 2) {
@@ -571,20 +584,20 @@ void EnTrt_CursorLeftRight(PlayState* play, EnTrt* this) {
EnTrt_SetupLookToShopkeeperFromShelf(play, this);
}
if (this->items[curTemp] != NULL) {
- this->cursorIdx = curTemp;
+ this->cursorIndex = curTemp;
}
} else if (this->stickAccumX > 0) {
if (curTemp != 0) {
curTemp--;
}
if (this->items[curTemp] != NULL) {
- this->cursorIdx = curTemp;
+ this->cursorIndex = curTemp;
}
}
}
s32 EnTrt_HasPlayerSelectedItem(PlayState* play, EnTrt* this, Input* input) {
- EnGirlA* item = this->items[this->cursorIdx];
+ EnGirlA* item = this->items[this->cursorIndex];
if (EnTrt_TestEndInteraction(this, play, input)) {
return true;
@@ -609,8 +622,8 @@ s32 EnTrt_HasPlayerSelectedItem(PlayState* play, EnTrt* this, Input* input) {
void EnTrt_BrowseShelf(EnTrt* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
s32 pad;
- u8 prevCursorIdx = this->cursorIdx;
- u8 cursorIdx;
+ u8 prevCursorIdx = this->cursorIndex;
+ u8 cursorIndex;
if (!EnTrt_ReturnItemToShelf(this)) {
this->delayTimer = 3;
@@ -624,7 +637,7 @@ void EnTrt_BrowseShelf(EnTrt* this, PlayState* play) {
func_8011552C(play, 6);
if (!EnTrt_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) {
EnTrt_CursorLeftRight(play, this);
- if (this->cursorIdx != prevCursorIdx) {
+ if (this->cursorIndex != prevCursorIdx) {
func_80151938(play, EnTrt_GetItemTextId(this));
play_sound(NA_SE_SY_CURSOR);
}
@@ -636,7 +649,7 @@ void EnTrt_BrowseShelf(EnTrt* this, PlayState* play) {
void EnTrt_SetupBuyItemWithFanfare(PlayState* play, EnTrt* this) {
Player* player = GET_PLAYER(play);
- Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f);
+ Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f);
play->msgCtx.msgMode = 0x43;
play->msgCtx.stateTimer = 4;
player->stateFlags2 &= ~0x20000000;
@@ -656,7 +669,7 @@ void EnTrt_SetupCanBuy(PlayState* play, EnTrt* this, u16 textId) {
}
void EnTrt_HandleCanBuyItem(PlayState* play, EnTrt* this) {
- EnGirlA* item = this->items[this->cursorIdx];
+ EnGirlA* item = this->items[this->cursorIndex];
EnGirlA* item2;
switch (item->canBuyFunc(play, item)) {
@@ -666,13 +679,14 @@ void EnTrt_HandleCanBuyItem(PlayState* play, EnTrt* this) {
this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED;
}
func_8019F208();
- item2 = this->items[this->cursorIdx];
+ item2 = this->items[this->cursorIndex];
item2->buyFanfareFunc(play, item2);
EnTrt_SetupBuyItemWithFanfare(play, this);
this->drawCursor = 0;
this->shopItemSelectedTween = 0.0f;
item->boughtFunc(play, item);
break;
+
case CANBUY_RESULT_SUCCESS_2:
func_8019F208();
item->buyFunc(play, item);
@@ -681,27 +695,34 @@ void EnTrt_HandleCanBuyItem(PlayState* play, EnTrt* this) {
this->shopItemSelectedTween = 0.0f;
item->boughtFunc(play, item);
break;
+
case CANBUY_RESULT_NO_ROOM:
play_sound(NA_SE_SY_ERROR);
EnTrt_SetupCannotBuy(play, this, 0x641);
break;
+
case CANBUY_RESULT_NEED_EMPTY_BOTTLE:
play_sound(NA_SE_SY_ERROR);
EnTrt_SetupCannotBuy(play, this, 0x846);
break;
+
case CANBUY_RESULT_NEED_RUPEES:
play_sound(NA_SE_SY_ERROR);
EnTrt_SetupCannotBuy(play, this, 0x847);
break;
+
case CANBUY_RESULT_CANNOT_GET_NOW:
play_sound(NA_SE_SY_ERROR);
EnTrt_SetupCannotBuy(play, this, 0x643);
break;
+
+ default:
+ break;
}
}
void EnTrt_SelectItem(EnTrt* this, PlayState* play) {
- EnGirlA* item = this->items[this->cursorIdx];
+ EnGirlA* item = this->items[this->cursorIndex];
u8 talkState = Message_GetState(&play->msgCtx);
if (EnTrt_TakeItemOffShelf(this)) {
@@ -757,8 +778,8 @@ void EnTrt_IdleSleeping(EnTrt* this, PlayState* play) {
}
this->prevTextId = this->textId;
- if (player->transformation == PLAYER_FORM_GORON || player->transformation == PLAYER_FORM_ZORA ||
- player->transformation == PLAYER_FORM_DEKU) {
+ if ((player->transformation == PLAYER_FORM_GORON) || (player->transformation == PLAYER_FORM_ZORA) ||
+ (player->transformation == PLAYER_FORM_DEKU)) {
this->textId = 0x850;
}
if (Player_GetMask(play) == PLAYER_MASK_SCENTS) {
@@ -779,14 +800,14 @@ void EnTrt_IdleSleeping(EnTrt* this, PlayState* play) {
player->stateFlags2 |= 0x20000000;
this->timer = 45;
this->actionFunc = EnTrt_BeginInteraction;
- } else if ((player->actor.world.pos.x >= -50.0f && player->actor.world.pos.x <= -25.0f) &&
- (player->actor.world.pos.z >= -19.0f && player->actor.world.pos.z <= 30.0f)) {
+ } else if (((player->actor.world.pos.x >= -50.0f) && (player->actor.world.pos.x <= -25.0f)) &&
+ ((player->actor.world.pos.z >= -19.0f) && (player->actor.world.pos.z <= 30.0f))) {
func_800B8614(&this->actor, play, 200.0f);
}
if (DECR(this->timer) == 0) {
this->timer = 40;
- EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 1);
- this->animIndex = 1;
+ EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT_ANIM_HALF_AWAKE);
+ this->animIndex = TRT_ANIM_HALF_AWAKE;
this->actionFunc = EnTrt_IdleAwake;
this->blinkFunc = EnTrt_OpenThenCloseEyes;
}
@@ -799,7 +820,7 @@ void EnTrt_IdleAwake(EnTrt* this, PlayState* play) {
Player* player = GET_PLAYER(play);
this->flags &= ~ENTRT_FULLY_AWAKE;
- if (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_FIERCE_DEITY) {
+ if ((player->transformation == PLAYER_FORM_HUMAN) || (player->transformation == PLAYER_FORM_FIERCE_DEITY)) {
if (Player_GetMask(play) == PLAYER_MASK_SCENTS) {
this->textId = 0x890;
} else {
@@ -821,7 +842,7 @@ void EnTrt_IdleAwake(EnTrt* this, PlayState* play) {
if (player->transformation == PLAYER_FORM_HUMAN) {
this->flags |= ENTRT_MET;
}
- EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 2);
+ EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT_ANIM_SLEEPING);
this->blinkFunc = EnTrt_EyesClosed;
this->timer = 45;
this->actionFunc = EnTrt_BeginInteraction;
@@ -831,8 +852,8 @@ void EnTrt_IdleAwake(EnTrt* this, PlayState* play) {
}
if (DECR(this->timer) == 0) {
this->timer = Rand_S16Offset(150, 100);
- EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 2);
- this->animIndex = 2;
+ EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT_ANIM_SLEEPING);
+ this->animIndex = TRT_ANIM_SLEEPING;
this->sleepSoundTimer = 10;
this->actor.textId = 0;
this->actionFunc = EnTrt_IdleSleeping;
@@ -842,7 +863,7 @@ void EnTrt_IdleAwake(EnTrt* this, PlayState* play) {
void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) {
s16 curFrame = this->skelAnime.curFrame / this->skelAnime.playSpeed;
- s16 animLastFrame = Animation_GetLastFrame(&object_trt_Anim_0030EC) / (s16)this->skelAnime.playSpeed;
+ s16 animLastFrame = Animation_GetLastFrame(&gKotakeWakeUpAnim) / (s16)this->skelAnime.playSpeed;
if (this->cutsceneState == ENTRT_CUTSCENESTATE_WAITING) {
if (ActorCutscene_GetCanPlayNext(this->cutscene)) {
@@ -852,10 +873,10 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) {
ActorCutscene_SetIntentToPlay(this->cutscene);
}
} else if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) {
- if (this->animIndex != 5) {
+ if (this->animIndex != TRT_ANIM_HANDS_ON_COUNTER) {
if (curFrame == animLastFrame) {
- EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 3);
- this->animIndex = 3;
+ EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT_ANIM_WAKE_UP);
+ this->animIndex = TRT_ANIM_WAKE_UP;
this->blinkFunc = EnTrt_OpenEyesThenSetToBlink;
this->timer = 10;
this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING;
@@ -868,9 +889,9 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) {
}
} else if (DECR(this->timer) == 0) {
this->timer = Rand_S16Offset(40, 20);
- EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 5);
+ EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT_ANIM_HANDS_ON_COUNTER);
Message_StartTextbox(play, this->textId, &this->actor);
- this->animIndex = 5;
+ this->animIndex = TRT_ANIM_HANDS_ON_COUNTER;
switch (this->textId) {
case 0x834:
if (!(gSaveContext.save.weekEventReg[12] & 8) && !(gSaveContext.save.weekEventReg[84] & 0x40) &&
@@ -880,7 +901,7 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) {
this->stickRightPrompt.isEnabled = true;
this->actionFunc = EnTrt_Hello;
} else {
- this->actionFunc = EnTrt_SetupTryToGiveRedPotion;
+ this->actionFunc = EnTrt_StartRedPotionConversation;
}
break;
case 0x83E:
@@ -894,7 +915,7 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) {
this->actionFunc = EnTrt_SetupEndInteraction;
break;
case 0x88F:
- this->actionFunc = EnTrt_SetupTryToGiveRedPotion;
+ this->actionFunc = EnTrt_StartRedPotionConversation;
break;
}
}
@@ -910,8 +931,8 @@ void EnTrt_Surprised(EnTrt* this, PlayState* play) {
}
} else if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) {
if (DECR(this->timer) == 0) {
- EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 4);
- this->animIndex = 4;
+ EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT_ANIM_SURPRISED);
+ this->animIndex = TRT_ANIM_SURPRISED;
this->blinkFunc = EnTrt_OpenEyes2;
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOTAKE_SURPRISED);
this->timer = 30;
@@ -919,9 +940,9 @@ void EnTrt_Surprised(EnTrt* this, PlayState* play) {
}
} else if (DECR(this->timer) == 0) {
this->timer = Rand_S16Offset(40, 20);
- EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 5);
+ EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT_ANIM_HANDS_ON_COUNTER);
Message_StartTextbox(play, this->textId, &this->actor);
- this->animIndex = 5;
+ this->animIndex = TRT_ANIM_HANDS_ON_COUNTER;
this->actionFunc = EnTrt_TryToGiveRedPotionAfterSurprised;
}
}
@@ -1057,7 +1078,7 @@ void EnTrt_CanBuy(EnTrt* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
this->shopItemSelectedTween = 0.0f;
EnTrt_ResetItemPosition(this);
- item = this->items[this->cursorIdx];
+ item = this->items[this->cursorIndex];
item->restockFunc(play, item);
this->actionFunc = this->prevActionFunc;
func_80151938(play, EnTrt_GetItemTextId(this));
@@ -1069,7 +1090,7 @@ void EnTrt_BuyItemWithFanfare(EnTrt* this, PlayState* play) {
this->actor.parent = NULL;
this->actionFunc = EnTrt_SetupItemGiven;
} else {
- Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f);
+ Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f);
}
}
@@ -1096,7 +1117,7 @@ void EnTrt_ContinueShopping(EnTrt* this, PlayState* play) {
func_8011552C(play, 6);
if (Message_ShouldAdvance(play)) {
EnTrt_ResetItemPosition(this);
- item = this->items[this->cursorIdx];
+ item = this->items[this->cursorIndex];
item->restockFunc(play, item);
if (!EnTrt_TestEndInteraction(this, play, CONTROLLER1(&play->state))) {
switch (play->msgCtx.choiceIndex) {
@@ -1119,7 +1140,7 @@ void EnTrt_ContinueShopping(EnTrt* this, PlayState* play) {
} else if (talkState == TEXT_STATE_5) {
if (Message_ShouldAdvance(play)) {
EnTrt_ResetItemPosition(this);
- item = this->items[this->cursorIdx];
+ item = this->items[this->cursorIndex];
item->restockFunc(play, item);
EnTrt_EndInteraction(play, this);
}
@@ -1128,7 +1149,7 @@ void EnTrt_ContinueShopping(EnTrt* this, PlayState* play) {
void EnTrt_PositionSelectedItem(EnTrt* this) {
static Vec3f sSelectedItemPosition = { 6.0f, 35.0f, -12.0f };
- u8 i = this->cursorIdx;
+ u8 i = this->cursorIndex;
EnGirlA* item;
ShopItem* shopItem = &sShop[i];
Vec3f worldPos;
@@ -1189,7 +1210,7 @@ void EnTrt_UpdateItemSelectedProperty(EnTrt* this) {
(this->drawCursor == 0)) {
item->isSelected = false;
} else {
- item->isSelected = this->cursorIdx == i ? true : false;
+ item->isSelected = this->cursorIndex == i ? true : false;
}
}
}
@@ -1278,53 +1299,53 @@ void EnTrt_UpdateStickDirectionPromptAnim(EnTrt* this) {
}
void EnTrt_OpenEyes(EnTrt* this) {
- if (this->eyeTextureIdx <= 0) {
- this->eyeTextureIdx = 0;
+ if (this->eyeTexIndex <= 0) {
+ this->eyeTexIndex = 0;
} else {
- this->eyeTextureIdx--;
+ this->eyeTexIndex--;
}
}
void EnTrt_CloseEyes(EnTrt* this) {
- if (this->eyeTextureIdx >= 2) {
- this->eyeTextureIdx = 2;
+ if (this->eyeTexIndex >= 2) {
+ this->eyeTexIndex = 2;
} else {
- this->eyeTextureIdx++;
+ this->eyeTexIndex++;
}
}
void EnTrt_Blink(EnTrt* this) {
s16 decr = this->blinkTimer - 1;
- s16 eyeTextureIdxTemp;
+ s16 eyeTexIndex;
if (decr != 0) {
this->blinkTimer = decr;
return;
}
- eyeTextureIdxTemp = this->eyeTextureIdx + 1;
- if (eyeTextureIdxTemp > 2) {
- this->eyeTextureIdx = 0;
+ eyeTexIndex = this->eyeTexIndex + 1;
+ if (eyeTexIndex > 2) {
+ this->eyeTexIndex = 0;
this->blinkTimer = (s32)(Rand_ZeroOne() * 60.0f) + 20;
} else {
- this->eyeTextureIdx = eyeTextureIdxTemp;
+ this->eyeTexIndex = eyeTexIndex;
this->blinkTimer = 1;
}
}
void EnTrt_NodOff(EnTrt* this) {
s16 decr = this->blinkTimer - 1;
- s16 eyeTextureIdxTemp;
+ s16 eyeTexIndex;
if (decr != 0) {
this->blinkTimer = decr;
return;
}
- eyeTextureIdxTemp = this->eyeTextureIdx + 1;
- if (eyeTextureIdxTemp > 2) {
- this->eyeTextureIdx = 1;
+ eyeTexIndex = this->eyeTexIndex + 1;
+ if (eyeTexIndex > 2) {
+ this->eyeTexIndex = 1;
this->blinkTimer = 20;
} else {
- this->eyeTextureIdx = eyeTextureIdxTemp;
+ this->eyeTexIndex = eyeTexIndex;
this->blinkTimer = 3;
}
}
@@ -1333,14 +1354,14 @@ void EnTrt_OpenThenCloseEyes(EnTrt* this) {
if (this->skelAnime.curFrame >= 40.0f) {
EnTrt_CloseEyes(this);
} else if (this->skelAnime.curFrame >= 35.0f) {
- this->eyeTextureIdx = 1;
+ this->eyeTexIndex = 1;
} else if (this->skelAnime.curFrame >= 10.0f) {
EnTrt_OpenEyes(this);
}
}
void EnTrt_EyesClosed(EnTrt* this) {
- this->eyeTextureIdx = 2;
+ this->eyeTexIndex = 2;
}
void EnTrt_OpenEyes2(EnTrt* this) {
@@ -1350,7 +1371,7 @@ void EnTrt_OpenEyes2(EnTrt* this) {
void EnTrt_OpenEyesThenSetToBlink(EnTrt* this) {
if (this->skelAnime.curFrame >= 7.0f) {
EnTrt_OpenEyes(this);
- if (this->eyeTextureIdx == 0) {
+ if (this->eyeTexIndex == 0) {
this->blinkFunc = EnTrt_Blink;
}
}
@@ -1363,7 +1384,7 @@ void EnTrt_TalkToShopkeeper(EnTrt* this, PlayState* play) {
if (talkState == TEXT_STATE_5) {
if (Message_ShouldAdvance(play)) {
- if (this->talkOptionTextId == 0x845 || this->talkOptionTextId == 0x882) {
+ if ((this->talkOptionTextId == 0x845) || (this->talkOptionTextId == 0x882)) {
func_80151938(play, 0xFF);
} else {
EnTrt_StartShopping(play, this);
@@ -1441,9 +1462,9 @@ void EnTrt_LookToShopkeeperFromShelf(EnTrt* this, PlayState* play) {
}
void EnTrt_InitShopkeeper(EnTrt* this, PlayState* play) {
- SkelAnime_InitFlex(play, &this->skelAnime, &object_trt_Skel_00FEF0, &object_trt_Anim_00FD34, NULL, NULL, 0);
+ SkelAnime_InitFlex(play, &this->skelAnime, &gKotakeSkel, &gKotakeSleepingAnim, NULL, NULL, 0);
if (!(gSaveContext.save.weekEventReg[12] & 8) && !(gSaveContext.save.weekEventReg[84] & 0x40) &&
- gSaveContext.save.day >= 2) {
+ (gSaveContext.save.day >= 2)) {
this->actor.draw = NULL;
} else {
this->actor.draw = EnTrt_Draw;
@@ -1472,7 +1493,7 @@ void EnTrt_InitShop(EnTrt* this, PlayState* play) {
this->stickAccumY = 0;
this->stickAccumX = 0;
- this->cursorIdx = 0;
+ this->cursorIndex = 0;
this->cursorPos.z = 1.2f;
this->cursorColor.r = 0;
this->cursorColor.g = 80;
@@ -1522,7 +1543,7 @@ void EnTrt_InitShop(EnTrt* this, PlayState* play) {
Actor_SetScale(&this->actor, sActorScale);
EnTrt_SpawnShopItems(this, play, sShop);
this->blinkTimer = 20;
- this->eyeTextureIdx = 0;
+ this->eyeTexIndex = 0;
this->blinkFunc = EnTrt_EyesClosed;
if (gSaveContext.save.weekEventReg[53] & 8) {
this->flags |= ENTRT_GIVEN_MUSHROOM;
@@ -1548,6 +1569,7 @@ void EnTrt_DrawCursor(PlayState* play, EnTrt* this, f32 x, f32 y, f32 z, u8 draw
s32 pad;
OPEN_DISPS(play->state.gfxCtx);
+
if (drawCursor != 0) {
func_8012C654(play->state.gfxCtx);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColor.r, this->cursorColor.g, this->cursorColor.b,
@@ -1562,6 +1584,7 @@ void EnTrt_DrawCursor(PlayState* play, EnTrt* this, f32 x, f32 y, f32 z, u8 draw
dsdx = (1.0f / z) * 1024.0f;
gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, 0, 0, dsdx, dsdx);
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1579,6 +1602,7 @@ void EnTrt_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32 y
(void)"../z_en_trt.c";
OPEN_DISPS(play->state.gfxCtx);
+
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, r, g, b, a);
@@ -1595,6 +1619,7 @@ void EnTrt_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32 y
dtdy = dy * unk;
gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, s, t, dsdx, dtdy);
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1605,6 +1630,7 @@ void EnTrt_DrawStickDirectionPrompt(PlayState* play, EnTrt* this) {
(void)"../z_en_trt.c";
OPEN_DISPS(play->state.gfxCtx);
+
if (drawStickRightPrompt || drawStickLeftPrompt) {
func_8012C654(play->state.gfxCtx);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
@@ -1639,6 +1665,7 @@ void EnTrt_DrawStickDirectionPrompt(PlayState* play, EnTrt* this) {
this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f);
}
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1668,14 +1695,14 @@ void EnTrt_Update(Actor* thisx, PlayState* play) {
EnTrt_UpdateItemSelectedProperty(this);
EnTrt_UpdateStickDirectionPromptAnim(this);
EnTrt_UpdateCursorAnim(this);
- EnTrt_UpdateHeadYawAndPitch(this, play);
+ EnTrt_TrackPlayer(this, play);
this->actionFunc(this, play);
Actor_SetFocus(&this->actor, 90.0f);
SkelAnime_Update(&this->skelAnime);
EnTrt_UpdateCollider(this, play);
}
-void EnTrt_UpdateHeadYawAndPitch(EnTrt* this, PlayState* play) {
+void EnTrt_TrackPlayer(EnTrt* this, PlayState* play) {
Player* player = GET_PLAYER(play);
Vec3f playerPos;
Vec3f pos;
@@ -1690,7 +1717,7 @@ void EnTrt_UpdateHeadYawAndPitch(EnTrt* this, PlayState* play) {
this->headPitch = CLAMP(this->headPitch, -0x1C70, 0x1C70);
}
-void EnTrt_UpdateHeadPosAndRot(s16 pitch, s16 yaw, Vec3f* pos, Vec3s* rot, s32 isFullyAwake) {
+void EnTrt_UpdateLimb(s16 pitch, s16 yaw, Vec3f* pos, Vec3s* rot, s32 overrideRot) {
Vec3f newPos;
Vec3f zeroVec = gZeroVec3f;
Vec3s newRot;
@@ -1700,7 +1727,7 @@ void EnTrt_UpdateHeadPosAndRot(s16 pitch, s16 yaw, Vec3f* pos, Vec3s* rot, s32 i
Matrix_Get(¤tState);
Matrix_MtxFToYXZRot(¤tState, &newRot, false);
*pos = newPos;
- if (isFullyAwake) {
+ if (overrideRot) {
newRot.x += pitch;
newRot.y += yaw;
Math_SmoothStepToS(&rot->x, newRot.x, 4, 0x1FFE, 1);
@@ -1723,7 +1750,7 @@ s32 EnTrt_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
this->items[i]->actor.scale.z = 0.2f;
}
- if (limbIndex == 14) {
+ if (limbIndex == KOTAKE_LIMB_BROOM) {
*dList = NULL;
}
return false;
@@ -1731,14 +1758,14 @@ s32 EnTrt_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
void EnTrt_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
EnTrt* this = THIS;
- s32 isFullyAwake;
+ s32 overrideRot;
- isFullyAwake = false;
+ overrideRot = false;
if (this->flags & ENTRT_FULLY_AWAKE) {
- isFullyAwake = true;
+ overrideRot = true;
}
- if (limbIndex == 21) {
- EnTrt_UpdateHeadPosAndRot(this->headPitch, this->headYaw, &this->headPos, &this->headRot, isFullyAwake);
+ if (limbIndex == KOTAKE_LIMB_HEAD) {
+ EnTrt_UpdateLimb(this->headPitch, this->headYaw, &this->headPos, &this->headRot, overrideRot);
Matrix_Translate(this->headPos.x, this->headPos.y, this->headPos.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_RotateYS(this->headRot.y, MTXMODE_APPLY);
@@ -1750,7 +1777,7 @@ void EnTrt_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
void EnTrt_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
EnTrt* this = THIS;
- if (limbIndex == 21) {
+ if (limbIndex == KOTAKE_LIMB_HEAD) {
Matrix_Translate(this->headPos.x, this->headPos.y, this->headPos.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_RotateYS(this->headRot.y, MTXMODE_APPLY);
@@ -1760,15 +1787,15 @@ void EnTrt_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
}
void EnTrt_Draw(Actor* thisx, PlayState* play) {
- static TexturePtr sEyeTextures[] = { object_trt_Tex_00B0B8, object_trt_Tex_00B8B8, object_trt_Tex_00C0B8 };
+ static TexturePtr sEyeTextures[] = { gKotakeEyeOpenTex, gKotakeEyeHalfTex, gKotakeEyeClosedTex };
EnTrt* this = THIS;
s32 pad;
OPEN_DISPS(play->state.gfxCtx);
func_8012C28C(play->state.gfxCtx);
- gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTextureIdx]));
- gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTextureIdx]));
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
+ gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable,
this->skelAnime.dListCount, EnTrt_OverrideLimbDraw, EnTrt_PostLimbDraw,
EnTrt_TransformLimbDraw, &this->actor);
diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.h b/src/overlays/actors/ovl_En_Trt/z_en_trt.h
index 46f0707979..9cbf5d51ca 100644
--- a/src/overlays/actors/ovl_En_Trt/z_en_trt.h
+++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.h
@@ -22,7 +22,7 @@ typedef struct EnTrt {
/* 0x338 */ s32 stickAccumX;
/* 0x33C */ s32 stickAccumY;
/* 0x340 */ EnGirlA* items[3];
- /* 0x34C */ u8 cursorIdx;
+ /* 0x34C */ u8 cursorIndex;
/* 0x350 */ StickDirectionPrompt stickLeftPrompt;
/* 0x388 */ StickDirectionPrompt stickRightPrompt;
/* 0x3C0 */ f32 shopItemSelectedTween;
@@ -33,7 +33,7 @@ typedef struct EnTrt {
/* 0x3D4 */ u8 arrowAnimState;
/* 0x3D5 */ u8 stickAnimState;
/* 0x3D6 */ s16 blinkTimer;
- /* 0x3D8 */ s16 eyeTextureIdx;
+ /* 0x3D8 */ s16 eyeTexIndex;
/* 0x3DC */ EnTrtBlinkFunc blinkFunc;
/* 0x3E0 */ s16 cutscene;
/* 0x3E2 */ s16 tmpGetMushroomCutscene;
diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c
index 9e791dbeab..1f521d250a 100644
--- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c
+++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c
@@ -26,17 +26,30 @@ void func_80AD4FE4(EnTrt2* this, PlayState* play);
void func_80AD5234(EnTrt2* this, PlayState* play);
void func_80AD56E8(Actor* thisx, PlayState* play);
+typedef enum {
+ /* 0 */ TRT2_ANIM_IDLE,
+ /* 1 */ TRT2_ANIM_HALF_AWAKE,
+ /* 2 */ TRT2_ANIM_SLEEPING,
+ /* 3 */ TRT2_ANIM_WAKE_UP,
+ /* 4 */ TRT2_ANIM_SURPRISED,
+ /* 5 */ TRT2_ANIM_HANDS_ON_COUNTER,
+ /* 6 */ TRT2_ANIM_HOVER,
+ /* 7 */ TRT2_ANIM_FLY_LOOK_AROUND,
+ /* 8 */ TRT2_ANIM_FLY_DOWN,
+ /* 9 */ TRT2_ANIM_FLY
+} Trt2Animation;
+
static AnimationInfoS sAnimationInfo[] = {
- { &object_trt_Anim_00DE68, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_trt_Anim_00EE98, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_trt_Anim_00FD34, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_0030EC, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_trt_Anim_003D78, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_trt_Anim_00D52C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_000A44, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_001EF4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_002224, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_002CB0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeIdleAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
+ { &gKotakeHalfAwakeAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
+ { &gKotakeSleepingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeWakeUpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
+ { &gKotakeSurprisedAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
+ { &gKotakeHandsOnCounterAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeHoverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeFlyLookAroundAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeFlyDownAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeFlyAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
};
const ActorInit En_Trt2_InitVars = {
@@ -108,18 +121,18 @@ static DamageTable sDamageTable = {
/* Powder Keg */ DMG_ENTRY(1, 0x0),
};
-void func_80AD3380(SkelAnime* skelAnime, AnimationInfoS* animation, s32 arg2) {
- f32 phi_f0;
+void EnTrt2_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s32 animIndex) {
+ f32 endFrame;
- animation += arg2;
+ animationInfo += animIndex;
- if (animation->frameCount < 0) {
- phi_f0 = Animation_GetLastFrame(animation->animation);
+ if (animationInfo->frameCount < 0) {
+ endFrame = Animation_GetLastFrame(animationInfo->animation);
} else {
- phi_f0 = animation->frameCount;
+ endFrame = animationInfo->frameCount;
}
- Animation_Change(skelAnime, animation->animation, animation->playSpeed, animation->startFrame, phi_f0,
- animation->mode, animation->morphFrames);
+ Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed, animationInfo->startFrame, endFrame,
+ animationInfo->mode, animationInfo->morphFrames);
}
void func_80AD341C(EnTrt2* this, PlayState* play) {
@@ -170,7 +183,7 @@ void func_80AD3530(EnTrt2* this, PlayState* play) {
if (DECR(this->unk_3AE) == 0) {
this->unk_3AE = Rand_S16Offset(20, 20);
- func_80AD3380(&this->skelAnime, sAnimationInfo, 7);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_FLY_LOOK_AROUND);
this->unk_3B2 = 5;
}
}
@@ -277,7 +290,7 @@ void func_80AD3A24(EnTrt2* this, PlayState* play) {
Math_ApproachF(&this->actor.speedXZ, 0.0f, 0.2f, 1.0f);
} else if (DECR(this->unk_3AE) == 0) {
this->unk_3AE = Rand_S16Offset(100, 50);
- func_80AD3380(&this->skelAnime, sAnimationInfo, 6);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_HOVER);
this->unk_3B2 = 4;
}
Actor_MoveWithGravity(&this->actor);
@@ -288,7 +301,7 @@ void func_80AD3AE4(EnTrt2* this, PlayState* play) {
Math_ApproachF(&this->actor.velocity.y, 0.5f, 0.2f, 0.1f);
} else {
this->actor.velocity.y = 0.0f;
- func_80AD3380(&this->skelAnime, sAnimationInfo, 6);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_HOVER);
this->unk_3B2 = 4;
}
Actor_MoveWithGravity(&this->actor);
@@ -298,7 +311,7 @@ void func_80AD3B6C(EnTrt2* this, PlayState* play) {
if (DECR(this->unk_3B0) == 0) {
this->unk_3B0 = 10;
this->actor.velocity.y = -1.0f;
- func_80AD3380(&this->skelAnime, sAnimationInfo, 8);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_FLY_DOWN);
this->unk_3B2 = 8;
}
}
@@ -311,7 +324,7 @@ void func_80AD3BE4(EnTrt2* this, PlayState* play) {
this->actor.world.rot.y += this->unk_3C0;
this->actor.shape.rot.y = this->actor.world.rot.y;
if (this->actor.world.pos.y < 5.0f) {
- func_80AD3380(&this->skelAnime, sAnimationInfo, 9);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_FLY);
this->unk_3B2 = 9;
}
}
@@ -335,7 +348,7 @@ void func_80AD3CEC(EnTrt2* this, PlayState* play) {
} else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
play->msgCtx.msgMode = 0x43;
play->msgCtx.stateTimer = 4;
- func_80AD3380(&this->skelAnime, sAnimationInfo, 6);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_HOVER);
this->unk_3B2 = 4;
}
}
@@ -436,7 +449,7 @@ void func_80AD417C(EnTrt2* this, PlayState* play) {
play->msgCtx.msgMode = 0x43;
play->msgCtx.stateTimer = 4;
if (this->unk_3A8 == 0x84C) {
- func_80AD3380(&this->skelAnime, sAnimationInfo, 6);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_HOVER);
this->path = SubS_GetPathByIndex(play, ENTRT2_GET_FC00(&this->actor), 0x3F);
this->unk_3B2 = 18;
} else if (this->unk_3A8 == 0x88F) {
@@ -510,7 +523,7 @@ void func_80AD4550(EnTrt2* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
if ((player->transformation != PLAYER_FORM_HUMAN) && (player->transformation != PLAYER_FORM_FIERCE_DEITY)) {
- func_80AD3380(&this->skelAnime, sAnimationInfo, 7);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_FLY_LOOK_AROUND);
this->unk_3B2 = 17;
}
@@ -539,7 +552,7 @@ void func_80AD4608(EnTrt2* this) {
}
void func_80AD469C(EnTrt2* this, PlayState* play) {
- SkelAnime_InitFlex(play, &this->skelAnime, &object_trt_Skel_00FEF0, &object_trt_Anim_000A44, NULL, NULL, 0);
+ SkelAnime_InitFlex(play, &this->skelAnime, &gKotakeSkel, &gKotakeHoverAnim, NULL, NULL, 0);
this->actor.draw = func_80AD56E8;
}
@@ -665,7 +678,7 @@ s32 func_80AD4B4C(EnTrt2* this, PlayState* play) {
} else {
this->unk_3A8 = 0x84F;
this->unk_3D8 = true;
- func_80AD3380(&this->skelAnime, sAnimationInfo, 7);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_FLY_LOOK_AROUND);
this->unk_3B2 = 7;
}
}
@@ -876,7 +889,8 @@ void func_80AD5394(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4) {
s32 EnTrt2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnTrt2* this = THIS;
- if ((limbIndex == 8) || (limbIndex == 13) || (limbIndex == 19)) {
+ if ((limbIndex == KOTAKE_LIMB_TORSO_LIMB) || (limbIndex == KOTAKE_LIMB_LEFT_HAND) ||
+ (limbIndex == KOTAKE_LIMB_RIGHT_HAND)) {
rot->y += (s16)Math_SinS(this->unk_33C[limbIndex]) * 200;
rot->z += (s16)Math_CosS(this->unk_372[limbIndex]) * 200;
}
@@ -892,7 +906,7 @@ void EnTrt2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot
phi_v0 = true;
}
- if (limbIndex == 21) {
+ if (limbIndex == KOTAKE_LIMB_HEAD) {
func_80AD5394(this->unk_3D4, this->unk_3D6, &this->unk_3C8, &this->unk_3C2, phi_v0);
Matrix_Translate(this->unk_3C8.x, this->unk_3C8.y, this->unk_3C8.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
@@ -906,7 +920,7 @@ void EnTrt2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot
void EnTrt2_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
EnTrt2* this = THIS;
- if (limbIndex == 21) {
+ if (limbIndex == KOTAKE_LIMB_HEAD) {
Matrix_Translate(this->unk_3C8.x, this->unk_3C8.y, this->unk_3C8.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_RotateYS(this->unk_3C2.y, MTXMODE_APPLY);
@@ -917,9 +931,9 @@ void EnTrt2_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
void func_80AD56E8(Actor* thisx, PlayState* play) {
static TexturePtr D_80AD5978[] = {
- object_trt_Tex_00B0B8,
- object_trt_Tex_00B8B8,
- object_trt_Tex_00C0B8,
+ gKotakeEyeOpenTex,
+ gKotakeEyeHalfTex,
+ gKotakeEyeClosedTex,
};
s32 pad;
EnTrt2* this = THIS;
diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt
index 7698b0d2c5..3699d01005 100644
--- a/tools/disasm/functions.txt
+++ b/tools/disasm/functions.txt
@@ -11270,7 +11270,7 @@
0x80A8BFE0:("EnTrt_GetMushroom",),
0x80A8C168:("EnTrt_PayForMushroom",),
0x80A8C1E8:("EnTrt_Goodbye",),
- 0x80A8C288:("EnTrt_SetupTryToGiveRedPotion",),
+ 0x80A8C288:("EnTrt_StartRedPotionConversation",),
0x80A8C488:("EnTrt_GiveRedPotionForKoume",),
0x80A8C564:("EnTrt_GivenRedPotionForKoume",),
0x80A8C64C:("EnTrt_EndConversation",),
@@ -11327,8 +11327,8 @@
0x80A8F7AC:("EnTrt_Init",),
0x80A8F7E8:("EnTrt_Destroy",),
0x80A8F828:("EnTrt_Update",),
- 0x80A8F8C4:("EnTrt_UpdateHeadYawAndPitch",),
- 0x80A8FA00:("EnTrt_UpdateHeadPosAndRot",),
+ 0x80A8F8C4:("EnTrt_TrackPlayer",),
+ 0x80A8FA00:("EnTrt_UpdateLimb",),
0x80A8FB34:("EnTrt_OverrideLimbDraw",),
0x80A8FBB4:("EnTrt_PostLimbDraw",),
0x80A8FC64:("EnTrt_TransformLimbDraw",),
@@ -12163,7 +12163,7 @@
0x80AD3054:("BgCtowerGear_UpdateOrgan",),
0x80AD3124:("BgCtowerGear_Draw",),
0x80AD3164:("BgCtowerGear_DrawOrgan",),
- 0x80AD3380:("func_80AD3380",),
+ 0x80AD3380:("EnTrt2_ChangeAnim",),
0x80AD341C:("func_80AD341C",),
0x80AD349C:("func_80AD349C",),
0x80AD3530:("func_80AD3530",),