summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/kinstone.c24
-rw-r--r--src/object/objectOnPillar.c6
-rw-r--r--src/playerItemUtils.c8
-rw-r--r--src/room.c28
-rw-r--r--src/roomInit.c5
-rw-r--r--src/subtask.c11
6 files changed, 48 insertions, 34 deletions
diff --git a/src/kinstone.c b/src/kinstone.c
index f9f4b5f8..1c42e02f 100644
--- a/src/kinstone.c
+++ b/src/kinstone.c
@@ -1,5 +1,29 @@
#include "global.h"
#include "room.h"
+#include "subtask.h"
+#include "common.h"
+#include "flags.h"
+
+void sub_08018BB4(int param_1) {
+ u32 layer;
+ TileEntity tile;
+ struct_080FE320* ptr;
+ u32 position;
+
+ MemCopy(gUnk_080FEAC8 + param_1, &tile, sizeof(TileEntity));
+ ptr = &gUnk_080FE320[param_1];
+ tile.tilePos = (ptr->x >> 4 & 0x3f) | (((ptr->y) >> 4 & 0x3f) << 6);
+ sub_0804B3C4(&tile);
+ if (CheckLocalFlag(tile.localFlag) == 0) {
+ position = tile.tilePos;
+ if ((tile._6 & 1) == 0) {
+ layer = 1;
+ } else {
+ layer = 2;
+ }
+ SetTileType(0x73, position, layer);
+ }
+}
void CreateMinishEntrance(u32 tilePos) {
u32 x, y;
diff --git a/src/object/objectOnPillar.c b/src/object/objectOnPillar.c
index 7f0456c8..5b5e8010 100644
--- a/src/object/objectOnPillar.c
+++ b/src/object/objectOnPillar.c
@@ -294,9 +294,9 @@ void sub_080971E0(ObjectOnPillarEntity* this) {
bool32 sub_08097348(u32 tilePosition) {
u32 index;
TileEntity* tileEntity = gSmallChests;
- for (index = 0; index < 8; index++, tileEntity++) {
- if (tileEntity->_4 == tilePosition) {
- return CheckLocalFlag(tileEntity->_1);
+ for (index = 0; index < ARRAY_COUNT(gSmallChests); index++, tileEntity++) {
+ if (tileEntity->tilePos == tilePosition) {
+ return CheckLocalFlag(tileEntity->localFlag);
}
}
return FALSE;
diff --git a/src/playerItemUtils.c b/src/playerItemUtils.c
index 8364caf3..aa1d15a0 100644
--- a/src/playerItemUtils.c
+++ b/src/playerItemUtils.c
@@ -56,14 +56,14 @@ void sub_080A7C8C(u32 pos, u32 layer) {
u32 found = 0;
u32 i;
for (i = 0; i < 8; ++i, ++t) {
- if (*(u16*)&t->_4 == pos) {
+ if (*(u16*)&t->tilePos == pos) {
found = 1;
break;
}
}
if ((layer >> 1) == ((u32)(t->_6 << 31) >> 31)) {
if (found) {
- SetLocalFlag(t->_1);
+ SetLocalFlag(t->localFlag);
CreateItemEntity(t->_2, t->_3, 0);
} else {
CreateItemEntity(0x60, 0, 0);
@@ -81,7 +81,7 @@ u32 sub_080A7CFC(u32 a1) {
TileEntity* t = GetCurrentRoomProperty(3);
if (t != 0) {
do {
- if (t->_4 == a1) {
+ if (t->tilePos == a1) {
switch (t->type) {
case SIGN:
hint = FALSE;
@@ -95,7 +95,7 @@ u32 sub_080A7CFC(u32 a1) {
break;
}
t++;
- } while (t->_4 != 0);
+ } while (t->tilePos != 0);
}
InitTileMessage(msg, hint);
}
diff --git a/src/room.c b/src/room.c
index 92c4057a..f1051403 100644
--- a/src/room.c
+++ b/src/room.c
@@ -251,8 +251,8 @@ void* GetCurrentRoomProperty(u32 idx) {
void sub_0804B16C(void) {
TileEntity* tile = gSmallChests;
do {
- if (tile->_4 != 0 && CheckLocalFlag(tile->_1)) {
- SetTileType(0x74, tile->_4, tile->_6 & 1 ? 2 : 1);
+ if (tile->tilePos != 0 && CheckLocalFlag(tile->localFlag)) {
+ SetTileType(0x74, tile->tilePos, tile->_6 & 1 ? 2 : 1);
}
} while (++tile < gSmallChests + 8);
}
@@ -297,28 +297,28 @@ void LoadRoomTileEntities(TileEntity* list) {
}
static void LoadGrassDropTile(TileEntity* tile) {
- MemCopy(&gAreaDroptables[tile->_1], &gRoomVars.currentAreaDroptable, 0x20);
+ MemCopy(&gAreaDroptables[tile->localFlag], &gRoomVars.currentAreaDroptable, 0x20);
}
static void LoadLocationTile(TileEntity* tile) {
- gArea.locationIndex = tile->_1;
+ gArea.locationIndex = tile->localFlag;
sub_08054524();
}
static void LoadRoomVisitTile(TileEntity* tile) {
- SetLocalFlag(tile->_1);
+ SetLocalFlag(tile->localFlag);
}
static void LoadSmallChestTile(TileEntity* tile) {
TileEntity* t = gSmallChests;
u32 i = 0;
for (i = 0; i < 8; ++i, ++t) {
- if (!t->_4) {
+ if (!t->tilePos) {
MemCopy(tile, t, sizeof(TileEntity));
- if ((t->_6 & 1) && (gRoomControls.scroll_flags & 2) && !CheckLocalFlag(t->_1)) {
- Entity* e = CreateObject(OBJECT_52, t->_1, 0);
+ if ((t->_6 & 1) && (gRoomControls.scroll_flags & 2) && !CheckLocalFlag(t->localFlag)) {
+ Entity* e = CreateObject(OBJECT_52, t->localFlag, 0);
if (e != NULL) {
- sub_0806F704(e, t->_4);
+ sub_0806F704(e, t->tilePos);
}
}
return;
@@ -331,10 +331,10 @@ static void LoadBombableWallTile(TileEntity* tile) {
if (mgr != NULL) {
mgr->manager.type = 9;
mgr->manager.subtype = 0x24;
- mgr->x = tile->_4;
+ mgr->x = tile->tilePos;
mgr->y = *(u16*)&tile->_6;
mgr->field_0x35 = tile->_2;
- mgr->field_0x3e = tile->_1;
+ mgr->field_0x3e = tile->localFlag;
AppendEntityToList((Entity*)mgr, 6);
}
}
@@ -345,7 +345,7 @@ static void LoadDarknessTile(TileEntity* tile) {
static void LoadDestructibleTile(TileEntity* tile) {
if (CheckLocalFlag(*(u16*)&tile->_2)) {
- SetTileType(*(u16*)&tile->_6, tile->_4, tile->_1);
+ SetTileType(*(u16*)&tile->_6, tile->tilePos, tile->localFlag);
} else if (!gRoomVars.filler_0x1) {
Manager* mgr;
gRoomVars.filler_0x1 = 1;
@@ -369,6 +369,6 @@ void sub_0804B388(u32 a1, u32 a2) {
sub_080526F8(-1);
}
-void sub_0804B3C4(void* arg0) {
- LoadSmallChestTile(arg0);
+void sub_0804B3C4(TileEntity* tile) {
+ LoadSmallChestTile(tile);
}
diff --git a/src/roomInit.c b/src/roomInit.c
index 680b3a2d..d48595ed 100644
--- a/src/roomInit.c
+++ b/src/roomInit.c
@@ -4681,10 +4681,7 @@ u32 sub_unk3_SimonsSimulation_Main(void) {
extern u8* gUnk_080F0D58[4];
extern Entity* gUnk_080F0CB8[15];
extern u8* gUnk_080F0E08[];
-extern struct {
- u32 unk_00;
- u32 unk_04;
-} gUnk_080F0E1C[];
+extern TileEntity gUnk_080F0E1C[];
void sub_StateChange_SimonsSimulation_Main(void) {
u32 r;
diff --git a/src/subtask.c b/src/subtask.c
index 2c847d87..4adbe0bd 100644
--- a/src/subtask.c
+++ b/src/subtask.c
@@ -90,13 +90,6 @@ extern void (*const gUnk_080FF330[])(void);
void sub_08055994(void);
-typedef struct {
- u8 unk_0[6];
- u8 unk_6;
- u8 unk_7;
-} struct_080FEAC8;
-extern struct_080FEAC8 gUnk_080FEAC8[];
-
extern void (*const gUnk_080FF35C[])(void);
extern const EntityData gUnk_080FF33C[];
@@ -676,8 +669,8 @@ void sub_08055978(void) {
void sub_08055994(void) {
u32 layer;
- struct_080FEAC8* ptr = &gUnk_080FEAC8[gMenu.field_0x4];
- if ((ptr->unk_6 & 1) != 0) {
+ TileEntity* ptr = &gUnk_080FEAC8[gMenu.field_0x4];
+ if ((ptr->_6 & 1) != 0) {
layer = 2;
} else {
layer = 1;