Use metatile enum

This commit is contained in:
octorock
2023-07-05 18:30:27 +02:00
parent f89bb66911
commit b6a94d5062
155 changed files with 5374 additions and 3749 deletions
+41 -40
View File
@@ -91,7 +91,8 @@ u32 BombableWallManager_GetBombableType(u32 metaTilePos, u32 layer) {
void BombableWallManager_DestroyWall(BombableWallManager* this) {
static void (*const gUnk_08108CE8[])(u32, u32) = {
BombableWallManager_DestroyWall0, BombableWallManager_DestroyWall1, BombableWallManager_DestroyWall2, BombableWallManager_DestroyWall3, BombableWallManager_DestroyWall4,
BombableWallManager_DestroyWall0, BombableWallManager_DestroyWall1, BombableWallManager_DestroyWall2,
BombableWallManager_DestroyWall3, BombableWallManager_DestroyWall4,
};
if (super->type != 0xff) {
gUnk_08108CE8[super->type](this->metaTilePos, this->layer);
@@ -99,11 +100,11 @@ void BombableWallManager_DestroyWall(BombableWallManager* this) {
}
void BombableWallManager_DestroyWall0(u32 metaTilePos, u32 layer) {
SetMetaTileType(META_TILE_TYPE_177, metaTilePos - 0x41, layer);
SetMetaTileType(META_TILE_TYPE_178, metaTilePos - 0x40, layer);
SetMetaTileType(META_TILE_TYPE_179, metaTilePos - 0x3f, layer);
SetMetaTileType(META_TILE_TYPE_180, metaTilePos - 1, layer);
SetMetaTileType(META_TILE_TYPE_183, metaTilePos + 1, layer);
SetMetaTileType(META_TILE_TYPE_177, metaTilePos + TILE_POS(-1, -1), layer);
SetMetaTileType(META_TILE_TYPE_178, metaTilePos + TILE_POS(0, -1), layer);
SetMetaTileType(META_TILE_TYPE_179, metaTilePos + TILE_POS(1, -1), layer);
SetMetaTileType(META_TILE_TYPE_180, metaTilePos + TILE_POS(-1, 0), layer);
SetMetaTileType(META_TILE_TYPE_183, metaTilePos + TILE_POS(1, 0), layer);
if (layer == LAYER_BOTTOM) {
if (AreaHasEnemies()) {
Entity* object = CreateObject(ARCHWAY, 0xe, 0);
@@ -120,9 +121,9 @@ void BombableWallManager_DestroyWall0(u32 metaTilePos, u32 layer) {
}
}
SetMetaTileType(META_TILE_TYPE_184, metaTilePos - 0x41, LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_185, metaTilePos - 0x40, LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_186, metaTilePos - 0x3f, LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_184, metaTilePos + TILE_POS(-1, -1), LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_185, metaTilePos + TILE_POS(0, -1), LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_186, metaTilePos + TILE_POS(1, -1), LAYER_TOP);
} else {
Entity* object;
SetMetaTileType(META_TILE_TYPE_181, metaTilePos, LAYER_TOP);
@@ -142,11 +143,11 @@ void BombableWallManager_DestroyWall0(u32 metaTilePos, u32 layer) {
void BombableWallManager_DestroyWall1(u32 metaTilePos, u32 layer) {
Entity* object;
SetMetaTileType(META_TILE_TYPE_241, metaTilePos - 0x40, layer);
SetMetaTileType(META_TILE_TYPE_245, metaTilePos - 0x3f, layer);
SetMetaTileType(META_TILE_TYPE_246, metaTilePos + 1, layer);
SetMetaTileType(META_TILE_TYPE_244, metaTilePos + 0x40, layer);
SetMetaTileType(META_TILE_TYPE_247, metaTilePos + 0x41, layer);
SetMetaTileType(META_TILE_TYPE_241, metaTilePos + TILE_POS(0, -1), layer);
SetMetaTileType(META_TILE_TYPE_245, metaTilePos + TILE_POS(1, -1), layer);
SetMetaTileType(META_TILE_TYPE_246, metaTilePos + TILE_POS(1, 0), layer);
SetMetaTileType(META_TILE_TYPE_244, metaTilePos + TILE_POS(0, 1), layer);
SetMetaTileType(META_TILE_TYPE_247, metaTilePos + TILE_POS(1, 1), layer);
if (layer == LAYER_BOTTOM) {
if (AreaHasEnemies()) {
@@ -163,9 +164,9 @@ void BombableWallManager_DestroyWall1(u32 metaTilePos, u32 layer) {
SetMetaTileType(META_TILE_TYPE_243, metaTilePos, LAYER_BOTTOM);
}
}
SetMetaTileType(META_TILE_TYPE_248, metaTilePos - 0x3f, LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_248, metaTilePos + TILE_POS(1, -1), LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_249, metaTilePos + 1, LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_250, metaTilePos + 0x41, LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_250, metaTilePos + TILE_POS(1, 1), LAYER_TOP);
} else {
SetMetaTileType(META_TILE_TYPE_242, metaTilePos, LAYER_TOP);
if (!AreaIsDungeon()) {
@@ -184,11 +185,11 @@ void BombableWallManager_DestroyWall1(u32 metaTilePos, u32 layer) {
void BombableWallManager_DestroyWall2(u32 metaTilePos, u32 layer) {
Entity* object;
SetMetaTileType(META_TILE_TYPE_209, metaTilePos - 1, layer);
SetMetaTileType(META_TILE_TYPE_212, metaTilePos + 1, layer);
SetMetaTileType(META_TILE_TYPE_213, metaTilePos + 0x3f, layer);
SetMetaTileType(META_TILE_TYPE_214, metaTilePos + 0x40, layer);
SetMetaTileType(META_TILE_TYPE_215, metaTilePos + 0x41, layer);
SetMetaTileType(META_TILE_TYPE_209, metaTilePos + TILE_POS(-1, 0), layer);
SetMetaTileType(META_TILE_TYPE_212, metaTilePos + TILE_POS(1, 0), layer);
SetMetaTileType(META_TILE_TYPE_213, metaTilePos + TILE_POS(-1, 1), layer);
SetMetaTileType(META_TILE_TYPE_214, metaTilePos + TILE_POS(0, 1), layer);
SetMetaTileType(META_TILE_TYPE_215, metaTilePos + TILE_POS(1, 1), layer);
if (layer == LAYER_BOTTOM) {
if (AreaHasEnemies()) {
object = CreateObject(ARCHWAY, 0xe, 2);
@@ -204,9 +205,9 @@ void BombableWallManager_DestroyWall2(u32 metaTilePos, u32 layer) {
SetMetaTileType(META_TILE_TYPE_211, metaTilePos, LAYER_BOTTOM);
}
}
SetMetaTileType(META_TILE_TYPE_216, metaTilePos + 0x3f, LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_217, metaTilePos + 0x40, LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_218, metaTilePos + 0x41, LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_216, metaTilePos + TILE_POS(-1, 1), LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_217, metaTilePos + TILE_POS(0, 1), LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_218, metaTilePos + TILE_POS(1, 1), LAYER_TOP);
} else {
SetMetaTileType(META_TILE_TYPE_210, metaTilePos, LAYER_TOP);
if (AreaIsDungeon() == 0) {
@@ -225,11 +226,11 @@ void BombableWallManager_DestroyWall2(u32 metaTilePos, u32 layer) {
void BombableWallManager_DestroyWall3(u32 metaTilePos, u32 layer) {
Entity* object;
SetMetaTileType(META_TILE_TYPE_225, metaTilePos - 0x41, layer);
SetMetaTileType(META_TILE_TYPE_228, metaTilePos - 0x40, layer);
SetMetaTileType(META_TILE_TYPE_226, metaTilePos - 1, layer);
SetMetaTileType(META_TILE_TYPE_227, metaTilePos + 0x3f, layer);
SetMetaTileType(META_TILE_TYPE_231, metaTilePos + 0x40, layer);
SetMetaTileType(META_TILE_TYPE_225, metaTilePos + TILE_POS(-1, -1), layer);
SetMetaTileType(META_TILE_TYPE_228, metaTilePos + TILE_POS(0, -1), layer);
SetMetaTileType(META_TILE_TYPE_226, metaTilePos + TILE_POS(-1, 0), layer);
SetMetaTileType(META_TILE_TYPE_227, metaTilePos + TILE_POS(-1, 1), layer);
SetMetaTileType(META_TILE_TYPE_231, metaTilePos + TILE_POS(0, 1), layer);
if (layer == LAYER_BOTTOM) {
if (AreaHasEnemies()) {
object = CreateObject(ARCHWAY, 0xe, 3);
@@ -245,9 +246,9 @@ void BombableWallManager_DestroyWall3(u32 metaTilePos, u32 layer) {
SetMetaTileType(META_TILE_TYPE_230, metaTilePos, LAYER_BOTTOM);
}
}
SetMetaTileType(META_TILE_TYPE_232, metaTilePos - 0x41, LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_233, metaTilePos - 1, LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_234, metaTilePos + 0x3f, LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_232, metaTilePos + TILE_POS(-1, -1), LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_233, metaTilePos + TILE_POS(-1, 0), LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_234, metaTilePos + TILE_POS(-1, 1), LAYER_TOP);
} else {
SetMetaTileType(META_TILE_TYPE_229, metaTilePos, LAYER_TOP);
if (!AreaIsDungeon()) {
@@ -267,11 +268,11 @@ void BombableWallManager_DestroyWall3(u32 metaTilePos, u32 layer) {
void BombableWallManager_DestroyWall4(u32 metaTilePos, u32 layer) {
Entity* object;
SetMetaTileType(META_TILE_TYPE_193, metaTilePos - 0x41, layer);
SetMetaTileType(META_TILE_TYPE_194, metaTilePos - 0x40, layer);
SetMetaTileType(META_TILE_TYPE_195, metaTilePos - 0x3f, layer);
SetMetaTileType(META_TILE_TYPE_196, metaTilePos - 1, layer);
SetMetaTileType(META_TILE_TYPE_199, metaTilePos + 1, layer);
SetMetaTileType(META_TILE_TYPE_193, metaTilePos + TILE_POS(-1, -1), layer);
SetMetaTileType(META_TILE_TYPE_194, metaTilePos + TILE_POS(0, -1), layer);
SetMetaTileType(META_TILE_TYPE_195, metaTilePos + TILE_POS(1, -1), layer);
SetMetaTileType(META_TILE_TYPE_196, metaTilePos + TILE_POS(-1, 0), layer);
SetMetaTileType(META_TILE_TYPE_199, metaTilePos + TILE_POS(1, 0), layer);
if (layer == LAYER_BOTTOM) {
if (AreaHasEnemies()) {
object = CreateObject(ARCHWAY, 0xe, 0);
@@ -287,9 +288,9 @@ void BombableWallManager_DestroyWall4(u32 metaTilePos, u32 layer) {
SetMetaTileType(META_TILE_TYPE_198, metaTilePos, LAYER_BOTTOM);
}
}
SetMetaTileType(META_TILE_TYPE_200, metaTilePos - 0x41, LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_201, metaTilePos - 0x40, LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_202, metaTilePos - 0x3f, LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_200, metaTilePos + TILE_POS(-1, -1), LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_201, metaTilePos + TILE_POS(0, -1), LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_202, metaTilePos + TILE_POS(1, -1), LAYER_TOP);
} else {
SetMetaTileType(META_TILE_TYPE_197, metaTilePos, LAYER_TOP);
if (!AreaIsDungeon()) {
+6 -5
View File
@@ -11,6 +11,7 @@
#include "player.h"
#include "room.h"
#include "scroll.h"
#include "tiles.h"
void DiggingCaveEntranceManager_Main(DiggingCaveEntranceManager*);
void DiggingCaveEntranceManager_Init(DiggingCaveEntranceManager*);
@@ -31,7 +32,7 @@ void DiggingCaveEntranceManager_Init(DiggingCaveEntranceManager* this) {
const DiggingCaveEntrance* entrance;
u8 room;
u8 area;
u16 tile = 0x81 << 7;
u16 tile = SPECIAL_META_TILE_128;
UpdateIsDiggingCave();
if (gDiggingCaveEntranceTransition.isDiggingCave) {
if (gDiggingCaveEntranceTransition.entrance == NULL) {
@@ -50,12 +51,12 @@ void DiggingCaveEntranceManager_Init(DiggingCaveEntranceManager* this) {
}
room = gRoomControls.room;
entrance = diggingCaveEntrances[gRoomControls.area];
tile = 0x81 << 7; // 0x4080
tile = SPECIAL_META_TILE_128;
for (entrance = GetDiggingCaveEntranceForRoom(entrance, room); entrance != 0;
entrance = GetDiggingCaveEntranceForRoom(entrance, room)) {
SetMetaTile(tile, entrance->sourceTilePosition + TILE_POS(-1, 1), 1);
SetMetaTile(tile, entrance->sourceTilePosition + TILE_POS(0, 1), 1);
SetMetaTile(tile, entrance->sourceTilePosition + TILE_POS(1, 1), 1);
SetMetaTile(tile, entrance->sourceTilePosition + TILE_POS(-1, 1), LAYER_BOTTOM);
SetMetaTile(tile, entrance->sourceTilePosition + TILE_POS(0, 1), LAYER_BOTTOM);
SetMetaTile(tile, entrance->sourceTilePosition + TILE_POS(1, 1), LAYER_BOTTOM);
entrance++;
}
}
+8 -7
View File
@@ -10,23 +10,24 @@
#include "asm.h"
#include "functions.h"
#include "room.h"
#include "tiles.h"
void FlameManager_Main(FlameManager* this) {
if (super->action == 0) {
this->field_0x38 = TILE(this->field_0x38, this->field_0x3a);
if (GetMetaTileType(this->field_0x38, 2) == 0x75) {
this->metaTilePos = TILE(this->metaTilePos, this->field_0x3a);
if (GetMetaTileType(this->metaTilePos, LAYER_TOP) == META_TILE_TYPE_117) {
super->action = 1;
SetMetaTile(0x406a, this->field_0x38, 1);
SetMetaTile(SPECIAL_META_TILE_106, this->metaTilePos, LAYER_BOTTOM);
} else {
DeleteThisEntity();
}
}
if (GetMetaTileType(this->field_0x38, 1) == 0x406b) {
sub_0807B7D8(0x76, this->field_0x38, 2);
if (GetMetaTileType(this->metaTilePos, LAYER_BOTTOM) == SPECIAL_META_TILE_107) {
sub_0807B7D8(META_TILE_TYPE_118, this->metaTilePos, LAYER_TOP);
DeleteThisEntity();
}
if (GetMetaTileType(this->field_0x38, 2) == 0x76) {
SetMetaTile(0x406b, this->field_0x38, 1);
if (GetMetaTileType(this->metaTilePos, LAYER_TOP) == META_TILE_TYPE_118) {
SetMetaTile(SPECIAL_META_TILE_107, this->metaTilePos, LAYER_BOTTOM);
DeleteThisEntity();
}
}
-1
View File
@@ -14,7 +14,6 @@
extern void (*const HoleManager_Actions[])(HoleManager*);
void HoleManager_Main(HoleManager* this) {
HoleManager_Actions[super->action](this);
}
+10 -9
View File
@@ -11,6 +11,7 @@
#include "functions.h"
#include "main.h"
#include "room.h"
#include "tiles.h"
void sub_08059A58(HyruleTownTilesetManager*);
void sub_08059A2C(HyruleTownTilesetManager*);
@@ -113,32 +114,32 @@ void sub_08059B18(void) {
if (CheckGlobalFlag(TATEKAKE_HOUSE) != 0) {
for (loopVar = 0; loopVar < 4; ++loopVar) {
for (innerLoopVar = 0; innerLoopVar < 4; ++innerLoopVar) {
SetMetaTileByIndex(loopVar * 0x10 + 0x4ab + innerLoopVar,
SetMetaTileByIndex(loopVar * 0x10 + META_TILE_TYPE_1195 + innerLoopVar,
COMMON(0x28 + 0x10 * innerLoopVar, loopVar * 0x10), 1);
}
}
for (loopVar = 0; loopVar < 3; ++loopVar) {
for (innerLoopVar = 0; innerLoopVar < 4; ++innerLoopVar) {
SetMetaTileByIndex(loopVar * 0x10 + 0x440 + innerLoopVar,
SetMetaTileByIndex(loopVar * 0x10 + META_TILE_TYPE_1088 + innerLoopVar,
COMMON(0x28 + 0x10 * innerLoopVar, loopVar * 0x10), 2);
}
}
SetMetaTileByIndex(0xd6, 0x5c2, 2);
SetMetaTileByIndex(0xd7, 0x5c3, 2);
SetMetaTileByIndex(META_TILE_TYPE_214, TILE_POS(2, 23), LAYER_TOP);
SetMetaTileByIndex(META_TILE_TYPE_215, TILE_POS(3, 23), LAYER_TOP);
LoadResourceAsync(&gUnk_086E8460, 0x6001800, 0x800);
} else {
if (CheckGlobalFlag(TATEKAKE_TOCHU) != 0) {
for (loopVar = 0; loopVar < 5; ++loopVar) {
for (innerLoopVar = 0; innerLoopVar < 4; ++innerLoopVar) {
SetMetaTileByIndex(loopVar * 0x10 + 0x4a6 + innerLoopVar,
SetMetaTileByIndex(loopVar * 0x10 + META_TILE_TYPE_1190 + innerLoopVar,
COMMON(0x28 + 0x10 * innerLoopVar, loopVar * 0x10), 1);
}
}
SetMetaTileByIndex(0x444, 0x602, 2);
SetMetaTileByIndex(0x445, 0x605, 2);
SetMetaTileByIndex(0x454, 0x642, 2);
SetMetaTileByIndex(0x455, 0x645, 2);
SetMetaTileByIndex(META_TILE_TYPE_1092, TILE_POS(2, 24), LAYER_TOP);
SetMetaTileByIndex(META_TILE_TYPE_1093, TILE_POS(5, 24), LAYER_TOP);
SetMetaTileByIndex(META_TILE_TYPE_1108, TILE_POS(2, 25), LAYER_TOP);
SetMetaTileByIndex(META_TILE_TYPE_1109, TILE_POS(5, 25), LAYER_TOP);
}
}
}
+7 -6
View File
@@ -79,7 +79,7 @@ void LightLevelSetManager_Type2(LightLevelSetManager* this) {
((s16)this->field_0x38 >> 4 & 0x3fU) | ((s32)((this->field_0x3a << 0x10) >> 0x14 & 0x3fU) << 6);
super->action = 1;
} else {
if (GetMetaTileType(this->field_0x20, super->type2) == 0x76) {
if (GetMetaTileType(this->field_0x20, super->type2) == META_TILE_TYPE_118) {
SetFlag(this->field_0x3e);
ChangeLightLevel(super->timer);
DeleteThisEntity();
@@ -103,7 +103,7 @@ void LightLevelSetManager_Type3(LightLevelSetManager* this) {
break;
case 1:
if (GetMetaTileType(this->field_0x20, super->type2) != 0x76) {
if (GetMetaTileType(this->field_0x20, super->type2) != META_TILE_TYPE_118) {
return;
}
SetFlag(this->field_0x3e);
@@ -133,13 +133,14 @@ void LightLevelSetManager_Type3(LightLevelSetManager* this) {
void sub_0805BE70(LightLevelSetManager* this, u32 metaTileType) {
SetMetaTileType(metaTileType,
((this->field_0x38 << 0x10) >> 0x14 & 0x3fU) | ((this->field_0x3a << 0x10) >> 0x14 & 0x3fU) << 6,
super->type2);
((this->field_0x38 << 0x10) >> 0x14 & 0x3fU) | ((this->field_0x3a << 0x10) >> 0x14 & 0x3fU) << 6,
super->type2);
}
void sub_0805BE94(LightLevelSetManager* this) {
SetMetaTileType(META_TILE_TYPE_118, ((this->field_0x38 << 0x10) >> 0x14 & 0x3fU) | ((this->field_0x3a << 0x10) >> 0x14 & 0x3fU) << 6,
super->type2);
SetMetaTileType(META_TILE_TYPE_118,
((this->field_0x38 << 0x10) >> 0x14 & 0x3fU) | ((this->field_0x3a << 0x10) >> 0x14 & 0x3fU) << 6,
super->type2);
ChangeLightLevel(super->timer);
DeleteThisEntity();
}
+7 -7
View File
@@ -121,9 +121,9 @@ void MiscManager_Type0(MiscManager* this) {
void sub_08058F44(u32 x, u32 y, u32 flag) {
if (CheckRoomFlag(flag))
return;
if (sub_080B1A48(x, y, 1) != 0x61)
if (sub_080B1A48(x, y, LAYER_BOTTOM) != META_TILE_TYPE_97)
return;
SetMetaTileType(0x26, ((x >> 4) & 0x3F) | (((y >> 4) & 0x3F) << 6), 1);
SetMetaTileType(META_TILE_TYPE_38, ((x >> 4) & 0x3F) | (((y >> 4) & 0x3F) << 6), LAYER_BOTTOM);
sub_08058F84(x, y);
}
@@ -240,7 +240,7 @@ void MiscManager_Type5(MiscManager* this) {
DeleteThisEntity();
}
super->action = 1;
SetMetaTileType(0x365, TILE_LOCAL(this->x, this->y), super->type2);
SetMetaTileType(META_TILE_TYPE_869, TILE_LOCAL(this->x, this->y), super->type2);
break;
case 1:
if (CheckFlags(this->flags)) {
@@ -338,10 +338,10 @@ void sub_0805930C(MiscManager* this) {
tmp->collisionLayer = 1;
}
void SetDirtTile(u32 tile) {
SetMetaTileType(CUT_GRASS, tile, 1);
SetMetaTileType(0, tile, 2);
SetMetaTileType(0, tile - 0x40, 2);
void SetDirtTile(u32 metaTilePos) {
SetMetaTileType(META_TILE_TYPE_29, metaTilePos, LAYER_BOTTOM);
SetMetaTileType(META_TILE_TYPE_0, metaTilePos, LAYER_TOP);
SetMetaTileType(META_TILE_TYPE_0, metaTilePos + TILE_POS(0, -1), LAYER_TOP);
}
void MiscManager_TypeA(MiscManager* this) {
+5 -3
View File
@@ -7,6 +7,7 @@
#include "manager/railIntersectionManager.h"
#include "flags.h"
#include "room.h"
#include "tiles.h"
void sub_0805B778(RailIntersectionManager*);
void RailIntersectionManager_Init(RailIntersectionManager*);
@@ -25,7 +26,7 @@ void RailIntersectionManager_Init(RailIntersectionManager* this) {
super->type2 = 1;
}
super->action = 1;
this->field_0x38 = (this->field_0x38 >> 4 & 0x3fU) | (((this->field_0x3a << 0x10) >> 0x14 & 0x3fU) << 6);
this->metaTilePos = (this->metaTilePos >> 4 & 0x3fU) | (((this->field_0x3a << 0x10) >> 0x14 & 0x3fU) << 6);
sub_0805B778(this);
}
@@ -44,6 +45,7 @@ void RailIntersectionManager_Action1(RailIntersectionManager* this) {
}
void sub_0805B778(RailIntersectionManager* this) {
static const u16 gUnk_08108C9C[] = { 0x358, 0x359, 0x356, 0x35a, 0x35a, 0x357 };
SetMetaTileType(gUnk_08108C9C[super->type * 2 + super->type2], this->field_0x38, this->field_0x36);
static const u16 gUnk_08108C9C[] = { META_TILE_TYPE_856, META_TILE_TYPE_857, META_TILE_TYPE_854,
META_TILE_TYPE_858, META_TILE_TYPE_858, META_TILE_TYPE_855 };
SetMetaTileType(gUnk_08108C9C[super->type * 2 + super->type2], this->metaTilePos, this->layer);
}
+4 -3
View File
@@ -12,6 +12,7 @@
#include "flags.h"
#include "functions.h"
#include "sound.h"
#include "tiles.h"
enum { INIT, IN_PROGRESS, FAILED, SUCCEEDED };
@@ -31,15 +32,15 @@ void TilePuzzleManager_Main(TilePuzzleManager* this) {
if (this->player_current_tile != this->player_previous_tile) {
this->player_previous_tile = this->player_current_tile;
switch (GetMetaTileType(this->player_current_tile, super->type2)) {
case 0x317:
case META_TILE_TYPE_791:
// stepped on a red tile again
super->action = FAILED;
SoundReq(SFX_MENU_ERROR);
break;
case 0x318:
case META_TILE_TYPE_792:
// stepped on a blue tile
// turn the tile into a red tile
sub_0807B7D8(0x317, this->player_current_tile, super->type2);
sub_0807B7D8(META_TILE_TYPE_791, this->player_current_tile, super->type2);
SoundReq(SFX_6B);
// decrease the number of remaining tiles and check if we're done
if (--super->timer == 0) {
+2 -1
View File
@@ -8,9 +8,10 @@
#include "asm.h"
#include "entity.h"
#include "functions.h"
#include "tiles.h"
void WaterfallBottomManager_Main(WaterfallBottomManager* this) {
SetMetaTile(0x4014, 0x5c3, 1);
SetMetaTile(SPECIAL_META_TILE_20, TILE_POS(3, 23), LAYER_BOTTOM);
if ((gRoomControls.origin_y + 200 < gPlayerEntity.y.HALF.HI) &&
((u32)(gPlayerEntity.x.HALF.HI - gRoomControls.origin_x) - 0x30 < 0x11)) {
gPlayerEntity.collisionLayer = 3;