This commit is contained in:
theo3
2021-12-19 18:09:02 -08:00
parent 3c4e1762d9
commit 29c0ee1844
8 changed files with 110 additions and 48 deletions
+23 -21
View File
@@ -6,6 +6,7 @@
#include "audio.h"
#include "flags.h"
#include "textbox.h"
#include "object.h"
Entity* GiveItemWithCutscene(u32, u32, u32);
Entity* sub_080A276C(Entity*, u32, u32);
@@ -13,15 +14,15 @@ void sub_08078AF0(Entity*, u32, u32);
Entity* sub_0805E744(void);
void sub_080A7D44(u32, u32);
void CreateItemEntity(u32 a, u32 b, u32 c) {
Entity* e = GiveItemWithCutscene(a, b, c);
void CreateItemEntity(u32 type, u32 type2, u32 delay) {
Entity* e = GiveItemWithCutscene(type, type2, delay);
if (e != NULL) {
e->parent = sub_080A276C(e, e->type, 0);
}
}
void sub_080A7C18(u32 a, u32 b, u32 c) {
Entity* e = GiveItemWithCutscene(a, b, c);
void sub_080A7C18(u32 type, u32 type2, u32 delay) {
Entity* e = GiveItemWithCutscene(type, type2, delay);
if (e != NULL) {
e->parent = &gPlayerEntity;
sub_08078AF0(e, e->type, 0);
@@ -39,19 +40,19 @@ Entity* GiveItemWithCutscene(u32 type, u32 type2, u32 delay) {
e->type = type;
e->type2 = type2;
e->actionDelay = delay;
e->id = 11;
e->kind = 6;
e->id = OBJECT_B;
e->kind = OBJECT;
AppendEntityToList(e, 6);
}
return e;
}
void sub_080A7C7C(void) {
MemClear(gUnk_02017660, 0x40);
void ClearSmallChests(void) {
MemClear(gSmallChests, 0x40);
}
void sub_080A7C8C(u32 pos, u32 layer) {
TileEntity* t = gUnk_02017660;
TileEntity* t = gSmallChests;
u32 found = 0;
u32 i;
for (i = 0; i < 8; ++i, ++t) {
@@ -69,25 +70,25 @@ void sub_080A7C8C(u32 pos, u32 layer) {
}
sub_0807B7D8(0x74, pos, layer);
RequestPriorityDuration(NULL, 120);
SoundReq(283);
SoundReq(SFX_11B);
}
}
u32 sub_080A7CFC(u32 a1) {
u32 ta = 0x600;
u32 tb = 0;
u32 msg = 0x600;
u32 isTileEntity6 = 0;
TileEntity* t = GetCurrentRoomProperty(3);
if (t != 0) {
do {
if (t->_4 == a1) {
switch (t->type) {
case 5:
tb = 0;
ta = *(u16*)&t->_6;
case SIGN:
isTileEntity6 = 0;
msg = *(u16*)&t->_6;
break;
case 6:
tb = 1;
ta = *(u16*)&t->_6;
case TILE_ENTITY_6:
isTileEntity6 = 1;
msg = *(u16*)&t->_6;
break;
}
break;
@@ -95,12 +96,13 @@ u32 sub_080A7CFC(u32 a1) {
t++;
} while (t->_4 != 0);
}
sub_080A7D44(ta, tb);
sub_080A7D44(msg, isTileEntity6);
}
void sub_080A7D44(u32 msg, u32 a2) {
if (a2)
void sub_080A7D44(u32 msg, u32 isTileEntity6) {
if (isTileEntity6)
sub_08078AA8(msg, 0);
else
// Read sign text
MessageFromTarget(msg);
}
+5 -5
View File
@@ -17,7 +17,7 @@ extern u8 gUnk_081091E4[];
extern void sub_080186EC();
extern void sub_0804B16C();
extern void sub_080A7C7C(void);
extern void ClearSmallChests(void);
extern Entity* GetEmptyEntityByKind(u32 kind);
void RegisterRoomEntity(Entity*, EntityData*);
@@ -134,7 +134,7 @@ void sub_0804AF0C(Entity* ent, EntityData* dat) {
void sub_0804AF90(void) {
sub_0804AFB0(gArea.pCurrentRoomInfo->properties);
sub_080A7C7C();
ClearSmallChests();
}
void sub_0804AFB0(void** properties) {
@@ -254,12 +254,12 @@ void* GetCurrentRoomProperty(u32 idx) {
}
void sub_0804B16C(void) {
TileEntity* tile = gUnk_02017660;
TileEntity* tile = gSmallChests;
do {
if (tile->_4 != 0 && CheckLocalFlag(tile->_1)) {
SetTileType(0x74, tile->_4, tile->_6 & 1 ? 2 : 1);
}
} while (++tile < gUnk_02017660 + 8);
} while (++tile < gSmallChests + 8);
}
void LoadRoomTileEntities(TileEntity* list) {
@@ -315,7 +315,7 @@ static void sub_0804B290(TileEntity* tile) {
}
static void sub_0804B29C(TileEntity* tile) {
TileEntity* t = gUnk_02017660;
TileEntity* t = gSmallChests;
u32 i = 0;
for (i = 0; i < 8; ++i, ++t) {
if (!t->_4) {