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