Rename map-layout-related things

This commit is contained in:
Marcus Huderle
2018-06-20 17:41:51 -05:00
parent 135a11e50e
commit ed8b006e67
20 changed files with 175 additions and 175 deletions
+1 -1
View File
@@ -30026,7 +30026,7 @@ _081AA0A6:
ldr r2, =0x00000169 ldr r2, =0x00000169
adds r0, r2 adds r0, r2
lsls r0, 2 lsls r0, 2
ldr r1, =gMapAttributes ldr r1, =gMapLayouts
adds r0, r1 adds r0, r1
ldr r6, [r0] ldr r6, [r0]
ldr r2, [r6, 0xC] ldr r2, [r6, 0xC]
+1 -1
View File
@@ -1,5 +1,5 @@
.align 2 .align 2
gMapAttributes:: @ 8481DD4 gMapLayouts:: @ 8481DD4
.4byte PetalburgCity_Layout .4byte PetalburgCity_Layout
.4byte SlateportCity_Layout .4byte SlateportCity_Layout
.4byte MauvilleCity_Layout .4byte MauvilleCity_Layout
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef GUARD_FIELDMAP_H #ifndef GUARD_FIELDMAP_H
#define GUARD_FIELDMAP_H #define GUARD_FIELDMAP_H
extern struct BackupMapData gUnknown_03005DC0; extern struct BackupMapLayout gUnknown_03005DC0;
u32 MapGridGetMetatileIdAt(int, int); u32 MapGridGetMetatileIdAt(int, int);
u32 MapGridGetMetatileBehaviorAt(int, int); u32 MapGridGetMetatileBehaviorAt(int, int);
+4 -4
View File
@@ -55,7 +55,7 @@ struct Tileset
/*0x14*/ TilesetCB callback; /*0x14*/ TilesetCB callback;
}; };
struct MapData struct MapLayout
{ {
/*0x00*/ s32 width; /*0x00*/ s32 width;
/*0x04*/ s32 height; /*0x04*/ s32 height;
@@ -65,7 +65,7 @@ struct MapData
/*0x14*/ struct Tileset *secondaryTileset; /*0x14*/ struct Tileset *secondaryTileset;
}; };
struct BackupMapData struct BackupMapLayout
{ {
s32 width; s32 width;
s32 height; s32 height;
@@ -160,12 +160,12 @@ struct MapConnections
struct MapHeader struct MapHeader
{ {
/* 0x00 */ const struct MapData *mapData; /* 0x00 */ const struct MapLayout *mapLayout;
/* 0x04 */ const struct MapEvents *events; /* 0x04 */ const struct MapEvents *events;
/* 0x08 */ const u8 *mapScripts; /* 0x08 */ const u8 *mapScripts;
/* 0x0C */ const struct MapConnections *connections; /* 0x0C */ const struct MapConnections *connections;
/* 0x10 */ u16 music; /* 0x10 */ u16 music;
/* 0x12 */ u16 mapDataId; /* 0x12 */ u16 mapLayoutId;
/* 0x14 */ u8 regionMapSectionId; /* 0x14 */ u8 regionMapSectionId;
/* 0x15 */ u8 cave; /* 0x15 */ u8 cave;
/* 0x16 */ u8 weather; /* 0x16 */ u8 weather;
+1 -1
View File
@@ -777,7 +777,7 @@ struct SaveBlock1
/*0x2E*/ u8 weather; /*0x2E*/ u8 weather;
/*0x2F*/ u8 filler_2F; /*0x2F*/ u8 filler_2F;
/*0x30*/ u8 flashLevel; /*0x30*/ u8 flashLevel;
/*0x32*/ u16 mapDataId; /*0x32*/ u16 mapLayoutId;
/*0x34*/ u16 mapView[0x100]; /*0x34*/ u16 mapView[0x100];
/*0x234*/ u8 playerPartyCount; /*0x234*/ u8 playerPartyCount;
/*0x238*/ struct Pokemon playerParty[PARTY_SIZE]; /*0x238*/ struct Pokemon playerParty[PARTY_SIZE];
+2 -2
View File
@@ -301,7 +301,7 @@ typedef union // size = 0x24
/*0x06*/ u8 nGoldSymbols; /*0x06*/ u8 nGoldSymbols;
/*0x07*/ u8 location; /*0x07*/ u8 location;
/*0x08*/ u16 battlePoints; /*0x08*/ u16 battlePoints;
/*0x0a*/ u16 mapDataId; /*0x0a*/ u16 mapLayoutId;
/*0x0c*/ u8 language; /*0x0c*/ u8 language;
/*0x0d*/ u8 filler_0d[6]; /*0x0d*/ u8 filler_0d[6];
/*0x13*/ u8 playerName[8]; /*0x13*/ u8 playerName[8];
@@ -326,7 +326,7 @@ typedef union // size = 0x24
/*0x02*/ u16 item; /*0x02*/ u16 item;
/*0x04*/ u8 location; /*0x04*/ u8 location;
/*0x05*/ u8 language; /*0x05*/ u8 language;
/*0x06*/ u16 mapDataId; /*0x06*/ u16 mapLayoutId;
/*0x08*/ u8 filler_08[11]; /*0x08*/ u8 filler_08[11];
/*0x13*/ u8 playerName[8]; /*0x13*/ u8 playerName[8];
} treasureInvestigators; } treasureInvestigators;
+2 -2
View File
@@ -41,7 +41,7 @@ void LoadEventObjTemplatesFromHeader(void);
void LoadSaveblockEventObjScripts(void); void LoadSaveblockEventObjScripts(void);
void Overworld_SetEventObjTemplateCoords(u8 localId, s16 x, s16 y); void Overworld_SetEventObjTemplateCoords(u8 localId, s16 x, s16 y);
void Overworld_SetEventObjTemplateMovementType(u8 localId, u8 movementType); void Overworld_SetEventObjTemplateMovementType(u8 localId, u8 movementType);
const struct MapData *get_mapdata_header(void); const struct MapLayout *GetMapLayout(void);
void ApplyCurrentWarp(void); void ApplyCurrentWarp(void);
void set_warp2_warp3_to_neg_1(void); void set_warp2_warp3_to_neg_1(void);
void SetWarpData(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); void SetWarpData(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
@@ -82,7 +82,7 @@ bool32 Overworld_IsBikingAllowed(void);
void SetDefaultFlashLevel(void); void SetDefaultFlashLevel(void);
void Overworld_SetFlashLevel(s32 flashLevel); void Overworld_SetFlashLevel(s32 flashLevel);
u8 Overworld_GetFlashLevel(void); u8 Overworld_GetFlashLevel(void);
void sub_8085524(u16 mapDataId); void sub_8085524(u16 mapLayoutId);
void sub_8085540(u8 var); void sub_8085540(u8 var);
u8 sub_808554C(void); u8 sub_808554C(void);
u16 GetLocationMusic(struct WarpData *warp); u16 GetLocationMusic(struct WarpData *warp);
+3 -3
View File
@@ -1736,7 +1736,7 @@ bool8 sub_8128D10(u8 taskId)
data[1] ++; data[1] ++;
return FALSE; return FALSE;
} }
if (sDecorationLastDirectionMoved == DIR_NORTH && data[1] - 7 >= gMapHeader.mapData->height) if (sDecorationLastDirectionMoved == DIR_NORTH && data[1] - 7 >= gMapHeader.mapLayout->height)
{ {
data[1] --; data[1] --;
return FALSE; return FALSE;
@@ -1746,7 +1746,7 @@ bool8 sub_8128D10(u8 taskId)
data[0] ++; data[0] ++;
return FALSE; return FALSE;
} }
if (sDecorationLastDirectionMoved == DIR_EAST && data[0] + data[5] - 8 >= gMapHeader.mapData->width) if (sDecorationLastDirectionMoved == DIR_EAST && data[0] + data[5] - 8 >= gMapHeader.mapLayout->width)
{ {
data[0] --; data[0] --;
return FALSE; return FALSE;
@@ -2186,7 +2186,7 @@ void sub_81297F8(void)
{ {
for (x = 0; x < sDecorRearrangementDataBuffer[i].width; x ++) for (x = 0; x < sDecorRearrangementDataBuffer[i].width; x ++)
{ {
MapGridSetMetatileEntryAt(posX + 7 + x, posY + 7 - y, gMapHeader.mapData->map[posX + x + gMapHeader.mapData->width * (posY - y)] | 0x3000); MapGridSetMetatileEntryAt(posX + 7 + x, posY + 7 - y, gMapHeader.mapLayout->map[posX + x + gMapHeader.mapLayout->width * (posY - y)] | 0x3000);
} }
} }
sub_81296EC(sDecorRearrangementDataBuffer[i].idx); sub_81296EC(sDecorRearrangementDataBuffer[i].idx);
+26 -26
View File
@@ -25,13 +25,13 @@ struct FieldCameraUnknownStruct
}; };
// static functions // static functions
static void RedrawMapSliceNorth(struct FieldCameraUnknownStruct *a, const struct MapData *mapData); static void RedrawMapSliceNorth(struct FieldCameraUnknownStruct *a, const struct MapLayout *mapLayout);
static void RedrawMapSliceSouth(struct FieldCameraUnknownStruct *a, const struct MapData *mapData); static void RedrawMapSliceSouth(struct FieldCameraUnknownStruct *a, const struct MapLayout *mapLayout);
static void RedrawMapSliceEast(struct FieldCameraUnknownStruct *a, const struct MapData *mapData); static void RedrawMapSliceEast(struct FieldCameraUnknownStruct *a, const struct MapLayout *mapLayout);
static void RedrawMapSliceWest(struct FieldCameraUnknownStruct *a, const struct MapData *mapData); static void RedrawMapSliceWest(struct FieldCameraUnknownStruct *a, const struct MapLayout *mapLayout);
static s32 MapPosToBgTilemapOffset(struct FieldCameraUnknownStruct *a, s32 x, s32 y); static s32 MapPosToBgTilemapOffset(struct FieldCameraUnknownStruct *a, s32 x, s32 y);
static void DrawWholeMapViewInternal(int x, int y, const struct MapData *mapData); static void DrawWholeMapViewInternal(int x, int y, const struct MapLayout *mapLayout);
static void DrawMetatileAt(const struct MapData *mapData, u16, int, int); static void DrawMetatileAt(const struct MapLayout *mapLayout, u16, int, int);
static void DrawMetatile(s32 a, u16 *b, u16 c); static void DrawMetatile(s32 a, u16 *b, u16 c);
static void CameraPanningCB_PanAhead(void); static void CameraPanningCB_PanAhead(void);
@@ -97,11 +97,11 @@ void sub_8089C08(s16 *a, s16 *b)
void DrawWholeMapView(void) void DrawWholeMapView(void)
{ {
DrawWholeMapViewInternal(gSaveBlock1Ptr->pos.x, gSaveBlock1Ptr->pos.y, gMapHeader.mapData); DrawWholeMapViewInternal(gSaveBlock1Ptr->pos.x, gSaveBlock1Ptr->pos.y, gMapHeader.mapLayout);
gUnknown_03000E20.unk4 = TRUE; gUnknown_03000E20.unk4 = TRUE;
} }
static void DrawWholeMapViewInternal(int x, int y, const struct MapData *mapData) static void DrawWholeMapViewInternal(int x, int y, const struct MapLayout *mapLayout)
{ {
u8 i; u8 i;
u8 j; u8 j;
@@ -119,27 +119,27 @@ static void DrawWholeMapViewInternal(int x, int y, const struct MapData *mapData
temp = gUnknown_03000E20.unk2 + j; temp = gUnknown_03000E20.unk2 + j;
if (temp >= 32) if (temp >= 32)
temp -= 32; temp -= 32;
DrawMetatileAt(mapData, r6 + temp, x + j / 2, y + i / 2); DrawMetatileAt(mapLayout, r6 + temp, x + j / 2, y + i / 2);
} }
} }
} }
static void RedrawMapSlicesForCameraUpdate(struct FieldCameraUnknownStruct *a, int x, int y) static void RedrawMapSlicesForCameraUpdate(struct FieldCameraUnknownStruct *a, int x, int y)
{ {
const struct MapData *mapData = gMapHeader.mapData; const struct MapLayout *mapLayout = gMapHeader.mapLayout;
if (x > 0) if (x > 0)
RedrawMapSliceWest(a, mapData); RedrawMapSliceWest(a, mapLayout);
if (x < 0) if (x < 0)
RedrawMapSliceEast(a, mapData); RedrawMapSliceEast(a, mapLayout);
if (y > 0) if (y > 0)
RedrawMapSliceNorth(a, mapData); RedrawMapSliceNorth(a, mapLayout);
if (y < 0) if (y < 0)
RedrawMapSliceSouth(a, mapData); RedrawMapSliceSouth(a, mapLayout);
a->unk4 = TRUE; a->unk4 = TRUE;
} }
static void RedrawMapSliceNorth(struct FieldCameraUnknownStruct *a, const struct MapData *mapData) static void RedrawMapSliceNorth(struct FieldCameraUnknownStruct *a, const struct MapLayout *mapLayout)
{ {
u8 i; u8 i;
u8 temp; u8 temp;
@@ -154,11 +154,11 @@ static void RedrawMapSliceNorth(struct FieldCameraUnknownStruct *a, const struct
temp = a->unk2 + i; temp = a->unk2 + i;
if (temp >= 32) if (temp >= 32)
temp -= 32; temp -= 32;
DrawMetatileAt(mapData, r7 + temp, gSaveBlock1Ptr->pos.x + i / 2, gSaveBlock1Ptr->pos.y + 14); DrawMetatileAt(mapLayout, r7 + temp, gSaveBlock1Ptr->pos.x + i / 2, gSaveBlock1Ptr->pos.y + 14);
} }
} }
static void RedrawMapSliceSouth(struct FieldCameraUnknownStruct *a, const struct MapData *mapData) static void RedrawMapSliceSouth(struct FieldCameraUnknownStruct *a, const struct MapLayout *mapLayout)
{ {
u8 i; u8 i;
u8 temp; u8 temp;
@@ -169,11 +169,11 @@ static void RedrawMapSliceSouth(struct FieldCameraUnknownStruct *a, const struct
temp = a->unk2 + i; temp = a->unk2 + i;
if (temp >= 32) if (temp >= 32)
temp -= 32; temp -= 32;
DrawMetatileAt(mapData, r7 + temp, gSaveBlock1Ptr->pos.x + i / 2, gSaveBlock1Ptr->pos.y); DrawMetatileAt(mapLayout, r7 + temp, gSaveBlock1Ptr->pos.x + i / 2, gSaveBlock1Ptr->pos.y);
} }
} }
static void RedrawMapSliceEast(struct FieldCameraUnknownStruct *a, const struct MapData *mapData) static void RedrawMapSliceEast(struct FieldCameraUnknownStruct *a, const struct MapLayout *mapLayout)
{ {
u8 i; u8 i;
u8 temp; u8 temp;
@@ -184,11 +184,11 @@ static void RedrawMapSliceEast(struct FieldCameraUnknownStruct *a, const struct
temp = a->unk3 + i; temp = a->unk3 + i;
if (temp >= 32) if (temp >= 32)
temp -= 32; temp -= 32;
DrawMetatileAt(mapData, temp * 32 + r6, gSaveBlock1Ptr->pos.x, gSaveBlock1Ptr->pos.y + i / 2); DrawMetatileAt(mapLayout, temp * 32 + r6, gSaveBlock1Ptr->pos.x, gSaveBlock1Ptr->pos.y + i / 2);
} }
} }
static void RedrawMapSliceWest(struct FieldCameraUnknownStruct *a, const struct MapData *mapData) static void RedrawMapSliceWest(struct FieldCameraUnknownStruct *a, const struct MapLayout *mapLayout)
{ {
u8 i; u8 i;
u8 temp; u8 temp;
@@ -201,7 +201,7 @@ static void RedrawMapSliceWest(struct FieldCameraUnknownStruct *a, const struct
temp = a->unk3 + i; temp = a->unk3 + i;
if (temp >= 32) if (temp >= 32)
temp -= 32; temp -= 32;
DrawMetatileAt(mapData, temp * 32 + r5, gSaveBlock1Ptr->pos.x + 14, gSaveBlock1Ptr->pos.y + i / 2); DrawMetatileAt(mapLayout, temp * 32 + r5, gSaveBlock1Ptr->pos.x + 14, gSaveBlock1Ptr->pos.y + i / 2);
} }
} }
@@ -211,7 +211,7 @@ void CurrentMapDrawMetatileAt(int a, int b)
if (offset >= 0) if (offset >= 0)
{ {
DrawMetatileAt(gMapHeader.mapData, offset, a, b); DrawMetatileAt(gMapHeader.mapLayout, offset, a, b);
gUnknown_03000E20.unk4 = TRUE; gUnknown_03000E20.unk4 = TRUE;
} }
} }
@@ -227,7 +227,7 @@ void DrawDoorMetatileAt(int x, int y, u16 *arr)
} }
} }
static void DrawMetatileAt(const struct MapData *mapData, u16 b, int c, int d) static void DrawMetatileAt(const struct MapLayout *mapLayout, u16 b, int c, int d)
{ {
u16 metatileId = MapGridGetMetatileIdAt(c, d); u16 metatileId = MapGridGetMetatileIdAt(c, d);
u16 *metatiles; u16 *metatiles;
@@ -235,10 +235,10 @@ static void DrawMetatileAt(const struct MapData *mapData, u16 b, int c, int d)
if (metatileId > 1024) if (metatileId > 1024)
metatileId = 0; metatileId = 0;
if (metatileId < 512) if (metatileId < 512)
metatiles = mapData->primaryTileset->metatiles; metatiles = mapLayout->primaryTileset->metatiles;
else else
{ {
metatiles = mapData->secondaryTileset->metatiles; metatiles = mapLayout->secondaryTileset->metatiles;
metatileId -= 512; metatileId -= 512;
} }
DrawMetatile(MapGridGetMetatileLayerTypeAt(c, d), metatiles + metatileId * 8, b); DrawMetatile(MapGridGetMetatileLayerTypeAt(c, d), metatiles + metatileId * 8, b);
+2 -2
View File
@@ -525,8 +525,8 @@ static bool32 sub_809E184(s16 x, s16 y)
void SetSootopolisGymCrackedIceMetatiles(void) void SetSootopolisGymCrackedIceMetatiles(void)
{ {
s32 x, y; s32 x, y;
s32 width = gMapHeader.mapData->width; s32 width = gMapHeader.mapLayout->width;
s32 height = gMapHeader.mapData->height; s32 height = gMapHeader.mapLayout->height;
for (x = 0; x < width; x++) for (x = 0; x < width; x++)
{ {
for (y = 0; y < height; y++) for (y = 0; y < height; y++)
+58 -58
View File
@@ -28,7 +28,7 @@ EWRAM_DATA struct Camera gCamera = {0};
EWRAM_DATA static struct ConnectionFlags gUnknown_02037340 = {0}; EWRAM_DATA static struct ConnectionFlags gUnknown_02037340 = {0};
EWRAM_DATA static u32 sFiller_02037344 = 0; // without this, the next file won't align properly EWRAM_DATA static u32 sFiller_02037344 = 0; // without this, the next file won't align properly
struct BackupMapData gUnknown_03005DC0; struct BackupMapLayout gUnknown_03005DC0;
static const struct ConnectionFlags sDummyConnectionFlags = {0}; static const struct ConnectionFlags sDummyConnectionFlags = {0};
@@ -68,19 +68,19 @@ void trainer_hill_map_load_related(void)
void mapheader_copy_mapdata_with_padding(struct MapHeader *mapHeader) void mapheader_copy_mapdata_with_padding(struct MapHeader *mapHeader)
{ {
struct MapData const *mapData; struct MapLayout const *mapLayout;
int width; int width;
int height; int height;
mapData = mapHeader->mapData; mapLayout = mapHeader->mapLayout;
CpuFastFill16(0x03ff, gUnknown_02032318, sizeof(gUnknown_02032318)); CpuFastFill16(0x03ff, gUnknown_02032318, sizeof(gUnknown_02032318));
gUnknown_03005DC0.map = gUnknown_02032318; gUnknown_03005DC0.map = gUnknown_02032318;
width = mapData->width + 15; width = mapLayout->width + 15;
gUnknown_03005DC0.width = width; gUnknown_03005DC0.width = width;
height = mapData->height + 14; height = mapLayout->height + 14;
gUnknown_03005DC0.height = height; gUnknown_03005DC0.height = height;
if (width * height <= 0x2800) if (width * height <= 0x2800)
{ {
map_copy_with_padding(mapData->map, mapData->width, mapData->height); map_copy_with_padding(mapLayout->map, mapLayout->width, mapLayout->height);
mapheader_copy_mapdata_of_adjacent_maps(mapHeader); mapheader_copy_mapdata_of_adjacent_maps(mapHeader);
} }
} }
@@ -146,8 +146,8 @@ void sub_8087F54(int x, int y, struct MapHeader const *mapHeader, int x2, int y2
u16 *dest; u16 *dest;
int mapWidth; int mapWidth;
mapWidth = mapHeader->mapData->width; mapWidth = mapHeader->mapLayout->width;
src = &mapHeader->mapData->map[mapWidth * y2 + x2]; src = &mapHeader->mapLayout->map[mapWidth * y2 + x2];
dest = &gUnknown_03005DC0.map[gUnknown_03005DC0.width * y + x]; dest = &gUnknown_03005DC0.map[gUnknown_03005DC0.width * y + x];
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
@@ -167,9 +167,9 @@ void fillSouthConnection(struct MapHeader const *mapHeader, struct MapHeader con
if (connectedMapHeader) if (connectedMapHeader)
{ {
cWidth = connectedMapHeader->mapData->width; cWidth = connectedMapHeader->mapLayout->width;
x = offset + 7; x = offset + 7;
y = mapHeader->mapData->height + 7; y = mapHeader->mapLayout->height + 7;
if (x < 0) if (x < 0)
{ {
x2 = -x; x2 = -x;
@@ -214,8 +214,8 @@ void fillNorthConnection(struct MapHeader const *mapHeader, struct MapHeader con
if (connectedMapHeader) if (connectedMapHeader)
{ {
cWidth = connectedMapHeader->mapData->width; cWidth = connectedMapHeader->mapLayout->width;
cHeight = connectedMapHeader->mapData->height; cHeight = connectedMapHeader->mapLayout->height;
x = offset + 7; x = offset + 7;
y2 = cHeight - 7; y2 = cHeight - 7;
if (x < 0) if (x < 0)
@@ -262,8 +262,8 @@ void fillWestConnection(struct MapHeader const *mapHeader, struct MapHeader cons
int cWidth, cHeight; int cWidth, cHeight;
if (connectedMapHeader) if (connectedMapHeader)
{ {
cWidth = connectedMapHeader->mapData->width; cWidth = connectedMapHeader->mapLayout->width;
cHeight = connectedMapHeader->mapData->height; cHeight = connectedMapHeader->mapLayout->height;
y = offset + 7; y = offset + 7;
x2 = cWidth - 7; x2 = cWidth - 7;
if (y < 0) if (y < 0)
@@ -308,8 +308,8 @@ void fillEastConnection(struct MapHeader const *mapHeader, struct MapHeader cons
int cHeight; int cHeight;
if (connectedMapHeader) if (connectedMapHeader)
{ {
cHeight = connectedMapHeader->mapData->height; cHeight = connectedMapHeader->mapLayout->height;
x = mapHeader->mapData->width + 7; x = mapHeader->mapLayout->width + 7;
y = offset + 7; y = offset + 7;
if (y < 0) if (y < 0)
{ {
@@ -369,10 +369,10 @@ u8 MapGridGetZCoordAt(int x, int y)
} }
else else
{ {
border = gMapHeader.mapData->border; border = gMapHeader.mapLayout->border;
i = (x + 1) & 1; i = (x + 1) & 1;
i += ((y + 1) & 1) * 2; i += ((y + 1) & 1) * 2;
block = gMapHeader.mapData->border[i]; block = gMapHeader.mapLayout->border[i];
block |= 0xc00; block |= 0xc00;
} }
@@ -397,10 +397,10 @@ u8 MapGridIsImpassableAt(int x, int y)
} }
else else
{ {
border = gMapHeader.mapData->border; border = gMapHeader.mapLayout->border;
i = (x + 1) & 1; i = (x + 1) & 1;
i += ((y + 1) & 1) * 2; i += ((y + 1) & 1) * 2;
block = gMapHeader.mapData->border[i]; block = gMapHeader.mapLayout->border[i];
block |= 0xc00; block |= 0xc00;
} }
if (block == 0x3ff) if (block == 0x3ff)
@@ -415,7 +415,7 @@ u32 MapGridGetMetatileIdAt(int x, int y)
u16 block; u16 block;
int i; int i;
int j; int j;
struct MapData const *mapData; struct MapLayout const *mapLayout;
u16 *border; u16 *border;
u16 block2; u16 block2;
@@ -426,17 +426,17 @@ u32 MapGridGetMetatileIdAt(int x, int y)
} }
else else
{ {
mapData = gMapHeader.mapData; mapLayout = gMapHeader.mapLayout;
i = (x + 1) & 1; i = (x + 1) & 1;
i += ((y + 1) & 1) * 2; i += ((y + 1) & 1) * 2;
block = mapData->border[i] | 0xc00; block = mapLayout->border[i] | 0xc00;
} }
if (block == 0x3ff) if (block == 0x3ff)
{ {
border = gMapHeader.mapData->border; border = gMapHeader.mapLayout->border;
j = (x + 1) & 1; j = (x + 1) & 1;
j += ((y + 1) & 1) * 2; j += ((y + 1) & 1) * 2;
block2 = gMapHeader.mapData->border[j]; block2 = gMapHeader.mapLayout->border[j];
block2 |= 0xc00; block2 |= 0xc00;
return block2 & block; return block2 & block;
} }
@@ -484,12 +484,12 @@ u16 GetBehaviorByMetatileId(u16 metatile)
u16 *attributes; u16 *attributes;
if (metatile <= 0x1ff) if (metatile <= 0x1ff)
{ {
attributes = gMapHeader.mapData->primaryTileset->metatileAttributes; attributes = gMapHeader.mapLayout->primaryTileset->metatileAttributes;
return attributes[metatile]; return attributes[metatile];
} }
else if (metatile <= 0x3ff) else if (metatile <= 0x3ff)
{ {
attributes = gMapHeader.mapData->secondaryTileset->metatileAttributes; attributes = gMapHeader.mapLayout->secondaryTileset->metatileAttributes;
return attributes[metatile - 0x200]; return attributes[metatile - 0x200];
} }
else else
@@ -555,7 +555,7 @@ void mapdata_from_sav2(void)
{ {
if (i == y && i != 0) if (i == y && i != 0)
a0 = 0; a0 = 0;
else if (i == y + 13 && i != gMapHeader.mapData->height - 1) else if (i == y + 13 && i != gMapHeader.mapLayout->height - 1)
a0 = 1; a0 = 1;
else else
a0 = -1; a0 = -1;
@@ -571,7 +571,7 @@ void mapdata_from_sav2(void)
{ {
if (y != 0) if (y != 0)
sub_80D423C(j, y - 1); sub_80D423C(j, y - 1);
if (i < gMapHeader.mapData->height - 1) if (i < gMapHeader.mapLayout->height - 1)
sub_80D42B8(j, y + 13); sub_80D42B8(j, y + 13);
} }
sav2_mapdata_clear(); sav2_mapdata_clear();
@@ -636,7 +636,7 @@ void sub_80885C4(u8 a1)
int GetMapBorderIdAt(int x, int y) int GetMapBorderIdAt(int x, int y)
{ {
struct MapData const *mapData; struct MapLayout const *mapLayout;
u16 block, block2; u16 block, block2;
int i, j; int i, j;
if (x >= 0 && x < gUnknown_03005DC0.width if (x >= 0 && x < gUnknown_03005DC0.width
@@ -652,10 +652,10 @@ int GetMapBorderIdAt(int x, int y)
} }
else else
{ {
mapData = gMapHeader.mapData; mapLayout = gMapHeader.mapLayout;
j = (x + 1) & 1; j = (x + 1) & 1;
j += ((y + 1) & 1) * 2; j += ((y + 1) & 1) * 2;
block2 = 0xc00 | mapData->border[j]; block2 = 0xc00 | mapLayout->border[j];
if (block2 == 0x3ff) if (block2 == 0x3ff)
{ {
goto fail; goto fail;
@@ -732,7 +732,7 @@ void sub_80887F8(struct MapConnection *connection, int direction, int x, int y)
gSaveBlock1Ptr->pos.y -= connection->offset; gSaveBlock1Ptr->pos.y -= connection->offset;
break; break;
case CONNECTION_WEST: case CONNECTION_WEST:
gSaveBlock1Ptr->pos.x = mapHeader->mapData->width; gSaveBlock1Ptr->pos.x = mapHeader->mapLayout->width;
gSaveBlock1Ptr->pos.y -= connection->offset; gSaveBlock1Ptr->pos.y -= connection->offset;
break; break;
case CONNECTION_SOUTH: case CONNECTION_SOUTH:
@@ -741,7 +741,7 @@ void sub_80887F8(struct MapConnection *connection, int direction, int x, int y)
break; break;
case CONNECTION_NORTH: case CONNECTION_NORTH:
gSaveBlock1Ptr->pos.x -= connection->offset; gSaveBlock1Ptr->pos.x -= connection->offset;
gSaveBlock1Ptr->pos.y = mapHeader->mapData->height; gSaveBlock1Ptr->pos.y = mapHeader->mapLayout->height;
break; break;
} }
} }
@@ -800,10 +800,10 @@ bool8 sub_80889A8(u8 direction, int x, int y, struct MapConnection *connection)
{ {
case CONNECTION_SOUTH: case CONNECTION_SOUTH:
case CONNECTION_NORTH: case CONNECTION_NORTH:
return sub_8088A0C(x, gMapHeader.mapData->width, mapHeader->mapData->width, connection->offset); return sub_8088A0C(x, gMapHeader.mapLayout->width, mapHeader->mapLayout->width, connection->offset);
case CONNECTION_WEST: case CONNECTION_WEST:
case CONNECTION_EAST: case CONNECTION_EAST:
return sub_8088A0C(y, gMapHeader.mapData->height, mapHeader->mapData->height, connection->offset); return sub_8088A0C(y, gMapHeader.mapLayout->height, mapHeader->mapLayout->height, connection->offset);
} }
return FALSE; return FALSE;
} }
@@ -841,10 +841,10 @@ int sub_8088A4C(struct MapConnection *connection, int x, int y)
{ {
case CONNECTION_SOUTH: case CONNECTION_SOUTH:
case CONNECTION_NORTH: case CONNECTION_NORTH:
return sub_8088A38(x - connection->offset, mapHeader->mapData->width); return sub_8088A38(x - connection->offset, mapHeader->mapLayout->width);
case CONNECTION_WEST: case CONNECTION_WEST:
case CONNECTION_EAST: case CONNECTION_EAST:
return sub_8088A38(y - connection->offset, mapHeader->mapData->height); return sub_8088A38(y - connection->offset, mapHeader->mapLayout->height);
} }
return FALSE; return FALSE;
} }
@@ -868,9 +868,9 @@ struct MapConnection *sub_8088A8C(s16 x, s16 y)
direction = connection->direction; direction = connection->direction;
if ((direction == CONNECTION_DIVE || direction == CONNECTION_EMERGE) if ((direction == CONNECTION_DIVE || direction == CONNECTION_EMERGE)
|| (direction == CONNECTION_NORTH && y > 6) || (direction == CONNECTION_NORTH && y > 6)
|| (direction == CONNECTION_SOUTH && y < gMapHeader.mapData->height + 7) || (direction == CONNECTION_SOUTH && y < gMapHeader.mapLayout->height + 7)
|| (direction == CONNECTION_WEST && x > 6) || (direction == CONNECTION_WEST && x > 6)
|| (direction == CONNECTION_EAST && x < gMapHeader.mapData->width + 7)) || (direction == CONNECTION_EAST && x < gMapHeader.mapLayout->width + 7))
{ {
continue; continue;
} }
@@ -990,45 +990,45 @@ void apply_map_tileset_palette(struct Tileset const *tileset, u16 destOffset, u1
} }
} }
void copy_map_tileset1_to_vram(struct MapData const *mapData) void copy_map_tileset1_to_vram(struct MapLayout const *mapLayout)
{ {
copy_tileset_patterns_to_vram(mapData->primaryTileset, 0x200, 0); copy_tileset_patterns_to_vram(mapLayout->primaryTileset, 0x200, 0);
} }
void copy_map_tileset2_to_vram(struct MapData const *mapData) void copy_map_tileset2_to_vram(struct MapLayout const *mapLayout)
{ {
copy_tileset_patterns_to_vram(mapData->secondaryTileset, 0x200, 0x200); copy_tileset_patterns_to_vram(mapLayout->secondaryTileset, 0x200, 0x200);
} }
void copy_map_tileset2_to_vram_2(struct MapData const *mapData) void copy_map_tileset2_to_vram_2(struct MapLayout const *mapLayout)
{ {
copy_tileset_patterns_to_vram2(mapData->secondaryTileset, 0x200, 0x200); copy_tileset_patterns_to_vram2(mapLayout->secondaryTileset, 0x200, 0x200);
} }
void apply_map_tileset1_palette(struct MapData const *mapData) void apply_map_tileset1_palette(struct MapLayout const *mapLayout)
{ {
apply_map_tileset_palette(mapData->primaryTileset, 0, 0xC0); apply_map_tileset_palette(mapLayout->primaryTileset, 0, 0xC0);
} }
void apply_map_tileset2_palette(struct MapData const *mapData) void apply_map_tileset2_palette(struct MapLayout const *mapLayout)
{ {
apply_map_tileset_palette(mapData->secondaryTileset, 0x60, 0xE0); apply_map_tileset_palette(mapLayout->secondaryTileset, 0x60, 0xE0);
} }
void copy_map_tileset1_tileset2_to_vram(struct MapData const *mapData) void copy_map_tileset1_tileset2_to_vram(struct MapLayout const *mapLayout)
{ {
if (mapData) if (mapLayout)
{ {
copy_tileset_patterns_to_vram2(mapData->primaryTileset, 0x200, 0); copy_tileset_patterns_to_vram2(mapLayout->primaryTileset, 0x200, 0);
copy_tileset_patterns_to_vram2(mapData->secondaryTileset, 0x200, 0x200); copy_tileset_patterns_to_vram2(mapLayout->secondaryTileset, 0x200, 0x200);
} }
} }
void apply_map_tileset1_tileset2_palette(struct MapData const *mapData) void apply_map_tileset1_tileset2_palette(struct MapLayout const *mapLayout)
{ {
if (mapData) if (mapLayout)
{ {
apply_map_tileset1_palette(mapData); apply_map_tileset1_palette(mapLayout);
apply_map_tileset2_palette(mapData); apply_map_tileset2_palette(mapLayout);
} }
} }
+6 -6
View File
@@ -424,23 +424,23 @@ bool8 sub_80FD730(struct MapConnection *connection, int x, int y)
case 2: case 2:
localOffset = connection->offset + 7; localOffset = connection->offset + 7;
localX = x - localOffset; localX = x - localOffset;
localLength = mapHeader->mapData->height - 7; localLength = mapHeader->mapLayout->height - 7;
localY = localLength + y; // additions are reversed for some reason localY = localLength + y; // additions are reversed for some reason
break; break;
case 1: case 1:
localOffset = connection->offset + 7; localOffset = connection->offset + 7;
localX = x - localOffset; localX = x - localOffset;
localLength = gMapHeader.mapData->height + 7; localLength = gMapHeader.mapLayout->height + 7;
localY = y - localLength; localY = y - localLength;
break; break;
case 3: case 3:
localLength = mapHeader->mapData->width - 7; localLength = mapHeader->mapLayout->width - 7;
localX = localLength + x; // additions are reversed for some reason localX = localLength + x; // additions are reversed for some reason
localOffset = connection->offset + 7; localOffset = connection->offset + 7;
localY = y - localOffset; localY = y - localOffset;
break; break;
case 4: case 4:
localLength = gMapHeader.mapData->width + 7; localLength = gMapHeader.mapLayout->width + 7;
localX = x - localLength; localX = x - localLength;
localOffset = connection->offset + 7; localOffset = connection->offset + 7;
localY = y - localOffset; localY = y - localOffset;
@@ -455,8 +455,8 @@ void sub_80FD7C8(u8 taskId)
{ {
s16 x, y; s16 x, y;
s16 curX, curY; s16 curX, curY;
s16 width = gMapHeader.mapData->width + 7; s16 width = gMapHeader.mapLayout->width + 7;
s16 height = gMapHeader.mapData->height + 7; s16 height = gMapHeader.mapLayout->height + 7;
s16 var1 = 7; s16 var1 = 7;
s16 var2 = 7; s16 var2 = 7;
+1 -1
View File
@@ -228,7 +228,7 @@ static void ShowMapNamePopUpWindow(void)
if(InBattlePyramid()) if(InBattlePyramid())
{ {
if(gMapHeader.mapDataId == 0x17A) if(gMapHeader.mapLayoutId == 0x17A)
{ {
withoutPrefixPtr = &(mapDisplayHeader[3]); withoutPrefixPtr = &(mapDisplayHeader[3]);
mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[7]; mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[7];
+36 -36
View File
@@ -81,7 +81,7 @@ extern const u8 gUnknown_082774EF[];
extern const u8 gUnknown_08277509[]; extern const u8 gUnknown_08277509[];
// vars // vars
extern const struct MapData *const gMapAttributes[]; extern const struct MapLayout *const gMapLayouts[];
extern const struct MapHeader *const *const gMapGroups[]; extern const struct MapHeader *const *const gMapGroups[];
extern const s32 gMaxFlashLevel; extern const s32 gMaxFlashLevel;
extern const u16 gUnknown_82EC7C4[]; extern const u16 gUnknown_82EC7C4[];
@@ -97,16 +97,16 @@ extern void HealPlayerParty(void);
extern void move_tilemap_camera_to_upper_left_corner(void); extern void move_tilemap_camera_to_upper_left_corner(void);
extern void cur_mapheader_run_tileset_funcs_after_some_cpuset(void); extern void cur_mapheader_run_tileset_funcs_after_some_cpuset(void);
extern void DrawWholeMapView(void); extern void DrawWholeMapView(void);
extern void copy_map_tileset1_tileset2_to_vram(const struct MapData *); extern void copy_map_tileset1_tileset2_to_vram(const struct MapLayout *);
extern void apply_map_tileset1_tileset2_palette(const struct MapData *); extern void apply_map_tileset1_tileset2_palette(const struct MapLayout *);
extern void ResetCyclingRoadChallengeData(void); extern void ResetCyclingRoadChallengeData(void);
extern void ApplyNewEncryptionKeyToWord(u32 *word, u32 newKey); extern void ApplyNewEncryptionKeyToWord(u32 *word, u32 newKey);
extern void mapheader_run_script_with_tag_x5(void); extern void mapheader_run_script_with_tag_x5(void);
extern void ResetFieldTasksArgs(void); extern void ResetFieldTasksArgs(void);
extern void sub_80A0A2C(void); extern void sub_80A0A2C(void);
extern void not_trainer_hill_battle_pyramid(void); extern void not_trainer_hill_battle_pyramid(void);
extern void apply_map_tileset2_palette(const struct MapData *); extern void apply_map_tileset2_palette(const struct MapLayout *);
extern void copy_map_tileset2_to_vram_2(const struct MapData *); extern void copy_map_tileset2_to_vram_2(const struct MapLayout *);
extern void prev_quest_postbuffer_cursor_backup_reset(void); extern void prev_quest_postbuffer_cursor_backup_reset(void);
extern void ShowMapNamePopup(void); extern void ShowMapNamePopup(void);
extern bool32 InTrainerHill(void); extern bool32 InTrainerHill(void);
@@ -143,8 +143,8 @@ extern void sub_80EDB44(void);
extern void sub_81D64C0(void); extern void sub_81D64C0(void);
extern void sub_81BE6AC(void); extern void sub_81BE6AC(void);
extern void sub_8098128(void); extern void sub_8098128(void);
extern void copy_map_tileset1_to_vram(const struct MapData *); extern void copy_map_tileset1_to_vram(const struct MapLayout *);
extern void copy_map_tileset2_to_vram(const struct MapData *); extern void copy_map_tileset2_to_vram(const struct MapLayout *);
extern void FieldUpdateBgTilemapScroll(void); extern void FieldUpdateBgTilemapScroll(void);
extern void TransferTilesetAnimsBuffer(void); extern void TransferTilesetAnimsBuffer(void);
extern bool32 sub_81D5F48(void); extern bool32 sub_81D5F48(void);
@@ -558,17 +558,17 @@ void Overworld_SetEventObjTemplateMovementType(u8 localId, u8 movementType)
static void mapdata_load_assets_to_gpu_and_full_redraw(void) static void mapdata_load_assets_to_gpu_and_full_redraw(void)
{ {
move_tilemap_camera_to_upper_left_corner(); move_tilemap_camera_to_upper_left_corner();
copy_map_tileset1_tileset2_to_vram(gMapHeader.mapData); copy_map_tileset1_tileset2_to_vram(gMapHeader.mapLayout);
apply_map_tileset1_tileset2_palette(gMapHeader.mapData); apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout);
DrawWholeMapView(); DrawWholeMapView();
cur_mapheader_run_tileset_funcs_after_some_cpuset(); cur_mapheader_run_tileset_funcs_after_some_cpuset();
} }
const struct MapData *get_mapdata_header(void) const struct MapLayout *GetMapLayout(void)
{ {
u16 mapDataId = gSaveBlock1Ptr->mapDataId; u16 mapLayoutId = gSaveBlock1Ptr->mapLayoutId;
if (mapDataId) if (mapLayoutId)
return gMapAttributes[mapDataId - 1]; return gMapLayouts[mapLayoutId - 1];
return NULL; return NULL;
} }
@@ -625,14 +625,14 @@ void set_current_map_header_from_sav1_save_old_name(void)
{ {
sLastMapSectionId = gMapHeader.regionMapSectionId; sLastMapSectionId = gMapHeader.regionMapSectionId;
gMapHeader = *Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum); gMapHeader = *Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum);
gSaveBlock1Ptr->mapDataId = gMapHeader.mapDataId; gSaveBlock1Ptr->mapLayoutId = gMapHeader.mapLayoutId;
gMapHeader.mapData = get_mapdata_header(); gMapHeader.mapLayout = GetMapLayout();
} }
void LoadSaveblockMapHeader(void) void LoadSaveblockMapHeader(void)
{ {
gMapHeader = *Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum); gMapHeader = *Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum);
gMapHeader.mapData = get_mapdata_header(); gMapHeader.mapLayout = GetMapLayout();
} }
void update_camera_pos_from_warpid(void) void update_camera_pos_from_warpid(void)
@@ -649,8 +649,8 @@ void update_camera_pos_from_warpid(void)
} }
else else
{ {
gSaveBlock1Ptr->pos.x = gMapHeader.mapData->width / 2; gSaveBlock1Ptr->pos.x = gMapHeader.mapLayout->width / 2;
gSaveBlock1Ptr->pos.y = gMapHeader.mapData->height / 2; gSaveBlock1Ptr->pos.y = gMapHeader.mapLayout->height / 2;
} }
} }
@@ -837,8 +837,8 @@ void mliX_load_map(u8 mapGroup, u8 mapNum)
Overworld_ClearSavedMusic(); Overworld_ClearSavedMusic();
mapheader_run_script_with_tag_x3(); mapheader_run_script_with_tag_x3();
not_trainer_hill_battle_pyramid(); not_trainer_hill_battle_pyramid();
copy_map_tileset2_to_vram_2(gMapHeader.mapData); copy_map_tileset2_to_vram_2(gMapHeader.mapLayout);
apply_map_tileset2_palette(gMapHeader.mapData); apply_map_tileset2_palette(gMapHeader.mapLayout);
for (paletteIndex = 6; paletteIndex < 13; paletteIndex++) for (paletteIndex = 6; paletteIndex < 13; paletteIndex++)
ApplyWeatherGammaShiftToPal(paletteIndex); ApplyWeatherGammaShiftToPal(paletteIndex);
@@ -862,7 +862,7 @@ static void mli0_load_map(u32 a1)
set_current_map_header_from_sav1_save_old_name(); set_current_map_header_from_sav1_save_old_name();
if (!(sUnknown_020322D8 & 1)) if (!(sUnknown_020322D8 & 1))
{ {
if (gMapHeader.mapDataId == 0x169) if (gMapHeader.mapLayoutId == 0x169)
sub_81AA1D8(); sub_81AA1D8();
else if (InTrainerHill()) else if (InTrainerHill())
sub_81D5DF8(); sub_81D5DF8();
@@ -890,7 +890,7 @@ static void mli0_load_map(u32 a1)
mapheader_run_script_with_tag_x3(); mapheader_run_script_with_tag_x3();
UpdateLocationHistoryForRoamer(); UpdateLocationHistoryForRoamer();
RoamerMoveToOtherLocationSet(); RoamerMoveToOtherLocationSet();
if (gMapHeader.mapDataId == 0x169) if (gMapHeader.mapLayoutId == 0x169)
battle_pyramid_map_load_related(0); battle_pyramid_map_load_related(0);
else if (InTrainerHill()) else if (InTrainerHill())
trainer_hill_map_load_related(); trainer_hill_map_load_related();
@@ -1016,10 +1016,10 @@ u8 Overworld_GetFlashLevel(void)
return gSaveBlock1Ptr->flashLevel; return gSaveBlock1Ptr->flashLevel;
} }
void sub_8085524(u16 mapDataId) void sub_8085524(u16 mapLayoutId)
{ {
gSaveBlock1Ptr->mapDataId = mapDataId; gSaveBlock1Ptr->mapLayoutId = mapLayoutId;
gMapHeader.mapData = get_mapdata_header(); gMapHeader.mapLayout = GetMapLayout();
} }
void sub_8085540(u8 var) void sub_8085540(u8 var)
@@ -1729,7 +1729,7 @@ void CB2_ContinueSavedGame(void)
LoadSaveblockMapHeader(); LoadSaveblockMapHeader();
set_warp2_warp3_to_neg_1(); set_warp2_warp3_to_neg_1();
trainerHillMapId = GetCurrentTrainerHillMapId(); trainerHillMapId = GetCurrentTrainerHillMapId();
if (gMapHeader.mapDataId == 0x169) if (gMapHeader.mapLayoutId == 0x169)
sub_81AA2F8(); sub_81AA2F8();
else if (trainerHillMapId != 0 && trainerHillMapId != 6) else if (trainerHillMapId != 0 && trainerHillMapId != 6)
sub_81D5F48(); sub_81D5F48();
@@ -1739,7 +1739,7 @@ void CB2_ContinueSavedGame(void)
UnfreezeEventObjects(); UnfreezeEventObjects();
DoTimeBasedEvents(); DoTimeBasedEvents();
sub_8084788(); sub_8084788();
if (gMapHeader.mapDataId == 0x169) if (gMapHeader.mapLayoutId == 0x169)
battle_pyramid_map_load_related(1); battle_pyramid_map_load_related(1);
else if (trainerHillMapId != 0) else if (trainerHillMapId != 0)
trainer_hill_map_load_related(); trainer_hill_map_load_related();
@@ -1859,17 +1859,17 @@ static bool32 map_loading_iteration_3(u8 *state)
(*state)++; (*state)++;
break; break;
case 6: case 6:
copy_map_tileset1_to_vram(gMapHeader.mapData); copy_map_tileset1_to_vram(gMapHeader.mapLayout);
(*state)++; (*state)++;
break; break;
case 7: case 7:
copy_map_tileset2_to_vram(gMapHeader.mapData); copy_map_tileset2_to_vram(gMapHeader.mapLayout);
(*state)++; (*state)++;
break; break;
case 8: case 8:
if (free_temp_tile_data_buffers_if_possible() != TRUE) if (free_temp_tile_data_buffers_if_possible() != TRUE)
{ {
apply_map_tileset1_tileset2_palette(gMapHeader.mapData); apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout);
(*state)++; (*state)++;
} }
break; break;
@@ -1934,17 +1934,17 @@ static bool32 load_map_stuff(u8 *state, u32 a2)
(*state)++; (*state)++;
break; break;
case 6: case 6:
copy_map_tileset1_to_vram(gMapHeader.mapData); copy_map_tileset1_to_vram(gMapHeader.mapLayout);
(*state)++; (*state)++;
break; break;
case 7: case 7:
copy_map_tileset2_to_vram(gMapHeader.mapData); copy_map_tileset2_to_vram(gMapHeader.mapLayout);
(*state)++; (*state)++;
break; break;
case 8: case 8:
if (free_temp_tile_data_buffers_if_possible() != TRUE) if (free_temp_tile_data_buffers_if_possible() != TRUE)
{ {
apply_map_tileset1_tileset2_palette(gMapHeader.mapData); apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout);
(*state)++; (*state)++;
} }
break; break;
@@ -2031,17 +2031,17 @@ static bool32 map_loading_iteration_2_link(u8 *state)
(*state)++; (*state)++;
break; break;
case 5: case 5:
copy_map_tileset1_to_vram(gMapHeader.mapData); copy_map_tileset1_to_vram(gMapHeader.mapLayout);
(*state)++; (*state)++;
break; break;
case 6: case 6:
copy_map_tileset2_to_vram(gMapHeader.mapData); copy_map_tileset2_to_vram(gMapHeader.mapLayout);
(*state)++; (*state)++;
break; break;
case 7: case 7:
if (free_temp_tile_data_buffers_if_possible() != TRUE) if (free_temp_tile_data_buffers_if_possible() != TRUE)
{ {
apply_map_tileset1_tileset2_palette(gMapHeader.mapData); apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout);
(*state)++; (*state)++;
} }
break; break;
+1 -1
View File
@@ -5620,7 +5620,7 @@ void SetWildMonHeldItem(void)
var1 = 20; var1 = 20;
var2 = 80; var2 = 80;
} }
if (gMapHeader.mapDataId == 0x1A4) if (gMapHeader.mapLayoutId == 0x1A4)
{ {
s32 alteringCaveId = GetWildMonTableIdInAlteringCave(species); s32 alteringCaveId = GetWildMonTableIdInAlteringCave(species);
if (alteringCaveId != 0) if (alteringCaveId != 0)
+10 -10
View File
@@ -891,8 +891,8 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
case 6: case 6:
gRegionMap->mapSecId = gMapHeader.regionMapSectionId; gRegionMap->mapSecId = gMapHeader.regionMapSectionId;
gRegionMap->playerIsInCave = FALSE; gRegionMap->playerIsInCave = FALSE;
mapWidth = gMapHeader.mapData->width; mapWidth = gMapHeader.mapLayout->width;
mapHeight = gMapHeader.mapData->height; mapHeight = gMapHeader.mapLayout->height;
x = gSaveBlock1Ptr->pos.x; x = gSaveBlock1Ptr->pos.x;
y = gSaveBlock1Ptr->pos.y; y = gSaveBlock1Ptr->pos.y;
if (gRegionMap->mapSecId == MAPSEC_UNDERWATER_128 || gRegionMap->mapSecId == MAPSEC_UNDERWATER_MARINE_CAVE) if (gRegionMap->mapSecId == MAPSEC_UNDERWATER_128 || gRegionMap->mapSecId == MAPSEC_UNDERWATER_MARINE_CAVE)
@@ -907,8 +907,8 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->warp4.mapGroup, gSaveBlock1Ptr->warp4.mapNum); mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->warp4.mapGroup, gSaveBlock1Ptr->warp4.mapNum);
gRegionMap->mapSecId = mapHeader->regionMapSectionId; gRegionMap->mapSecId = mapHeader->regionMapSectionId;
gRegionMap->playerIsInCave = TRUE; gRegionMap->playerIsInCave = TRUE;
mapWidth = mapHeader->mapData->width; mapWidth = mapHeader->mapLayout->width;
mapHeight = mapHeader->mapData->height; mapHeight = mapHeader->mapLayout->height;
x = gSaveBlock1Ptr->warp4.x; x = gSaveBlock1Ptr->warp4.x;
y = gSaveBlock1Ptr->warp4.y; y = gSaveBlock1Ptr->warp4.y;
} }
@@ -926,8 +926,8 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
mapHeader = Overworld_GetMapHeaderByGroupAndId((u16)gSaveBlock1Ptr->warp2.mapGroup, (u16)gSaveBlock1Ptr->warp2.mapNum); mapHeader = Overworld_GetMapHeaderByGroupAndId((u16)gSaveBlock1Ptr->warp2.mapGroup, (u16)gSaveBlock1Ptr->warp2.mapNum);
gRegionMap->mapSecId = mapHeader->regionMapSectionId; gRegionMap->mapSecId = mapHeader->regionMapSectionId;
gRegionMap->playerIsInCave = TRUE; gRegionMap->playerIsInCave = TRUE;
mapWidth = mapHeader->mapData->width; mapWidth = mapHeader->mapLayout->width;
mapHeight = mapHeader->mapData->height; mapHeight = mapHeader->mapLayout->height;
x = gSaveBlock1Ptr->warp2.x; x = gSaveBlock1Ptr->warp2.x;
y = gSaveBlock1Ptr->warp2.y; y = gSaveBlock1Ptr->warp2.y;
break; break;
@@ -953,8 +953,8 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
{ {
gRegionMap->playerIsInCave = FALSE; gRegionMap->playerIsInCave = FALSE;
} }
mapWidth = mapHeader->mapData->width; mapWidth = mapHeader->mapLayout->width;
mapHeight = mapHeader->mapData->height; mapHeight = mapHeader->mapLayout->height;
x = storedWarp->x; x = storedWarp->x;
y = storedWarp->y; y = storedWarp->y;
break; break;
@@ -1068,14 +1068,14 @@ static void RegionMap_InitializeStateBasedOnSSTidalLocation(void)
mapHeader = Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum); mapHeader = Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum);
gRegionMap->mapSecId = mapHeader->regionMapSectionId; gRegionMap->mapSecId = mapHeader->regionMapSectionId;
dimensionScale = mapHeader->mapData->width / gRegionMapEntries[gRegionMap->mapSecId].width; dimensionScale = mapHeader->mapLayout->width / gRegionMapEntries[gRegionMap->mapSecId].width;
if (dimensionScale == 0) if (dimensionScale == 0)
dimensionScale = 1; dimensionScale = 1;
x = xOnMap / dimensionScale; x = xOnMap / dimensionScale;
if (x >= gRegionMapEntries[gRegionMap->mapSecId].width) if (x >= gRegionMapEntries[gRegionMap->mapSecId].width)
x = gRegionMapEntries[gRegionMap->mapSecId].width - 1; x = gRegionMapEntries[gRegionMap->mapSecId].width - 1;
dimensionScale = mapHeader->mapData->height / gRegionMapEntries[gRegionMap->mapSecId].height; dimensionScale = mapHeader->mapLayout->height / gRegionMapEntries[gRegionMap->mapSecId].height;
if (dimensionScale == 0) if (dimensionScale == 0)
dimensionScale = 1; dimensionScale = 1;
y = yOnMap / dimensionScale; y = yOnMap / dimensionScale;
+5 -5
View File
@@ -246,16 +246,16 @@ void sub_80E8C98(void)
void sub_80E8CB0(s16 *xPtr, s16 *yPtr, u16 tile) void sub_80E8CB0(s16 *xPtr, s16 *yPtr, u16 tile)
{ {
const struct MapData *mapData; const struct MapLayout *mapLayout;
s16 x; s16 x;
s16 y; s16 y;
mapData = gMapHeader.mapData; mapLayout = gMapHeader.mapLayout;
for (y = 0; y < mapData->height; y ++) for (y = 0; y < mapLayout->height; y ++)
{ {
for (x = 0; x < mapData->width; x ++) for (x = 0; x < mapLayout->width; x ++)
{ {
if ((mapData->map[y * mapData->width + x] & 0x3ff) == tile) if ((mapLayout->map[y * mapLayout->width + x] & 0x3ff) == tile)
{ {
*xPtr = x; *xPtr = x;
*yPtr = y; *yPtr = y;
+4 -4
View File
@@ -686,8 +686,8 @@ static void cur_mapheader_run_tileset1_func(void)
sPrimaryTilesetCBCounter = 0; sPrimaryTilesetCBCounter = 0;
sPrimaryTilesetCBBufferSize = 0; sPrimaryTilesetCBBufferSize = 0;
sPrimaryTilesetCB = NULL; sPrimaryTilesetCB = NULL;
if (gMapHeader.mapData->primaryTileset && gMapHeader.mapData->primaryTileset->callback) if (gMapHeader.mapLayout->primaryTileset && gMapHeader.mapLayout->primaryTileset->callback)
gMapHeader.mapData->primaryTileset->callback(); gMapHeader.mapLayout->primaryTileset->callback();
} }
static void cur_mapheader_run_tileset2_func(void) static void cur_mapheader_run_tileset2_func(void)
@@ -695,8 +695,8 @@ static void cur_mapheader_run_tileset2_func(void)
sSecondaryTilesetCBCounter = 0; sSecondaryTilesetCBCounter = 0;
sSecondaryTilesetCBBufferSize = 0; sSecondaryTilesetCBBufferSize = 0;
sSecondaryTilesetCB = NULL; sSecondaryTilesetCB = NULL;
if (gMapHeader.mapData->secondaryTileset && gMapHeader.mapData->secondaryTileset->callback) if (gMapHeader.mapLayout->secondaryTileset && gMapHeader.mapLayout->secondaryTileset->callback)
gMapHeader.mapData->secondaryTileset->callback(); gMapHeader.mapLayout->secondaryTileset->callback();
} }
void TilesetCb_General(void) void TilesetCb_General(void)
+4 -4
View File
@@ -1958,7 +1958,7 @@ void sub_80EDB44(void)
show->rivalTrainer.dexCount = GetHoennPokedexCount(0x01); show->rivalTrainer.dexCount = GetHoennPokedexCount(0x01);
} }
show->rivalTrainer.location = gMapHeader.regionMapSectionId; show->rivalTrainer.location = gMapHeader.regionMapSectionId;
show->rivalTrainer.mapDataId = gMapHeader.mapDataId; show->rivalTrainer.mapLayoutId = gMapHeader.mapLayoutId;
show->rivalTrainer.nSilverSymbols = 0; show->rivalTrainer.nSilverSymbols = 0;
show->rivalTrainer.nGoldSymbols = 0; show->rivalTrainer.nGoldSymbols = 0;
for (i = 0; i < 7; i ++) for (i = 0; i < 7; i ++)
@@ -2010,7 +2010,7 @@ void sub_80EDCE8(void)
show->treasureInvestigators.active = FALSE; show->treasureInvestigators.active = FALSE;
show->treasureInvestigators.item = gSpecialVar_0x8005; show->treasureInvestigators.item = gSpecialVar_0x8005;
show->treasureInvestigators.location = gMapHeader.regionMapSectionId; show->treasureInvestigators.location = gMapHeader.regionMapSectionId;
show->treasureInvestigators.mapDataId = gMapHeader.mapDataId; show->treasureInvestigators.mapLayoutId = gMapHeader.mapLayoutId;
StringCopy(show->treasureInvestigators.playerName, gSaveBlock2Ptr->playerName); StringCopy(show->treasureInvestigators.playerName, gSaveBlock2Ptr->playerName);
tv_store_id_3x(show); tv_store_id_3x(show);
show->treasureInvestigators.language = gGameLanguage; show->treasureInvestigators.language = gGameLanguage;
@@ -6261,7 +6261,7 @@ static void DoTVShowTodaysRivalTrainer(void)
sTVShowState = 8; sTVShowState = 8;
break; break;
case MAPSEC_DYNAMIC: case MAPSEC_DYNAMIC:
switch (show->rivalTrainer.mapDataId) switch (show->rivalTrainer.mapLayoutId)
{ {
case 0x115 ... 0x117: case 0x115 ... 0x117:
sTVShowState = 10; sTVShowState = 10;
@@ -6460,7 +6460,7 @@ static void DoTVShowHoennTreasureInvestigators(void)
StringCopy(gStringVar1, ItemId_GetName(show->treasureInvestigators.item)); StringCopy(gStringVar1, ItemId_GetName(show->treasureInvestigators.item));
if (show->treasureInvestigators.location == MAPSEC_DYNAMIC) if (show->treasureInvestigators.location == MAPSEC_DYNAMIC)
{ {
switch (show->treasureInvestigators.mapDataId) switch (show->treasureInvestigators.mapLayoutId)
{ {
case 0x115 ... 0x117: case 0x115 ... 0x117:
sTVShowState = 2; sTVShowState = 2;
+7 -7
View File
@@ -4613,7 +4613,7 @@ static u16 GetRoute119WaterTileNum(s16 x, s16 y, u8 section)
for (yCur = yMin; yCur <= yMax; yCur++) for (yCur = yMin; yCur <= yMax; yCur++)
{ {
for (xCur = 0; xCur < gMapHeader.mapData->width; xCur++) for (xCur = 0; xCur < gMapHeader.mapLayout->width; xCur++)
{ {
u8 tileBehaviorId = MapGridGetMetatileBehaviorAt(xCur + 7, yCur + 7); u8 tileBehaviorId = MapGridGetMetatileBehaviorAt(xCur + 7, yCur + 7);
if (MetatileBehavior_IsSurfableAndNotWaterfall(tileBehaviorId) == TRUE) if (MetatileBehavior_IsSurfableAndNotWaterfall(tileBehaviorId) == TRUE)
@@ -4976,7 +4976,7 @@ static bool8 TryGenerateWildMon(const struct WildPokemonInfo *wildMonInfo, u8 ar
level = ChooseWildMonLevel(&wildMonInfo->wildPokemon[wildMonIndex]); level = ChooseWildMonLevel(&wildMonInfo->wildPokemon[wildMonIndex]);
if (flags & WILD_CHECK_REPEL && !IsWildLevelAllowedByRepel(level)) if (flags & WILD_CHECK_REPEL && !IsWildLevelAllowedByRepel(level))
return FALSE; return FALSE;
if (gMapHeader.mapDataId != 0x166 && flags & WILD_CHECK_KEEN_EYE && !IsAbilityAllowingEncounter(level)) if (gMapHeader.mapLayoutId != 0x166 && flags & WILD_CHECK_KEEN_EYE && !IsAbilityAllowingEncounter(level))
return FALSE; return FALSE;
CreateWildMon(wildMonInfo->wildPokemon[wildMonIndex].species, level); CreateWildMon(wildMonInfo->wildPokemon[wildMonIndex].species, level);
@@ -5037,7 +5037,7 @@ static bool8 DoWildEncounterRateTest(u32 encounterRate, bool8 ignoreAbility)
{ {
u32 ability = GetMonAbility(&gPlayerParty[0]); u32 ability = GetMonAbility(&gPlayerParty[0]);
if (ability == ABILITY_STENCH && gMapHeader.mapDataId == 0x169) if (ability == ABILITY_STENCH && gMapHeader.mapLayoutId == 0x169)
encounterRate = encounterRate * 3 / 4; encounterRate = encounterRate * 3 / 4;
else if (ability == ABILITY_STENCH) else if (ability == ABILITY_STENCH)
encounterRate /= 2; encounterRate /= 2;
@@ -5085,7 +5085,7 @@ bool8 StandardWildEncounter(u16 currMetaTileBehavior, u16 previousMetaTileBehavi
headerId = GetCurrentMapWildMonHeaderId(); headerId = GetCurrentMapWildMonHeaderId();
if (headerId == 0xFFFF) // invalid if (headerId == 0xFFFF) // invalid
{ {
if (gMapHeader.mapDataId == 0x166) if (gMapHeader.mapLayoutId == 0x166)
{ {
headerId = GetBattlePikeWildMonHeaderId(); headerId = GetBattlePikeWildMonHeaderId();
if (previousMetaTileBehavior != currMetaTileBehavior && !DoGlobalWildEncounterDiceRoll()) if (previousMetaTileBehavior != currMetaTileBehavior && !DoGlobalWildEncounterDiceRoll())
@@ -5100,7 +5100,7 @@ bool8 StandardWildEncounter(u16 currMetaTileBehavior, u16 previousMetaTileBehavi
BattleSetup_StartBattlePikeWildBattle(); BattleSetup_StartBattlePikeWildBattle();
return TRUE; return TRUE;
} }
if (gMapHeader.mapDataId == 0x169) if (gMapHeader.mapLayoutId == 0x169)
{ {
headerId = gSaveBlock2Ptr->battlePyramidWildHeaderId; headerId = gSaveBlock2Ptr->battlePyramidWildHeaderId;
if (previousMetaTileBehavior != currMetaTileBehavior && !DoGlobalWildEncounterDiceRoll()) if (previousMetaTileBehavior != currMetaTileBehavior && !DoGlobalWildEncounterDiceRoll())
@@ -5228,7 +5228,7 @@ bool8 SweetScentWildEncounter(void)
headerId = GetCurrentMapWildMonHeaderId(); headerId = GetCurrentMapWildMonHeaderId();
if (headerId == 0xFFFF) // invalid if (headerId == 0xFFFF) // invalid
{ {
if (gMapHeader.mapDataId == 0x166) if (gMapHeader.mapLayoutId == 0x166)
{ {
headerId = GetBattlePikeWildMonHeaderId(); headerId = GetBattlePikeWildMonHeaderId();
if (TryGenerateWildMon(gBattlePikeWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, 0) != TRUE) if (TryGenerateWildMon(gBattlePikeWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, 0) != TRUE)
@@ -5238,7 +5238,7 @@ bool8 SweetScentWildEncounter(void)
BattleSetup_StartBattlePikeWildBattle(); BattleSetup_StartBattlePikeWildBattle();
return TRUE; return TRUE;
} }
if (gMapHeader.mapDataId == 0x169) if (gMapHeader.mapLayoutId == 0x169)
{ {
headerId = gSaveBlock2Ptr->battlePyramidWildHeaderId; headerId = gSaveBlock2Ptr->battlePyramidWildHeaderId;
if (TryGenerateWildMon(gBattlePyramidWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, 0) != TRUE) if (TryGenerateWildMon(gBattlePyramidWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, 0) != TRUE)