Merge pull request #1762 from GriffinRichards/sync-fieldmap
Sync fieldmap
This commit is contained in:
commit
d3d8b4a181
5 changed files with 20 additions and 19 deletions
|
@ -47,7 +47,7 @@ void CopySecondaryTilesetToVramUsingHeap(struct MapLayout const *mapLayout);
|
||||||
void CopyPrimaryTilesetToVram(const struct MapLayout *);
|
void CopyPrimaryTilesetToVram(const struct MapLayout *);
|
||||||
void CopySecondaryTilesetToVram(const struct MapLayout *);
|
void CopySecondaryTilesetToVram(const struct MapLayout *);
|
||||||
struct MapHeader const *const GetMapHeaderFromConnection(struct MapConnection *connection);
|
struct MapHeader const *const GetMapHeaderFromConnection(struct MapConnection *connection);
|
||||||
struct MapConnection *GetConnectionAtCoords(s16 x, s16 y);
|
struct MapConnection *GetMapConnectionAtPos(s16 x, s16 y);
|
||||||
void MapGridSetMetatileImpassabilityAt(int x, int y, bool32 impassable);
|
void MapGridSetMetatileImpassabilityAt(int x, int y, bool32 impassable);
|
||||||
|
|
||||||
// field_region_map.c
|
// field_region_map.c
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
// Masks/shifts for blocks in the map grid
|
// Masks/shifts for blocks in the map grid
|
||||||
// Map grid blocks consist of a 10 bit metatile id, a 2 bit collision value, and a 4 bit elevation value
|
// Map grid blocks consist of a 10 bit metatile id, a 2 bit collision value, and a 4 bit elevation value
|
||||||
// This is the data stored in each data/layouts/*/map.bin file
|
// This is the data stored in each data/layouts/*/map.bin file
|
||||||
#define MAPGRID_METATILE_ID_MASK 0x03FF // Bits 1-10
|
#define MAPGRID_METATILE_ID_MASK 0x03FF // Bits 0-9
|
||||||
#define MAPGRID_COLLISION_MASK 0x0C00 // Bits 11-12
|
#define MAPGRID_COLLISION_MASK 0x0C00 // Bits 10-11
|
||||||
#define MAPGRID_ELEVATION_MASK 0xF000 // Bits 13-16
|
#define MAPGRID_ELEVATION_MASK 0xF000 // Bits 12-15
|
||||||
#define MAPGRID_COLLISION_SHIFT 10
|
#define MAPGRID_COLLISION_SHIFT 10
|
||||||
#define MAPGRID_ELEVATION_SHIFT 12
|
#define MAPGRID_ELEVATION_SHIFT 12
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@
|
||||||
// Masks/shifts for metatile attributes
|
// Masks/shifts for metatile attributes
|
||||||
// Metatile attributes consist of an 8 bit behavior value, 4 unused bits, and a 4 bit layer type value
|
// Metatile attributes consist of an 8 bit behavior value, 4 unused bits, and a 4 bit layer type value
|
||||||
// This is the data stored in each data/tilesets/*/*/metatile_attributes.bin file
|
// This is the data stored in each data/tilesets/*/*/metatile_attributes.bin file
|
||||||
#define METATILE_ATTR_BEHAVIOR_MASK 0x00FF // Bits 1-8
|
#define METATILE_ATTR_BEHAVIOR_MASK 0x00FF // Bits 0-7
|
||||||
#define METATILE_ATTR_LAYER_MASK 0xF000 // Bits 13-16
|
#define METATILE_ATTR_LAYER_MASK 0xF000 // Bits 12-15
|
||||||
#define METATILE_ATTR_LAYER_SHIFT 12
|
#define METATILE_ATTR_LAYER_SHIFT 12
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -87,13 +87,13 @@ void InitMapFromSavedGame(void)
|
||||||
|
|
||||||
void InitBattlePyramidMap(bool8 setPlayerPosition)
|
void InitBattlePyramidMap(bool8 setPlayerPosition)
|
||||||
{
|
{
|
||||||
CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData));
|
CpuFastFill16(MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData));
|
||||||
GenerateBattlePyramidFloorLayout(sBackupMapData, setPlayerPosition);
|
GenerateBattlePyramidFloorLayout(sBackupMapData, setPlayerPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitTrainerHillMap(void)
|
void InitTrainerHillMap(void)
|
||||||
{
|
{
|
||||||
CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData));
|
CpuFastFill16(MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData));
|
||||||
GenerateTrainerHillFloorLayout(sBackupMapData);
|
GenerateTrainerHillFloorLayout(sBackupMapData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -753,7 +753,7 @@ static int IsPosInConnectingMap(struct MapConnection *connection, int x, int y)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MapConnection *GetConnectionAtCoords(s16 x, s16 y)
|
struct MapConnection *GetMapConnectionAtPos(s16 x, s16 y)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
struct MapConnection *connection;
|
struct MapConnection *connection;
|
||||||
|
@ -860,12 +860,13 @@ static void CopyTilesetToVramUsingHeap(struct Tileset const *tileset, u16 numTil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FieldmapPaletteDummy(u16 offset, u16 size)
|
// Below two are dummied functions from FRLG, used to tint the overworld palettes for the Quest Log
|
||||||
|
static void ApplyGlobalTintToPaletteEntries(u16 offset, u16 size)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FieldmapUnkDummy(void)
|
static void ApplyGlobalTintToPaletteSlot(u8 slot, u8 count)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -880,17 +881,17 @@ void LoadTilesetPalette(struct Tileset const *tileset, u16 destOffset, u16 size)
|
||||||
{
|
{
|
||||||
LoadPalette(&black, destOffset, 2);
|
LoadPalette(&black, destOffset, 2);
|
||||||
LoadPalette(((u16 *)tileset->palettes) + 1, destOffset + 1, size - 2);
|
LoadPalette(((u16 *)tileset->palettes) + 1, destOffset + 1, size - 2);
|
||||||
FieldmapPaletteDummy(destOffset + 1, (size - 2) >> 1);
|
ApplyGlobalTintToPaletteEntries(destOffset + 1, (size - 2) >> 1);
|
||||||
}
|
}
|
||||||
else if (tileset->isSecondary == TRUE)
|
else if (tileset->isSecondary == TRUE)
|
||||||
{
|
{
|
||||||
LoadPalette(((u16 *)tileset->palettes) + (NUM_PALS_IN_PRIMARY * 16), destOffset, size);
|
LoadPalette(((u16 *)tileset->palettes) + (NUM_PALS_IN_PRIMARY * 16), destOffset, size);
|
||||||
FieldmapPaletteDummy(destOffset, size >> 1);
|
ApplyGlobalTintToPaletteEntries(destOffset, size >> 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LoadCompressedPalette((u32 *)tileset->palettes, destOffset, size);
|
LoadCompressedPalette((u32 *)tileset->palettes, destOffset, size);
|
||||||
FieldmapPaletteDummy(destOffset, size >> 1);
|
ApplyGlobalTintToPaletteEntries(destOffset, size >> 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -456,7 +456,7 @@ static void CheckForHiddenItemsInMapConnection(u8 taskId)
|
||||||
|| var2 > y
|
|| var2 > y
|
||||||
|| y >= height)
|
|| y >= height)
|
||||||
{
|
{
|
||||||
struct MapConnection *conn = GetConnectionAtCoords(x, y);
|
struct MapConnection *conn = GetMapConnectionAtPos(x, y);
|
||||||
if (conn && IsHiddenItemPresentInConnection(conn, x, y) == TRUE)
|
if (conn && IsHiddenItemPresentInConnection(conn, x, y) == TRUE)
|
||||||
SetDistanceOfClosestHiddenItem(taskId, x - playerX, y - playerY);
|
SetDistanceOfClosestHiddenItem(taskId, x - playerX, y - playerY);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2038,15 +2038,15 @@ bool8 ScrCmd_setmetatile(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
u16 x = VarGet(ScriptReadHalfword(ctx));
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
||||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||||
u16 tileId = VarGet(ScriptReadHalfword(ctx));
|
u16 metatileId = VarGet(ScriptReadHalfword(ctx));
|
||||||
u16 isImpassable = VarGet(ScriptReadHalfword(ctx));
|
bool16 isImpassable = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
x += MAP_OFFSET;
|
x += MAP_OFFSET;
|
||||||
y += MAP_OFFSET;
|
y += MAP_OFFSET;
|
||||||
if (!isImpassable)
|
if (!isImpassable)
|
||||||
MapGridSetMetatileIdAt(x, y, tileId);
|
MapGridSetMetatileIdAt(x, y, metatileId);
|
||||||
else
|
else
|
||||||
MapGridSetMetatileIdAt(x, y, tileId | MAPGRID_COLLISION_MASK);
|
MapGridSetMetatileIdAt(x, y, metatileId | MAPGRID_COLLISION_MASK);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue