summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornotyourav <65437533+notyourav@users.noreply.github.com>2022-03-18 10:16:47 -0700
committerGitHub <noreply@github.com>2022-03-18 10:16:47 -0700
commitd6c8cf025095f5e13d8dce1179bead030918320d (patch)
tree3fb369607e83a938375298cf72a61e89b2d77a1e /src
parent2c9a5be002b8d0817617b1e0863acd3298287bbc (diff)
parente017dae13e3db67b03e987eb956df992faca72b2 (diff)
Merge pull request #449 from hatal175/objects4
Diffstat (limited to 'src')
-rw-r--r--src/enemy/businessScrub.c2
-rw-r--r--src/message.c2
-rw-r--r--src/npc/goronMerchant.c2
-rw-r--r--src/npc/picolyteBottle.c4
-rw-r--r--src/npc/stockwell.c2
-rw-r--r--src/npc/tingleSiblings.c2
-rw-r--r--src/object.c2
-rw-r--r--src/object/cuccoMinigame.c358
-rw-r--r--src/object/figurineDevice.c4
-rw-r--r--src/object/object96.c181
-rw-r--r--src/object/object98.c68
-rw-r--r--src/object/object99.c39
-rw-r--r--src/object/objectA6.c51
-rw-r--r--src/object/objectA9.c37
-rw-r--r--src/object/objectAB.c59
-rw-r--r--src/object/objectAD.c54
-rw-r--r--src/object/objectB.c2
-rw-r--r--src/object/objectB4.c135
-rw-r--r--src/script.c4
19 files changed, 995 insertions, 13 deletions
diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c
index 8283894b..45cf55b8 100644
--- a/src/enemy/businessScrub.c
+++ b/src/enemy/businessScrub.c
@@ -384,7 +384,7 @@ void sub_08028F0C(Entity* this) {
SetPlayerControl(1);
}
MessageFromTarget(dialog);
- gMessage.field_0x10 = offer->price;
+ gMessage.rupees = offer->price;
}
}
diff --git a/src/message.c b/src/message.c
index b10d00a1..d19e9f9f 100644
--- a/src/message.c
+++ b/src/message.c
@@ -818,7 +818,7 @@ void sub_08056F88(u32 unk_1, u32 unk_2) {
}
static void sub_08056FBC(TextRender* ctb) {
- sub_08056FEC(ctb->message.field_0x10, &ctb->_66[0x2]);
+ sub_08056FEC(ctb->message.rupees, &ctb->_66[0x2]);
sub_08056FEC(ctb->message.field_0x14, &ctb->_66[0xa]);
sub_08056FEC(ctb->message.field_0x18, &ctb->_77[0x1]);
sub_08056FEC(ctb->message.field_0x1c, &ctb->_77[0x9]);
diff --git a/src/npc/goronMerchant.c b/src/npc/goronMerchant.c
index 9a0cf266..3cb1a668 100644
--- a/src/npc/goronMerchant.c
+++ b/src/npc/goronMerchant.c
@@ -77,7 +77,7 @@ void sub_08069654(Entity* this) {
void sub_08069660(Entity* this) {
MessageNoOverlap(0x2c1c, this);
- gMessage.field_0x10 = (u16)GoronMerchant_GetSalePrice(this);
+ gMessage.rupees = (u16)GoronMerchant_GetSalePrice(this);
}
void sub_08069684(void) {
diff --git a/src/npc/picolyteBottle.c b/src/npc/picolyteBottle.c
index 6dbf5010..dec3e542 100644
--- a/src/npc/picolyteBottle.c
+++ b/src/npc/picolyteBottle.c
@@ -175,7 +175,7 @@ void sub_0806E140(PicolyteBottleEntity* this, ScriptExecutionContext* context) {
MessageFromTarget(0x421b);
} else {
MessageFromTarget(0x4218);
- gMessage.field_0x10 = this->unk76;
+ gMessage.rupees = this->unk76;
}
} else {
context->condition = 0;
@@ -201,7 +201,7 @@ void sub_0806E1FC(PicolyteBottleEntity* this) {
void sub_0806E20C(void) {
if (gRoomTransition.field_0x6 != 0) {
MessageFromTarget(0x421f);
- gMessage.field_0x10 = gRoomTransition.field_0x6;
+ gMessage.rupees = gRoomTransition.field_0x6;
} else {
MessageFromTarget(0x4220);
}
diff --git a/src/npc/stockwell.c b/src/npc/stockwell.c
index e72cb9c0..d305d835 100644
--- a/src/npc/stockwell.c
+++ b/src/npc/stockwell.c
@@ -66,7 +66,7 @@ void sub_080650CC(Entity* this) {
MessageNoOverlap(confirmMsgId, this);
//! @bug itemPrice (r8) is not initialized if gRoomVars.shopItemType == 0
- gMessage.field_0x10 = (u16)itemPrice;
+ gMessage.rupees = (u16)itemPrice;
} else if ((this->frame & 0x40)) {
InitializeAnimation(this, gUnk_0810FDB8[Random() & 0xf]);
} else {
diff --git a/src/npc/tingleSiblings.c b/src/npc/tingleSiblings.c
index 82eb9ee2..d7628afe 100644
--- a/src/npc/tingleSiblings.c
+++ b/src/npc/tingleSiblings.c
@@ -171,7 +171,7 @@ void sub_08064F28(Entity* this, ScriptExecutionContext* context) {
}
MessageNoOverlap(TingleSiblings_MessageIndices[this->type][uVar5], this);
if (iVar4 > 0) {
- gMessage.field_0x10 = (u16)iVar4;
+ gMessage.rupees = (u16)iVar4;
}
if (CheckRoomFlag(roomFlag) == 0) {
diff --git a/src/object.c b/src/object.c
index da1eb312..060876d7 100644
--- a/src/object.c
+++ b/src/object.c
@@ -187,7 +187,7 @@ void (*const gObjectFunctions[])(Entity*) = {
[OBJECT_B6] = ObjectB6,
[WELL] = Well,
[WIND_TRIBE_TELEPORTER] = WindTribeTeleporter,
- [OBJECT_B9] = ObjectB9,
+ [CUCCO_MINIGAME] = ObjectB9,
[GYORG_BOSS_OBJECT] = GyorgBossObject,
[WINDCREST] = Windcrest,
[LIT_AREA] = LitArea,
diff --git a/src/object/cuccoMinigame.c b/src/object/cuccoMinigame.c
new file mode 100644
index 00000000..19f63c3f
--- /dev/null
+++ b/src/object/cuccoMinigame.c
@@ -0,0 +1,358 @@
+#define NENT_DEPRECATED
+#include "entity.h"
+#include "script.h"
+#include "npc.h"
+#include "fileselect.h"
+#include "functions.h"
+#include "object.h"
+#include "enemy.h"
+
+typedef struct {
+ Entity base;
+ s16 unk68;
+ s16 unk6a;
+ s16 unk6c;
+ u16 unk6e;
+ u8 unk70[0x18];
+} ObjectB9Entity;
+
+typedef Entity* ObjectB9Heap[10];
+
+u32 sub_080A1514();
+
+const u16 gUnk_08124C20[] = {
+ 25, 0x2, 25, 0x3, 30, 0x4, 45, 0x5, 50, 0x5, 45, 0x5, 50, 0x6, 60, 0x7, 55, 0x2, 55, 0x3,
+};
+
+static const u16 pObjectB9_MinigameCuccoDefs[][30] = {
+ { 0x0001, 0x02E9, 0x0318, 0x0001, 0x0280, 0x0380, 0x0002, 0x0277, 0x0314, 0x0001,
+ 0x0332, 0x0248, 0x0001, 0x0257, 0x028C, 0x0001, 0x0199, 0x031B, 0x0001, 0x0321,
+ 0x01B4, 0x0002, 0x02DF, 0x01D8, 0x0001, 0x03AD, 0x02DE, 0x0001, 0x0216, 0x01CC },
+ { 0x0001, 0x02E9, 0x0318, 0x0001, 0x0280, 0x0380, 0x0002, 0x0277, 0x0314, 0x0001,
+ 0x0332, 0x0248, 0x0001, 0x0257, 0x028C, 0x0001, 0x0199, 0x031B, 0x0001, 0x0321,
+ 0x01B4, 0x0002, 0x02DF, 0x01D8, 0x0001, 0x03AD, 0x02DE, 0x0001, 0x0216, 0x01CC },
+ { 0x0001, 0x02E9, 0x0318, 0x0001, 0x0280, 0x0380, 0x0002, 0x0277, 0x0314, 0x0001,
+ 0x0332, 0x0248, 0x0001, 0x0257, 0x028C, 0x0001, 0x0199, 0x031B, 0x0001, 0x0321,
+ 0x01B4, 0x0002, 0x02DF, 0x01D8, 0x0001, 0x03AD, 0x02DE, 0x0001, 0x0216, 0x01CC },
+ {
+ 0x0002, 0x02F6, 0x0346, 0x0001, 0x0266, 0x033C, 0x0001, 0x0319, 0x0296, 0x0001,
+ 0x0284, 0x0284, 0x0002, 0x0216, 0x0284, 0x0001, 0x0142, 0x0330, 0x0002, 0x0179,
+ 0x039F, 0x0001, 0x03A6, 0x0280, 0x0001, 0x039A, 0x015D, 0x0001, 0x031E, 0x01E5,
+ },
+ { 0x0001, 0x0296, 0x0314, 0x0001, 0x02E6, 0x0231, 0x0001, 0x0254, 0x0290, 0x0001,
+ 0x01F8, 0x0325, 0x0001, 0x0185, 0x0367, 0x0001, 0x0320, 0x01D6, 0x0002, 0x01F8,
+ 0x0287, 0x0002, 0x029D, 0x01B1, 0x0002, 0x01F9, 0x022D, 0x0002, 0x0114, 0x0321 },
+ { 0x0002, 0x02F6, 0x0346, 0x0001, 0x0266, 0x033C, 0x0001, 0x0319, 0x0296, 0x0001,
+ 0x0284, 0x0284, 0x0002, 0x0216, 0x0284, 0x0001, 0x0142, 0x0330, 0x0002, 0x0179,
+ 0x039F, 0x0002, 0x022D, 0x01CB, 0x0001, 0x039A, 0x015D, 0x0001, 0x031E, 0x01E5 },
+ { 0x0001, 0x02E9, 0x0318, 0x0001, 0x0280, 0x0380, 0x0002, 0x0277, 0x0314, 0x0001,
+ 0x0332, 0x0248, 0x0001, 0x0257, 0x028C, 0x0001, 0x0199, 0x031B, 0x0001, 0x0321,
+ 0x01B4, 0x0002, 0x02DF, 0x01D8, 0x0001, 0x03AD, 0x02DE, 0x0001, 0x0216, 0x01CC },
+ { 0x0001, 0x02E9, 0x0318, 0x0002, 0x0280, 0x0380, 0x0002, 0x0277, 0x0314, 0x0001,
+ 0x0332, 0x0248, 0x0001, 0x0257, 0x028C, 0x0001, 0x0199, 0x031B, 0x0001, 0x0321,
+ 0x01B4, 0x0002, 0x02DF, 0x01D8, 0x0002, 0x03AD, 0x02DE, 0x0001, 0x0216, 0x01CC },
+ { 0x0001, 0x004D, 0x00F3, 0x0001, 0x011A, 0x0247, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { 0x0001, 0x0051, 0x0328, 0x0002, 0x0114, 0x0321, 0x0002, 0x0332, 0x0248, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }
+};
+
+static const u8 gUnk_08124EA0[] = { 0x3F, 0x0A, 0x01, 0x00, 0x3F, 0x0A, 0x01, 0x00, 0x3F, 0x14, 0x01, 0x00, 0x3F, 0x14,
+ 0x01, 0x00, 0x3F, 0x1E, 0x01, 0x00, 0x3F, 0x1E, 0x01, 0x00, 0x5C, 0x6E, 0x01, 0x00,
+ 0x5C, 0x6F, 0x01, 0x00, 0x5C, 0x70, 0x01, 0x00, 0x63, 0x00, 0x01, 0x00 };
+
+static const u16 CuccoMinigame_Sounds[] = { SFX_VO_CUCCO5, SFX_VO_CUCCO_CALL };
+
+static const u8 CuccoMinigameRupees[] = { 0, 10, 50, 0 };
+
+void ObjectB9(ObjectB9Entity* this) {
+ int index;
+ u32 val;
+ u8* puVar2;
+ const u16* ptr;
+
+ if (super->action == 0) {
+ super->action++;
+ ptr = gUnk_08124C20 + sub_080A1514() * 2;
+ this->unk68 = ptr[0] * 0x3c;
+ this->unk6a = 0;
+ this->unk6c = ptr[1];
+ this->unk6e = 1;
+
+ for (puVar2 = this->unk70, val = 0, index = 9; index >= 0; index--) {
+ *puVar2++ = val;
+ }
+ sub_0807DD64(super);
+ sub_0806EC20(super);
+ }
+ sub_0807DD94(super, 0);
+}
+
+NONMATCH("asm/non_matching/objectB9/sub_080A1270.inc", void sub_080A1270(ObjectB9Entity* this)) {
+ s32 iVar1;
+ int iVar2;
+ s32 iVar4;
+ s32 sVar6;
+ int iVar7;
+ s8* ptr;
+ s32 val;
+ Entity* pEnt;
+ Entity** entArray;
+
+ sVar6 = 0;
+ entArray = ((Entity**)super->myHeap);
+ ptr = this->unk70;
+ iVar1 = (gRoomControls.origin_x + 0x360);
+ iVar4 = (gRoomControls.origin_y + 0x350);
+ iVar1 = (iVar1 << 16) >> 16;
+ iVar4 = (iVar4 << 16) >> 16;
+ val = -1;
+
+ for (iVar7 = 0; iVar7 < 9; iVar7++) {
+ pEnt = entArray[iVar7];
+ if (((s8*)ptr)[iVar7] == 0) {
+ if (pEnt->next != NULL && pEnt != NULL) {
+ if ((iVar1 <= pEnt->x.HALF.HI) && (iVar4 <= pEnt->y.HALF.HI)) {
+ ptr[iVar7] = pEnt->type + 1;
+ pEnt->type2 = 1;
+ sVar6++;
+ SoundReq(CuccoMinigame_Sounds[pEnt->type]);
+ }
+ } else {
+ ((s8*)ptr)[iVar7] = val;
+ }
+ } else if (0 < (s8)ptr[iVar7]) {
+ sVar6++;
+ if (pEnt->next != NULL && pEnt != NULL) {
+ iVar2 = iVar1 + 4;
+ if (iVar2 > pEnt->x.HALF.HI) {
+ pEnt->x.HALF.HI = iVar2;
+ }
+ iVar2 = iVar4 + 4;
+ if (iVar2 > pEnt->y.HALF.HI) {
+ pEnt->y.HALF.HI = iVar2;
+ }
+ } else {
+ ((s8*)ptr)[iVar7] = val;
+ }
+ }
+ }
+
+ this->unk6a = sVar6;
+ gPlayerState.field_0x27[0] = 0xff;
+ if (--this->unk68 < 1) {
+ SoundReq(SFX_CUCCO_MINIGAME_BELL);
+ sub_08050384();
+ } else {
+ gActiveScriptInfo.commandSize = 0;
+ }
+}
+END_NONMATCH
+
+void CuccoMinigame_Cleanup(ObjectB9Entity* this) {
+ Entity** puVar1;
+ s8* pcVar2;
+ int index;
+
+ pcVar2 = this->unk70;
+ puVar1 = super->myHeap;
+
+ for (index = 9; index >= 0; index--, pcVar2++, puVar1++) {
+ Entity* pEnt = *puVar1;
+ if (*pcVar2 >= 0 && pEnt != NULL) {
+ DeleteEntityAny(pEnt);
+ }
+ }
+}
+
+void sub_080A13B4(ObjectB9Entity* this, ScriptExecutionContext* context) {
+ if (this->unk6a >= this->unk6c) {
+ MessageFromTarget(0x300c);
+ context->condition = 1;
+ } else {
+ MessageFromTarget(0x3005);
+ context->condition = 0;
+ }
+}
+
+void sub_080A13E8(ObjectB9Entity* this) {
+ bool32 bVar2;
+ const u8* ptr = &gUnk_08124EA0[sub_080A1514() * 4];
+
+ bVar2 = 0;
+ switch (ptr[0]) {
+ case 0x3f:
+ if (gSave.stats.hasAllFigurines) {
+ bVar2 = 1;
+ }
+ break;
+ case 0x5c:
+ if (gSave.didAllFusions) {
+ bVar2 = 1;
+ }
+ break;
+ case 0x63:
+ if (!CheckGlobalFlag(0x4f)) {
+ SetGlobalFlag(0x4f);
+ break;
+ }
+ bVar2 = 1;
+ break;
+ }
+
+ if (!bVar2) {
+ sub_080A7C18(ptr[0], ptr[1], 0);
+ } else {
+ this->unk6e = 2;
+ }
+}
+
+void sub_080A1460(ObjectB9Entity* this) {
+ s8* pcVar1;
+ int iVar2;
+ s32 rupees;
+ const u8* ptr;
+
+ sub_080A1514();
+ pcVar1 = this->unk70;
+ rupees = 0;
+ ptr = CuccoMinigameRupees;
+
+ for (iVar2 = 9; iVar2 >= 0; iVar2--) {
+ // Weird register addition
+ // ptr[*pcVar1] translates to add r0,r3,r0 but should be add r0,r3
+ u32 temp = *pcVar1;
+ temp += (int)ptr;
+ rupees += *(u8*)temp;
+ pcVar1++;
+ }
+ ModRupees(rupees);
+ MessageNoOverlap(0x3007, super);
+ gMessage.rupees = (u16)rupees;
+}
+
+void sub_080A14A8(void) {
+ int iVar1;
+
+ iVar1 = sub_080A1514();
+ iVar1++;
+ if (iVar1 > 9) {
+ iVar1 = 9;
+ }
+
+ if (iVar1 & 1) {
+ SetGlobalFlag(0x4b);
+ } else {
+ ClearGlobalFlag(0x4b);
+ }
+
+ if (iVar1 & 2) {
+ SetGlobalFlag(0x4c);
+ } else {
+ ClearGlobalFlag(0x4c);
+ }
+
+ if (iVar1 & 4) {
+ SetGlobalFlag(0x4d);
+ } else {
+ ClearGlobalFlag(0x4d);
+ }
+
+ if (iVar1 & 8) {
+ SetGlobalFlag(0x4e);
+ } else {
+ ClearGlobalFlag(0x4e);
+ }
+}
+
+u32 sub_080A1514(void) {
+ u32 rv = 0;
+
+ if (CheckGlobalFlag(0x4b)) {
+ rv = 1;
+ }
+
+ if (CheckGlobalFlag(0x4c)) {
+ rv |= 2;
+ }
+
+ if (CheckGlobalFlag(0x4d)) {
+ rv |= 4;
+ }
+
+ if (CheckGlobalFlag(0x4e)) {
+ rv |= 8;
+ }
+ return rv;
+}
+
+void CuccoMinigame_Init(Entity* this, ScriptExecutionContext* context) {
+ Entity* pEnt;
+ const short* pCuccoMinigameDef;
+ int index;
+ Entity** ppEVar5;
+ RoomControls* room;
+
+ context->condition = 0;
+ pEnt = CreateObject(CUCCO_MINIGAME, 0, 0);
+ if (pEnt != NULL) {
+ pEnt->myHeap = (u32*)zMalloc(sizeof(ObjectB9Heap));
+ if (pEnt->myHeap == NULL) {
+ DeleteEntityAny(pEnt);
+ } else {
+ *(ScriptExecutionContext**)&((GenericEntity*)pEnt)->cutsceneBeh =
+ (ScriptExecutionContext*)StartCutscene(pEnt, (u16*)context->intVariable);
+ pCuccoMinigameDef = pObjectB9_MinigameCuccoDefs[sub_080A1514()];
+ ppEVar5 = (Entity**)pEnt->myHeap;
+ room = &gRoomControls;
+ for (index = 9; index >= 0; index--, pCuccoMinigameDef += 3) {
+ if (pCuccoMinigameDef[0] < 1) {
+ pEnt = NULL;
+ } else {
+ pEnt = (Entity*)CreateEnemy(CUCCO_AGGR, pCuccoMinigameDef[0] - 1);
+ if (pEnt != NULL) {
+ pEnt->x.HALF.HI = room->origin_x + pCuccoMinigameDef[1];
+ pEnt->y.HALF.HI = room->origin_y + pCuccoMinigameDef[2];
+ pEnt->collisionLayer = 1;
+ }
+ }
+ *ppEVar5++ = pEnt;
+ }
+ context->condition = 1;
+ }
+ }
+}
+
+void sub_080A1608(void) {
+ u16 messageIndex;
+ const u16* ptr;
+
+ messageIndex = 0x3002;
+ if (CheckRoomFlag(1)) {
+ messageIndex = 0x3006;
+ }
+ MessageFromTarget(messageIndex);
+ gMessage.textWindowPosX = 1;
+ gMessage.textWindowPosY = 0;
+ ptr = &gUnk_08124C20[sub_080A1514() * 2];
+ gMessage.rupees = ptr[0];
+ gMessage.field_0x14 = ptr[1];
+}
+
+void sub_080A1648(void) {
+ SetTileType(0x407f, 0xd36, 1);
+ SetTileType(0x407f, 0xd37, 1);
+ SetTileType(0x407f, 0xd38, 1);
+ SetTileType(0x407e, 0xd75, 1);
+ SetTileType(0x407e, 0xe75, 1);
+}
+
+void sub_080A169C(void) {
+ sub_0807BA8C(0xd36, 1);
+ sub_0807BA8C(0xd37, 1);
+ sub_0807BA8C(0xd38, 1);
+ sub_0807BA8C(0xd75, 1);
+ sub_0807BA8C(0xe75, 1);
+}
diff --git a/src/object/figurineDevice.c b/src/object/figurineDevice.c
index df7dbdc5..22c63ddc 100644
--- a/src/object/figurineDevice.c
+++ b/src/object/figurineDevice.c
@@ -303,7 +303,7 @@ void FigurineDevice_Action4(FigurineDeviceEntity* this) {
gMessage.textWindowPosX = 1;
gMessage.textWindowPosY = 0xc;
#endif
- gMessage.field_0x10 = this->unk_81;
+ gMessage.rupees = this->unk_81;
break;
}
}
@@ -477,7 +477,7 @@ void sub_08088478(void) {
gMessage.textWindowPosX = 1;
gMessage.textWindowPosY = 0xc;
if (set0x10) {
- gMessage.field_0x10 = 5;
+ gMessage.rupees = 5;
}
#ifndef EU
gPlayerEntity.animationState = 6;
diff --git a/src/object/object96.c b/src/object/object96.c
new file mode 100644
index 00000000..2ffac509
--- /dev/null
+++ b/src/object/object96.c
@@ -0,0 +1,181 @@
+#define NENT_DEPRECATED
+#include "entity.h"
+#include "player.h"
+#include "asm.h"
+#include "functions.h"
+#include "sound.h"
+#include "item.h"
+#include "flags.h"
+#include "effects.h"
+
+typedef struct _struct_gUnk_08123FB0 {
+ void (*const funcEnt)(Entity*);
+ bool32 (*const func)(Entity*, const struct _struct_gUnk_08123FB0*);
+ s8 unk08;
+ s8 unk09;
+ u8 unk0a;
+ u8 unk0b;
+ u8 unk0c;
+ u8 type;
+ u8 unk0e;
+ u8 unk0f;
+ s32 zVelocity;
+ u32 unk14;
+ s16 speed;
+ s16 y;
+ u16 flag;
+ u8 actionDelay;
+ u8 unk1f;
+} struct_gUnk_08123FB0;
+
+static_assert(sizeof(struct_gUnk_08123FB0) == 0x20);
+
+void sub_0809D91C(Entity*);
+bool32 sub_0809D93C(Entity*, const struct_gUnk_08123FB0*);
+void Object96_Init(Entity*, const struct_gUnk_08123FB0*);
+void Object96_Action1(Entity*, const struct_gUnk_08123FB0*);
+void Object96_Action2(Entity*, const struct_gUnk_08123FB0*);
+void Object96_Action3(Entity*, const struct_gUnk_08123FB0*);
+
+static const struct_gUnk_08123FB0 gUnk_08123FB0[] = {
+ { sub_0809D91C, sub_0809D93C, 0, 0, 0x30, 0x30, 0x1, 0x3c, 0x3c, 0x13, 0x10000, 0x1800, 0x60, 0x40, 0x4021, 0x1,
+ 0x0 },
+ { sub_0809D91C, NULL, 0, 0, 0, 0, 0, 0x63, 0x63, 0x10, 0, 0x1800, 0, 0x18,
+#if defined(JP) || defined(DEMO_JP) || defined(EU)
+ 0xCD,
+#else
+ 0xd0,
+#endif
+ 0, 0 },
+ { sub_0809D91C, NULL, 0, 0, 0, 0, 0, 0x3c, 0x3c, 0xf, 0x10000, 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 },
+ { sub_0809D91C, NULL, 0, 0, 0, 0, 0, 0x3c, 0x3c, 0x2, 0x10000, 0x1800, 0x140, 0x40, 0x4021, 0x1, 0x0 },
+ { sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0xd, 0x10000, 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 },
+ { sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0x1a, 0x10000, 0x1800, 0x100, 0x40, 0x4021, 0x1, 0x0 },
+ { sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0x13, 0x10000, 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 },
+ { NULL, NULL, 0, 0, 0, 0, 0x0, 0x5c, 0x5c, 0x81, 0, 0x1800, 0x100, 0x20, 0x0, 0x1, 0x0 },
+};
+
+void Object96(Entity* this) {
+ static void (*const actionFuncs[])(Entity*, const struct_gUnk_08123FB0*) = {
+ Object96_Init,
+ Object96_Action1,
+ Object96_Action2,
+ Object96_Action3,
+ };
+ actionFuncs[this->action](this, &gUnk_08123FB0[this->type]);
+}
+
+void Object96_Init(Entity* this, const struct_gUnk_08123FB0* param_2) {
+ u32 type;
+ u32 dir;
+
+ this->action++;
+ this->collisionLayer = 2;
+ this->spriteRendering.b3 = 1;
+ this->zVelocity = param_2->zVelocity;
+ this->direction = param_2->unk0f;
+ this->speed = param_2->speed;
+ this->y.HALF.HI -= param_2->y;
+ this->z.WORD = 0;
+ this->actionDelay = param_2->actionDelay;
+ if ((this->direction & 0x80)) {
+ dir = this->direction;
+ if (dir == 0x81) {
+ this->direction = (((gPlayerEntity.animationState * 4 + (Random() & 3)) - 2) & 0x1f) ^ 0x10;
+ }
+ }
+ UpdateSpriteForCollisionLayer(this);
+ type = this->type;
+ sub_08080CB4(this);
+ this->type = type;
+}
+
+void Object96_Action1(Entity* this, const struct_gUnk_08123FB0* param_2) {
+ u32 type;
+ s32 iVar3;
+
+ iVar3 = 1;
+ if (param_2->func != NULL) {
+ iVar3 = param_2->func(this, param_2);
+ }
+ if (iVar3 != 0) {
+ this->action++;
+ this->y.HALF.HI += param_2->y;
+ this->z.HALF.HI -= param_2->y;
+ }
+ type = this->type;
+ this->type = param_2->type;
+ sub_08080CB4(this);
+ this->type = type;
+}
+
+void Object96_Action2(Entity* this, const struct_gUnk_08123FB0* param_2) {
+ u8 type;
+
+ LinearMoveUpdate(this);
+ if (sub_080044EC(this, param_2->unk14) < 2) {
+ if (this->actionDelay) {
+ this->actionDelay--;
+ this->zVelocity = param_2->unk14 << 3;
+ } else {
+ this->action++;
+ this->collisionLayer = gPlayerEntity.collisionLayer;
+ UpdateSpriteForCollisionLayer(this);
+ if (param_2->funcEnt != NULL) {
+ param_2->funcEnt(this);
+ }
+ }
+ SoundReq(SFX_RUPEE_BOUNCE);
+ }
+ type = this->type;
+ this->type = param_2->type;
+ sub_08080CB4(this);
+ this->type = type;
+}
+
+void Object96_Action3(Entity* this, const struct_gUnk_08123FB0* param_2) {
+ u8 type;
+
+ if (gPlayerState.flags & 0x80) {
+ sub_0800445C(this);
+ } else {
+ if (IsCollidingPlayer(this)) {
+ CreateItemEntity(param_2->type, this->type2, 0);
+ if (param_2->flag) {
+ SetFlag(param_2->flag);
+ }
+ DeleteThisEntity();
+ }
+ }
+ type = this->type;
+ this->type = param_2->type;
+ sub_08080CB4(this);
+ this->type = type;
+}
+
+void sub_0809D91C(Entity* this) {
+ Entity* fxEnt;
+
+ fxEnt = CreateFx(this, FX_DASH, 0);
+ if (fxEnt != NULL) {
+ SortEntityBelow(this, fxEnt);
+ }
+ SoundReq(SFX_SECRET);
+}
+
+bool32 sub_0809D93C(Entity* this, const struct_gUnk_08123FB0* param_2) {
+ u32 uVar1;
+
+ if (gPlayerEntity.action == 6 && ((param_2->unk0c >> gPlayerEntity.animationState & 1) != 0)) {
+ uVar1 = (gPlayerEntity.x.HALF.HI - this->x.HALF.HI) + param_2->unk08 + param_2->unk0a;
+ if (param_2->unk0a * 2 <= (u16)uVar1) {
+ return 0;
+ }
+
+ uVar1 = (gPlayerEntity.y.HALF.HI - (this->y.HALF.HI + param_2->y)) + param_2->unk09 + param_2->unk0b;
+ if (param_2->unk0b * 2 > (u16)uVar1) {
+ return 1;
+ }
+ }
+ return 0;
+}
diff --git a/src/object/object98.c b/src/object/object98.c
new file mode 100644
index 00000000..798836dc
--- /dev/null
+++ b/src/object/object98.c
@@ -0,0 +1,68 @@
+#define NENT_DEPRECATED
+#include "entity.h"
+#include "projectile.h"
+#include "room.h"
+#include "functions.h"
+
+typedef struct {
+ Entity base;
+ u8 filler[0xC];
+ u16 unk74;
+ u16 unk76;
+ u8 filler2[0x6];
+ u8 unk7e;
+} Object98Entity;
+
+void sub_0809E360(Object98Entity*);
+void sub_0809E3E4(Object98Entity*);
+
+void Object98(Entity* this) {
+ static void (*const actionFuncs[])(Object98Entity*) = {
+ sub_0809E360,
+ sub_0809E3E4,
+ };
+
+ actionFuncs[this->action]((Object98Entity*)this);
+}
+
+void sub_0809E360(Object98Entity* this) {
+ u32 bVar1;
+ Entity* projEnt;
+ u32 index;
+
+ if (8 < super->actionDelay) {
+ super->actionDelay = 8;
+ }
+
+ if (0x48 - super->actionDelay > gEntCount) {
+ for (index = 0; index < super->actionDelay; index++) {
+ projEnt = CreateProjectile(GURUGURU_BAR_PROJECTILE);
+ projEnt->actionDelay = 14 + 12 * index;
+ projEnt->parent = super;
+ }
+
+ super->action = 1;
+ bVar1 = this->unk7e;
+ this->unk76 = bVar1 << 8;
+ super->animationState = bVar1 << 6;
+ SetDefaultPriority(super, 0);
+ if (super->type != 0) {
+ super->child = (Entity*)GetCurrentRoomProperty(super->type);
+ sub_080A2CC0(super, (u16**)&super->child, &this->unk74);
+ }
+ }
+}
+
+void sub_0809E3E4(Object98Entity* this) {
+ this->unk76 += super->type2;
+ super->animationState = this->unk76 >> 2;
+ if (super->type != 0) {
+ if ((super->direction & 0x80) == 0) {
+ LinearMoveUpdate(super);
+ }
+
+ if (--this->unk74 == 0) {
+ sub_080A2CC0(super, (u16**)&super->child, &this->unk74);
+ }
+ }
+}
diff --git a/src/object/object99.c b/src/object/object99.c
new file mode 100644
index 00000000..e8bf6a33
--- /dev/null
+++ b/src/object/object99.c
@@ -0,0 +1,39 @@
+#include "entity.h"
+#include "coord.h"
+
+void Object99(Entity* this) {
+ Entity* parent;
+
+ parent = this->parent;
+ if (parent->next == NULL) {
+ DeleteThisEntity();
+ }
+
+ if (this->action == 0) {
+ this->action = 1;
+ this->field_0x76.HALF.LO = parent->animationState;
+ this->field_0x74.HALF.LO = this->spriteOffsetX;
+ this->field_0x74.HALF.HI = this->spriteOffsetY;
+ InitializeAnimation(this, this->animationState);
+ }
+
+ if (parent->animationState != this->field_0x76.HALF.LO) {
+ DeleteThisEntity();
+ }
+ this->spriteSettings.draw = parent->spriteSettings.draw;
+ CopyPositionAndSpriteOffset(parent, this);
+ this->spriteOffsetX += this->field_0x74.HALF.LO;
+ this->spriteOffsetY += this->field_0x74.HALF.HI;
+ if (this->animationState != 2) {
+ this->y.HALF.HI++;
+ this->spriteOffsetY--;
+ } else {
+ this->y.HALF.HI--;
+ this->spriteOffsetY++;
+ }
+
+ GetNextFrame(this);
+ if (this->frame & 0x80) {
+ DeleteThisEntity();
+ }
+}
diff --git a/src/object/objectA6.c b/src/object/objectA6.c
new file mode 100644
index 00000000..fc77a54e
--- /dev/null
+++ b/src/object/objectA6.c
@@ -0,0 +1,51 @@
+#define NENT_DEPRECATED
+#include "entity.h"
+#include "flags.h"
+#include "hitbox.h"
+#include "effects.h"
+
+typedef struct {
+ Entity base;
+ u8 filler[0x1E];
+ u16 objFlags;
+} ObjectA6Entity;
+
+void sub_0809F920(ObjectA6Entity*);
+void sub_0809F964(ObjectA6Entity*);
+
+void ObjectA6(Entity* this) {
+ static void (*const actionFuncs[])(ObjectA6Entity*) = {
+ sub_0809F920,
+ sub_0809F964,
+ };
+
+ actionFuncs[this->action]((ObjectA6Entity*)this);
+}
+
+void sub_0809F920(ObjectA6Entity* this) {
+ if (CheckFlags(this->objFlags)) {
+ DeleteThisEntity();
+ }
+
+ super->action = 1;
+ COLLISION_ON(super);
+ super->field_0x3c = 7;
+ super->hurtType = 0x48;
+ super->hitType = 1;
+ super->flags2 = 2;
+ super->hitbox = (Hitbox*)&gHitbox_0;
+}
+
+void sub_0809F964(ObjectA6Entity* this) {
+ Entity* fxEnt;
+
+ if (super->bitfield == 0xa1) {
+ fxEnt = CreateFx(super, FX_MAGIC_STORM, 0);
+ if (fxEnt != NULL) {
+ fxEnt->spritePriority.b0 = 3;
+ fxEnt->spriteOffsetY = -5;
+ }
+ SetFlag(this->objFlags);
+ DeleteThisEntity();
+ }
+}
diff --git a/src/object/objectA9.c b/src/object/objectA9.c
new file mode 100644
index 00000000..6d9981ba
--- /dev/null
+++ b/src/object/objectA9.c
@@ -0,0 +1,37 @@
+#define NENT_DEPRECATED
+#include "entity.h"
+#include "sound.h"
+
+void sub_0809FEF8(Entity*);
+void sub_0809FF28(Entity*);
+
+void ObjectA9(Entity* this) {
+ static void (*const actionFuncs[])(Entity*) = {
+ sub_0809FEF8,
+ sub_0809FF28,
+ DeleteEntity,
+ };
+
+ actionFuncs[this->action]((Entity*)this);
+}
+
+void sub_0809FEF8(Entity* this) {
+ static const u8 typeAnimationStates[] = { 0x2, 0x0, 0x43, 0x0 };
+ static const u16 typeSounds[] = { SFX_124, SFX_197, SFX_11D, SFX_NONE };
+ this->action = 1;
+ InitializeAnimation(this, typeAnimationStates[this->type]);
+ SoundReq(typeSounds[this->type]);
+}
+
+void sub_0809FF28(Entity* this) {
+ Entity* pEVar1;
+
+ GetNextFrame(this);
+ if (this->frame & 0x80) {
+ this->action = 2;
+ pEVar1 = this->parent;
+ pEVar1->flags = this->actionDelay;
+ pEVar1->spriteSettings.draw = this->field_0xf;
+ ((GenericEntity*)pEVar1)->field_0x6c.HALF.HI &= 0xef;
+ }
+}
diff --git a/src/object/objectAB.c b/src/object/objectAB.c
new file mode 100644
index 00000000..767c5238
--- /dev/null
+++ b/src/object/objectAB.c
@@ -0,0 +1,59 @@
+#define NENT_DEPRECATED
+#include "entity.h"
+#include "flags.h"
+#include "asm.h"
+#include "player.h"
+#include "coord.h"
+
+extern void sub_0805B390(u32);
+
+void ObjectAB_Init(Entity*);
+void ObjectAB_Action1(Entity*);
+void ObjectAB_Action2(Entity*);
+void sub_080A0190(Entity*);
+
+void ObjectAB(Entity* this) {
+ static void (*const actionFuncs[])(Entity*) = {
+ ObjectAB_Init,
+ ObjectAB_Action1,
+ ObjectAB_Action2,
+ };
+
+ actionFuncs[this->action]((Entity*)this);
+}
+
+void ObjectAB_Init(Entity* this) {
+ this->action++;
+ this->collisionLayer = 1;
+ this->spriteRendering.b3 = 3;
+ this->spritePriority.b0 = 7;
+ this->subAction = 0;
+ InitializeAnimation(this, 0);
+}
+
+void ObjectAB_Action1(Entity* this) {
+ if (CheckRoomFlag(0)) {
+ GetNextFrame(this);
+ if (this->frame & 0x80) {
+ this->action++;
+ }
+ }
+}
+
+void ObjectAB_Action2(Entity* this) {
+ if (CheckRoomFlag(1)) {
+ sub_080A0190(this);
+ RequestPriorityDuration(this, 0x1e);
+ if (EntityInRectRadius(this, &gPlayerEntity, 0x10, 0x10)) {
+ sub_0805B390(0x37);
+ }
+ }
+}
+
+void sub_080A0190(Entity* this) {
+ this->subAction = 1;
+ CopyPosition(this, &gPlayerEntity);
+ gPlayerState.queued_action = 3;
+ gPlayerState.field_0x38 = 0;
+ gPlayerState.flags |= PL_PIT_IS_EXIT;
+}
diff --git a/src/object/objectAD.c b/src/object/objectAD.c
new file mode 100644
index 00000000..ca73277e
--- /dev/null
+++ b/src/object/objectAD.c
@@ -0,0 +1,54 @@
+#define NENT_DEPRECATED
+#include "entity.h"
+#include "functions.h"
+#include "screen.h"
+
+void sub_080A04A4(Entity*);
+void sub_080A04E0(Entity*);
+void sub_080A04E8();
+
+void ObjectAD(Entity* this) {
+ static void (*const actionFuncs[])(Entity*) = {
+ sub_080A04A4,
+ sub_080A04E0,
+ };
+
+ actionFuncs[this->action]((Entity*)this);
+}
+
+void sub_080A04A4(Entity* this) {
+ this->action = 1;
+ this->frameIndex = 4;
+ this->actionDelay = 0;
+ this->spriteRendering.b3 = 3;
+ this->spritePriority.b0 = 7;
+ this->z.WORD = 0;
+ this->spriteRendering.alphaBlend = 1;
+ sub_080A04E8();
+}
+
+void sub_080A04E0(Entity* this) {
+ sub_080A04E8();
+}
+
+void sub_080A04E8(Entity* this) {
+ int iVar2;
+ u32 uVar3;
+
+ iVar2 = (this->parent->z.HALF.HI < 0 ? -this->parent->z.HALF.HI : this->parent->z.HALF.HI) + 0x100;
+ SetAffineInfo(this, iVar2, iVar2, 0);
+ iVar2 = ((0x1c0 - iVar2) * 10) / iVar2;
+ if (this->parent->type == 0x41) {
+ uVar3 = iVar2 * 2;
+ if (0xc < uVar3) {
+ uVar3 = 0xc;
+ }
+ iVar2 = (0x10 - iVar2) * 0x100;
+ iVar2 |= uVar3;
+ iVar2 &= 0xffff;
+ } else {
+ iVar2 |= (0x10 - iVar2) * 0x100;
+ iVar2 &= 0xffff;
+ }
+ gScreen.controls.alphaBlend = iVar2;
+}
diff --git a/src/object/objectB.c b/src/object/objectB.c
index f0cfc4e5..fbf4ef50 100644
--- a/src/object/objectB.c
+++ b/src/object/objectB.c
@@ -124,7 +124,7 @@ void ObjectB_Action2(ObjectBEntity* this) {
break;
}
MessageFromTarget(messageIndex);
- gMessage.field_0x10 = super->type2;
+ gMessage.rupees = super->type2;
}
}
}
diff --git a/src/object/objectB4.c b/src/object/objectB4.c
new file mode 100644
index 00000000..90c3b287
--- /dev/null
+++ b/src/object/objectB4.c
@@ -0,0 +1,135 @@
+#define NENT_DEPRECATED
+#include "entity.h"
+#include "menu.h"
+#include "coord.h"
+#include "object.h"
+
+extern void sub_0806FB00(Entity*, u32, u32, u32);
+extern bool32 sub_0806FB38(Entity*);
+
+void ObjectB4_Type0(Entity*);
+void ObjectB4_Type1(Entity*);
+void ObjectB4_Type2(Entity*);
+void ObjectB4_Type3(Entity*);
+
+const u16 gUnk_08124B10[] = { 0x40, 0x58, 0x68, 0x80, 0x94, 0xA8, 0xB0, 0x0 };
+
+void ObjectB4(Entity* this) {
+ static void (*const typeFuncs[])(Entity*) = {
+ ObjectB4_Type0,
+ ObjectB4_Type1,
+ ObjectB4_Type2,
+ ObjectB4_Type3,
+ };
+
+ typeFuncs[this->type]((Entity*)this);
+}
+
+void ObjectB4_Type0(Entity* this) {
+ Entity* pEVar3;
+
+ switch (this->action) {
+ case 0:
+ this->action = 1;
+ this->spriteSettings.draw = 2;
+ this->frameIndex = 9;
+ this->actionDelay = 8;
+ this->field_0xf = 0;
+ this->spriteRendering.b3 = 1;
+ this->spritePriority.b0 = 4;
+ this->spriteOrientation.flipY = 1;
+ sub_0806FB00(this, 0xbf, 0x48, 0x1e);
+ break;
+ case 1:
+ if ((this->field_0xf < 7) && (--this->actionDelay == 0)) {
+ this->actionDelay = 1;
+ pEVar3 = CreateObject(OBJECT_B4, 1, this->field_0xf);
+ if (pEVar3 != NULL) {
+ CopyPosition(this, pEVar3);
+ pEVar3->y.HALF.HI = 0x68;
+ SortEntityBelow(this, pEVar3);
+ }
+ this->field_0xf++;
+ }
+
+ if (sub_0806FB38(this) || (1 < gMenu.menuType)) {
+ this->x.HALF.HI = 0xbf;
+ this->y.HALF.HI = 0x48;
+ this->frameIndex = 10;
+ this->action = 2;
+ while (this->field_0xf < 7) {
+ pEVar3 = CreateObject(OBJECT_B4, 1, this->field_0xf);
+ if (pEVar3 != NULL) {
+ CopyPosition(this, pEVar3);
+ pEVar3->y.HALF.HI = 0x68;
+ SortEntityBelow(this, pEVar3);
+ }
+ this->field_0xf++;
+ }
+
+ pEVar3 = CreateObject(OBJECT_B4, 2, 0);
+ if (pEVar3 != NULL) {
+ pEVar3->x.HALF.HI = 0xc4;
+ pEVar3->y.HALF.HI = 0x2c;
+ SortEntityAbove(this, pEVar3);
+ }
+
+ pEVar3 = CreateObject(OBJECT_B4, 3, 0);
+ if (pEVar3 != NULL) {
+ pEVar3->x.HALF.HI = 0xb4;
+ pEVar3->y.HALF.HI = 0x19;
+ SortEntityAbove(this, pEVar3);
+ }
+ }
+ }
+}
+
+void ObjectB4_Type1(Entity* this) {
+ switch (this->action) {
+ case 0:
+ this->action = 1;
+ this->spriteSettings.draw = 2;
+ this->frameIndex = this->type2 + 2;
+ sub_0806FB00(this, gUnk_08124B10[this->type2], 0x68, 0x14);
+ break;
+ case 1:
+ if (sub_0806FB38(this) || 1 < gMenu.menuType) {
+ this->x.HALF.HI = gUnk_08124B10[this->type2];
+ this->y.HALF.HI = 0x68;
+ this->spritePriority.b0 = 7 - this->type2;
+ this->action = 2;
+ }
+ break;
+ }
+}
+
+void ObjectB4_Type2(Entity* this) {
+ static const u8 gUnk_08124B30[] = { 9, 10, 11, 12, 11, 10, 9, -1 };
+ if (this->action == 0) {
+ this->action = 1;
+ this->spriteSettings.draw = 2;
+ this->spriteRendering.b3 = 1;
+ this->spritePriority.b0 = 0;
+ this->spriteOrientation.flipY = 1;
+ this->frameIndex = 11;
+ this->actionDelay = (Random() & 0x3f) + 0x40;
+ this->field_0xf = 0;
+ }
+
+ if (--this->actionDelay == 0) {
+ this->actionDelay = 4;
+ this->frameIndex = gUnk_08124B30[this->field_0xf++] + 2;
+ if (gUnk_08124B30[this->field_0xf] == 0xff) {
+ this->actionDelay = (Random() & 0x3f) + 0x40;
+ this->field_0xf = 0;
+ }
+ }
+}
+
+void ObjectB4_Type3(Entity* this) {
+ if (this->action == 0) {
+ this->action = 1;
+ this->spriteSettings.draw = 2;
+ this->frameIndex = 15;
+ }
+}
diff --git a/src/script.c b/src/script.c
index a6a4e36c..8fb780b8 100644
--- a/src/script.c
+++ b/src/script.c
@@ -1884,7 +1884,7 @@ void sub_0807F78C(Entity* entity, ScriptExecutionContext* context) {
msg = GetSaleItemConfirmMessageID(item);
price = GetItemPrice(item);
MessageNoOverlap(msg, entity);
- gMessage.field_0x10 = (u16)price;
+ gMessage.rupees = (u16)price;
}
void sub_0807F7C4(Entity* entity, ScriptExecutionContext* context) {
@@ -1929,7 +1929,7 @@ void sub_0807F854(Entity* entity, ScriptExecutionContext* context) {
switch (idx) {
case 0:
case 1:
- gMessage.field_0x10 = value;
+ gMessage.rupees = value;
break;
case 2:
gMessage.field_0x14 = value;