diff options
| author | octorock <79596758+octorock@users.noreply.github.com> | 2022-12-11 12:07:48 +0100 |
|---|---|---|
| committer | octorock <79596758+octorock@users.noreply.github.com> | 2022-12-11 12:07:48 +0100 |
| commit | 1d741c182dec03c6c7a6ea337f351eedf7d6eb65 (patch) | |
| tree | 7a1fc484cc98a123a562ed5bb2e03e85b6f28e95 /src/object/button.c | |
| parent | 017eb5a65efe06ab338f7d6a3bdd1188fcca6c3e (diff) | |
Extract dungeon maps
Diffstat (limited to 'src/object/button.c')
| -rw-r--r-- | src/object/button.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/object/button.c b/src/object/button.c index 33dfcefe..ee153546 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -208,35 +208,36 @@ extern u16 gMapDataTopSpecial[0x2000]; extern u16 gMapDataBottomSpecial[]; void sub_08081E6C(Entity* this) { - u32 r4; + u32 tileType; LayerStruct* r1; u16* tmp2; u16* tmp; u16* tmp3; - u32 r6 = this->field_0x74.HWORD; - u32 r5 = this->collisionLayer; - u32 tile = GetTileType(r6, r5); + u32 tilePosition = this->field_0x74.HWORD; + u32 layer = this->collisionLayer; + u32 tile = GetTileType(tilePosition, layer); if (tile < 0x4000) return; - r1 = GetLayerByIndex(r5); - r4 = (this->type == 0 ? 0x7a : 0x78); + r1 = GetLayerByIndex(layer); + tileType = (this->type == 0 ? 0x7a : 0x78); tmp = r1->metatiles; - tmp = tmp + (r1->unkData2[r4] << 2); - tmp2 = (r5 == 2 ? gMapDataTopSpecial : gMapDataBottomSpecial); - tmp2 += (((0x3f & r6) << 1) + ((0xfc0 & r6) << 2)); + tmp = tmp + (r1->unkData2[tileType] << 2); + tmp2 = (layer == 2 ? gMapDataTopSpecial : gMapDataBottomSpecial); + tmp2 += (((0x3f & tilePosition) << 1) + ((0xfc0 & tilePosition) << 2)); if (sub_08081F00((u32*)tmp2, (u32*)tmp)) return; - SetTileType(r4, r6, r5); - SetTile(tile, r6, r5); + SetTileType(tileType, tilePosition, layer); + SetTile(tile, tilePosition, layer); } -u32 sub_08081F00(u32* unk1, u32* unk2) { - if (*unk1 != *unk2) - return 0; - if (unk1[0x40] != unk2[1]) - return 0; - return 1; +// Are the two tiles already set to the correct one +bool32 sub_08081F00(u32* screenblock, u32* metatileList) { + if (screenblock[0] != metatileList[0]) + return FALSE; + if (screenblock[0x40] != metatileList[1]) + return FALSE; + return TRUE; } void sub_08081F24(Entity* this) { |
