Add more tilemap documentation

This commit is contained in:
octorock
2024-01-06 18:12:53 +01:00
parent 06dc158598
commit 560dfa45b1
39 changed files with 4306 additions and 4280 deletions
+4 -4
View File
@@ -20,7 +20,7 @@
extern void sub_0807C898(void);
extern void sub_0805BB74(s32);
extern void LoadRoomGfx(void);
extern void SetupTileSet(void);
extern void LoadRoomTileSet(void);
extern void sub_0807C4F8(void);
extern void gMapData;
@@ -1014,7 +1014,7 @@ void RenderMapLayerToSubTileMap(u16* subTileMap, MapLayer* mapLayer) {
u16 tileX;
u32 tilePosAndLayer;
u32 layerIndex;
// Index into the tileset at MapLayer.tiles
// Index into the tileSet at MapLayer.tiles
u32 tileSetIndex;
if (mapLayer == &gMapBottom) {
@@ -1187,8 +1187,8 @@ u32 sub_0801AE34(void) {
void sub_0801AE44(bool32 loadGfx) {
void (*func)(void);
gRoomControls.tileset = (u32)NULL;
SetupTileSet();
gRoomControls.tileSet = (u32)NULL;
LoadRoomTileSet();
if (loadGfx != 0) {
LoadRoomGfx();
}
+3 -3
View File
@@ -3,9 +3,9 @@
/*
Tiles for the borders of the cave that are loaded during the transition.
When the player goes inside a cave during the start of the enter transition the border tilemap is loaded and at the
end the tilemap for the cave is loaded. When the player goes out of a cave during the start of the leave transition
the border tilemap is loaded and at the end the tilemap for the outside is loaded.
When the player goes inside a cave during the start of the enter transition the border tileMap is loaded and at the
end the tileMap for the cave is loaded. When the player goes out of a cave during the start of the leave transition
the border tileMap is loaded and at the end the tileMap for the outside is loaded.
*/
const MapDataDefinition gCaveBorder_LakeWoods_enter_start[] = {
-1
View File
@@ -1115,7 +1115,6 @@ void sub_08036998(OctorokBossEntity* this) {
s32 tmp3;
s32 a, b;
// TODO regalloc in this awful structure here
tmp2 = &this->timer;
tmp = super->subtimer + (tmp3 = (u8)*tmp2);
*tmp2 = tmp;
+19 -20
View File
@@ -401,14 +401,14 @@ void sub_080256B4(PuffstoolEntity* this) {
bool32 sub_0802571C(PuffstoolEntity* this) {
RoomControls* ctrl = &gRoomControls;
u16 xDiff = (super->x.HALF.HI - ctrl->origin_x + 8) & -0x10;
u16 yDiff = (super->y.HALF.HI - ctrl->origin_y + 8) & -0x10;
u16 roomX = (super->x.HALF.HI - ctrl->origin_x + 8) & -0x10;
u16 roomY = (super->y.HALF.HI - ctrl->origin_y + 8) & -0x10;
u16 unk = this->unk_7a;
u16 i;
for (i = 0; i < 4; i++) {
u16 sVar3 = xDiff + gUnk_080CC020[unk + 0];
u16 sVar4 = yDiff + gUnk_080CC020[unk + 1];
u16 sVar3 = roomX + gUnk_080CC020[unk + 0];
u16 sVar4 = roomY + gUnk_080CC020[unk + 1];
if (sub_080257EC(this, sVar3, sVar4)) {
this->unk_7c = sVar3 + ctrl->origin_x;
@@ -429,25 +429,25 @@ bool32 sub_0802571C(PuffstoolEntity* this) {
bool32 sub_080257EC(PuffstoolEntity* this, u32 x, u32 y) {
u16 tileType = GetTileTypeAtRoomCoords(x - 0x00, y - 0x00, super->collisionLayer);
if (tileType != 0x312 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
if (tileType != TILE_TYPE_786 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
gMapTileTypeToCollisionData[tileType] == 0) {
return TRUE;
}
tileType = GetTileTypeAtRoomCoords(x - 0x10, y - 0x00, super->collisionLayer);
if (tileType != 0x312 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
if (tileType != TILE_TYPE_786 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
gMapTileTypeToCollisionData[tileType] == 0) {
return TRUE;
}
tileType = GetTileTypeAtRoomCoords(x - 0x00, y - 0x10, super->collisionLayer);
if (tileType != 0x312 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
if (tileType != TILE_TYPE_786 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
gMapTileTypeToCollisionData[tileType] == 0) {
return TRUE;
}
tileType = GetTileTypeAtRoomCoords(x - 0x10, y - 0x10, super->collisionLayer);
if (tileType != 0x312 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
if (tileType != TILE_TYPE_786 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
gMapTileTypeToCollisionData[tileType] == 0) {
return TRUE;
}
@@ -482,11 +482,10 @@ bool32 sub_080258C4(PuffstoolEntity* this) {
}
}
// regalloc
bool32 sub_0802594C(PuffstoolEntity* this, u32 param_2) {
s16 xDiff;
s16 yDiff;
s16 iVar9;
s16 x;
u32 layer;
const s8* unk = gUnk_080CC090[param_2];
layer = super->collisionLayer;
@@ -495,24 +494,24 @@ bool32 sub_0802594C(PuffstoolEntity* this, u32 param_2) {
do {
u8 bVar7;
u8 bVar4;
s16 iVar11;
s16 y;
u8 bVar5;
u8 bVar6;
iVar9 = xDiff + unk[0];
iVar11 = yDiff + unk[1];
bVar4 = GetCollisionDataAtWorldCoords(iVar9 - 0x00, iVar11 - 0x00, layer);
bVar5 = GetCollisionDataAtWorldCoords(iVar9 - 0x10, iVar11 - 0x00, layer);
bVar6 = GetCollisionDataAtWorldCoords(iVar9 - 0x00, iVar11 - 0x10, layer);
bVar7 = GetCollisionDataAtWorldCoords(iVar9 - 0x10, iVar11 - 0x10, layer);
x = xDiff + unk[0];
y = yDiff + unk[1];
bVar4 = GetCollisionDataAtWorldCoords(x - 0x00, y - 0x00, layer);
bVar5 = GetCollisionDataAtWorldCoords(x - 0x10, y - 0x00, layer);
bVar6 = GetCollisionDataAtWorldCoords(x - 0x00, y - 0x10, layer);
bVar7 = GetCollisionDataAtWorldCoords(x - 0x10, y - 0x10, layer);
if ((bVar4 | bVar5 | bVar6 | bVar7) == 0) {
this->unk_7c = gRoomControls.origin_x + iVar9;
this->unk_7e = gRoomControls.origin_y + iVar11;
this->unk_7c = gRoomControls.origin_x + x;
this->unk_7e = gRoomControls.origin_y + y;
return TRUE;
}
unk += 2;
} while (unk[0] != 0x7f);
return 0;
return FALSE;
}
void sub_08025A54(PuffstoolEntity* this) {
+1 -1
View File
@@ -400,7 +400,7 @@ static void HandleFileScreenEnter(void) {
MemClear((void*)VRAM, 0x80); // clear palettes
MessageInitialize();
EraseAllEntities();
ClearTilemaps();
ClearTileMaps();
ResetPalettes();
ResetPaletteTable(0);
MemClear(&gHUD, sizeof(gHUD));
+1 -1
View File
@@ -138,7 +138,7 @@ static void GameTask_Init(void) {
MemClear(&gUI, sizeof(gUI));
EraseAllEntities();
SetBGDefaults();
ClearTilemaps();
ClearTileMaps();
ResetPalettes();
ResetPaletteTable(1);
sub_0806FD8C();
+5 -5
View File
@@ -33,7 +33,7 @@ void InitRoomResInfo(RoomResInfo* info, RoomHeader* hdr, u32 area, u32 room);
void sub_080532E4(void);
void ResetTimerFlags(void);
extern void** gAreaTilesets[];
extern void** gAreaTileSets[];
extern void** gAreaRoomMaps[];
extern void* gAreaTiles[];
extern void** gAreaTable[];
@@ -544,7 +544,7 @@ void InitAllRoomResInfo(void) {
RoomResInfo* info = gArea.roomResInfos;
u32 i;
for (i = 0; i < MAX_ROOMS && *(u16*)r_hdr != 0xFFFF; i++, r_hdr++) {
if (r_hdr->tileset_id != 0xFFFF)
if (r_hdr->tileSet_id != 0xFFFF)
InitRoomResInfo(info, r_hdr, gRoomControls.area, i);
info++;
}
@@ -556,7 +556,7 @@ void InitRoomResInfo(RoomResInfo* info, RoomHeader* r_hdr, u32 area, u32 room) {
info->map_y = r_hdr->map_y;
info->pixel_width = r_hdr->pixel_width;
info->pixel_height = r_hdr->pixel_height;
info->tileset = *(gAreaTilesets[area] + r_hdr->tileset_id);
info->tileSet = *(gAreaTileSets[area] + r_hdr->tileSet_id);
info->map = *(gAreaRoomMaps[area] + room);
info->tiles = gAreaTiles[area];
info->bg_anim = (void*)gUnk_080B755C[area];
@@ -648,7 +648,7 @@ void LoadAuxiliaryRoom(u32 area, u32 room) {
void sub_08052FF4(u32 area, u32 room) {
RoomHeader* r_hdr = NULL;
ClearTilemaps();
ClearTileMaps();
SetBGDefaults();
gRoomControls.area = area;
gRoomControls.room = room;
@@ -660,7 +660,7 @@ void sub_08052FF4(u32 area, u32 room) {
gArea.currentRoomInfo.map_y = r_hdr->map_y;
gArea.currentRoomInfo.pixel_width = r_hdr->pixel_width;
gArea.currentRoomInfo.pixel_height = r_hdr->pixel_height;
gArea.currentRoomInfo.tileset = *(gAreaTilesets[area] + r_hdr->tileset_id);
gArea.currentRoomInfo.tileSet = *(gAreaTileSets[area] + r_hdr->tileSet_id);
gArea.currentRoomInfo.map = *(gAreaRoomMaps[area] + room);
gArea.currentRoomInfo.tiles = gAreaTiles[area];
gArea.currentRoomInfo.bg_anim = (void*)gUnk_080B755C[area];
+2 -2
View File
@@ -9,7 +9,7 @@ void (*const gMiscManagerunctions[])() = {
DiggingCaveEntranceManager_Main,
BridgeManager_Main,
SpecialWarpManager_Main,
MinishVillageTilesetManager_Main,
MinishVillageTileSetManager_Main,
HorizontalMinishPathBackgroundManager_Main,
MinishRaftersBackgroundManager_Main,
EzloHintManager_Main,
@@ -20,7 +20,7 @@ void (*const gMiscManagerunctions[])() = {
MiscManager_Main,
WeatherChangeManager_Main,
FlagAndOperatorManager_Main,
HyruleTownTilesetManager_Main,
HyruleTownTileSetManager_Main,
HouseSignManager_Main,
SteamOverlayManager_Main,
TempleOfDropletsManager_Main,
@@ -1,10 +1,10 @@
/**
* @file hyruleTownTilesetManager.c
* @file hyruleTownTileSetManager.c
* @ingroup Managers
*
* @brief Swap tileset data in hyrule town depending on the position.
* @brief Swap tileSet data in hyrule town depending on the position.
*/
#include "manager/hyruleTownTilesetManager.h"
#include "manager/hyruleTownTileSetManager.h"
#include "area.h"
#include "asm.h"
#include "flags.h"
@@ -13,8 +13,8 @@
#include "room.h"
#include "tiles.h"
void sub_08059A58(HyruleTownTilesetManager*);
void sub_08059A2C(HyruleTownTilesetManager*);
void sub_08059A58(HyruleTownTileSetManager*);
void sub_08059A2C(HyruleTownTileSetManager*);
static const u16 gUnk_08108398[] = { 0x0, 0x0, 0x0, 0x3f0, 0x200, 0x1, 0x0, 0x280, 0x3f0, 0x140, 0xff };
static const u16 gUnk_081083AE[] = { 0x2, 0x0, 0x0, 0x180, 0x3c0, 0x3, 0x280, 0x0, 0x170, 0x3c0, 0xff };
@@ -25,7 +25,7 @@ static const u16 gUnk_081083F2[] = { 0x5, 0x0, 0x1b0, 0x190, 0x140, 0x4, 0x0, 0x
void sub_08059CC0(u32, u32);
void sub_08059B18(void);
bool32 sub_08059C8C(HyruleTownTilesetManager*, u32, u8*, const u16*);
bool32 sub_08059C8C(HyruleTownTileSetManager*, u32, u8*, const u16*);
extern u32 gUnk_086E8460;
@@ -60,7 +60,7 @@ static const Unknown gUnk_08108468[] = {
};
extern const u8 gGlobalGfxAndPalettes[];
void HyruleTownTilesetManager_Main(HyruleTownTilesetManager* this) {
void HyruleTownTileSetManager_Main(HyruleTownTileSetManager* this) {
if (super->action == 0) {
super->action = 1;
this->field_0x22 = 0xff;
@@ -72,7 +72,7 @@ void HyruleTownTilesetManager_Main(HyruleTownTilesetManager* this) {
sub_08059A58(this);
}
void sub_08059A2C(HyruleTownTilesetManager* this) {
void sub_08059A2C(HyruleTownTileSetManager* this) {
gRoomVars.graphicsGroups[2] = 0xff;
gRoomVars.graphicsGroups[1] = 0xff;
gRoomVars.graphicsGroups[0] = 0xff;
@@ -82,7 +82,7 @@ void sub_08059A2C(HyruleTownTilesetManager* this) {
sub_08059A58(this);
}
void sub_08059A58(HyruleTownTilesetManager* this) {
void sub_08059A58(HyruleTownTileSetManager* this) {
if (gRoomControls.area != AREA_FESTIVAL_TOWN) {
if (sub_08059C8C(this, 0, &this->field_0x20, gUnk_08108398) != 0) {
sub_08059CC0(0, (u32)this->field_0x20);
@@ -144,7 +144,7 @@ void sub_08059B18(void) {
}
}
bool32 sub_08059C8C(HyruleTownTilesetManager* this, u32 param_2, u8* param_3, const u16* param_4) {
bool32 sub_08059C8C(HyruleTownTileSetManager* this, u32 param_2, u8* param_3, const u16* param_4) {
bool32 bVar2;
*param_3 = CheckRegionsOnScreen(param_4);
@@ -1,17 +1,17 @@
/**
* @file minishVillageTilesetManager.c
* @file minishVillageTileSetManager.c
* @ingroup Managers
*
* @brief Swap tileset data in minish village depending on the position
* @brief Swap tileSet data in minish village depending on the position
*/
#include "manager/minishVillageTilesetManager.h"
#include "manager/minishVillageTileSetManager.h"
#include "asm.h"
#include "common.h"
#include "functions.h"
#include "main.h"
void sub_08057E30(void*);
bool32 sub_08057E40(MinishVillageTilesetManager*);
bool32 sub_08057E40(MinishVillageTileSetManager*);
void sub_08057E7C(u32);
extern const u8 gGlobalGfxAndPalettes[];
@@ -54,7 +54,7 @@ const u32 gUnk_081080A4[0x50] = {
const u8 gUnk_081081E4[] = { 0x16, 0x17, 0x17, 0x18, 0x18 };
#ifdef EU
void MinishVillageTilesetManager_Main(MinishVillageTilesetManager* this) {
void MinishVillageTileSetManager_Main(MinishVillageTileSetManager* this) {
u32 tmp;
const u32* tmp2;
s32 tmp3;
@@ -103,7 +103,7 @@ void MinishVillageTilesetManager_Main(MinishVillageTilesetManager* this) {
}
}
#else
void MinishVillageTilesetManager_Main(MinishVillageTilesetManager* this) {
void MinishVillageTileSetManager_Main(MinishVillageTileSetManager* this) {
u32 tmp;
const u32* tmp2;
if (super->action == 0) {
@@ -156,7 +156,7 @@ void sub_08057E30(void* this) {
sub_08057E7C(gRoomVars.graphicsGroups[0]);
}
bool32 sub_08057E40(MinishVillageTilesetManager* this) {
bool32 sub_08057E40(MinishVillageTileSetManager* this) {
u32 tmp = CheckRegionsOnScreen(gUnk_08108050);
if (tmp != 0xFF) {
gRoomVars.graphicsGroups[0] = tmp;
+10 -10
View File
@@ -18,7 +18,7 @@
#include "save.h"
#include "screen.h"
#include "screenTransitions.h"
#include "tilemap.h"
#include "tileMap.h"
#include "tiles.h"
static void sub_08077E54(ItemBehavior* beh);
@@ -69,7 +69,7 @@ extern u8 gUpdateVisibleTiles;
bool32 sub_0807BF88(u32, u32, RoomResInfo*);
void SetupTileSet(void);
void LoadRoomTileSet(void);
void ForceSetPlayerState(u32 framestate);
InteractableObject* sub_080784E4(void);
@@ -3309,7 +3309,7 @@ void SetTileType(u32 tileType, u32 tilePos, u32 layer) {
dest = gMapDataTopSpecial + offset;
}
subTiles = mapLayer->subTiles + tileIndex * 4;
// Copy over the tilemap entries (tile_attrs) to the special map data but in a different order.
// Copy over the tileMap entries (tile_attrs) to the special map data but in a different order.
dest[0] = subTiles[0];
dest[1] = subTiles[1];
dest[0x80] = subTiles[2];
@@ -3813,7 +3813,7 @@ void sub_0807BFA8(void) {
gRoomControls.height = (gArea.pCurrentRoomInfo)->pixel_height;
}
void SetupTileSet(void) {
void LoadRoomTileSet(void) {
s32 index;
u16* tileTypes;
u16* tileIndices;
@@ -3826,9 +3826,9 @@ void SetupTileSet(void) {
MemFill16(0xffff, gMapTop.tileTypes, 0x1000);
gMapTop.tileTypes[0] = 0;
if ((void*)gRoomControls.tileset != (gArea.pCurrentRoomInfo)->tileset) {
gRoomControls.tileset = (u32)(gArea.pCurrentRoomInfo)->tileset;
LoadMapData((gArea.pCurrentRoomInfo)->tileset);
if ((void*)gRoomControls.tileSet != (gArea.pCurrentRoomInfo)->tileSet) {
gRoomControls.tileSet = (u32)(gArea.pCurrentRoomInfo)->tileSet;
LoadMapData((gArea.pCurrentRoomInfo)->tileSet);
}
LoadMapData((gArea.pCurrentRoomInfo)->tiles);
@@ -3912,7 +3912,7 @@ void LoadRoomGfx(void) {
FillActTileForLayer(&gMapBottom);
FillActTileForLayer(&gMapTop);
if (!clearBottomMap) {
// Render the complete bottom and top tilemaps into the tilemaps.
// Render the complete bottom and top tileMaps into the tileMaps.
RenderMapLayerToSubTileMap(gMapDataBottomSpecial, &gMapBottom);
RenderMapLayerToSubTileMap(gMapDataTopSpecial, &gMapTop);
} else {
@@ -4152,7 +4152,7 @@ void InitializeCamera() {
u32 tmp1;
u32 tmp2;
SetupTileSet();
LoadRoomTileSet();
LoadRoomGfx();
roomControls = &gRoomControls;
target = gRoomControls.camera_target;
@@ -4212,7 +4212,7 @@ void sub_0807C810(void) {
DiggingCaveEntranceTransition* ptr;
Entity* player;
RoomControls* ctrls;
SetupTileSet();
LoadRoomTileSet();
ptr = &gDiggingCaveEntranceTransition;
player = &gPlayerEntity.base;
ctrls = &gRoomControls;
-1
View File
@@ -300,7 +300,6 @@ void sub_080AA320(MandiblesProjectileEntity* this) {
parent->unk_80 = 0x50;
parent->base.speed = 0;
parent->base.direction = sub_08049F84(&parent->base, 0);
// TODO regalloc
uVar2 = Direction8Round(parent->base.direction + 4);
super->animationState = uVar2 >> 2;
parent->base.animationState = DirectionRound(uVar2) >> 2;
+2 -2
View File
@@ -14,7 +14,7 @@
#include "object.h"
#include "screen.h"
#include "structures.h"
#include "tilemap.h"
#include "tileMap.h"
#include "tiles.h"
extern void UpdateScreenShake(void);
@@ -582,7 +582,7 @@ void UpdateIsDiggingCave(void) {
gDiggingCaveEntranceTransition.isDiggingCave = 0;
}
void ClearTilemaps(void) {
void ClearTileMaps(void) {
MemClear(&gRoomControls, sizeof(gRoomControls));
MemClear(&gDiggingCaveEntranceTransition, sizeof(gDiggingCaveEntranceTransition));
gRoomControls.unk_22 = 0xffff;