Merge pull request #545 from GriffinRichards/sync-fieldmap

Sync fieldmap
This commit is contained in:
GriffinR
2022-09-12 14:31:51 -04:00
committed by GitHub
16 changed files with 191 additions and 188 deletions
+3 -3
View File
@@ -28,14 +28,14 @@ u32 MapGridGetMetatileBehaviorAt(s16, s16);
u8 MapGridGetMetatileLayerTypeAt(s16 x, s16 y);
void MapGridSetMetatileIdAt(s32, s32, u16);
void MapGridSetMetatileEntryAt(s32, s32, u16);
u8 MapGridGetZCoordAt(s32 x, s32 y);
u8 MapGridGetElevationAt(s32 x, s32 y);
void GetCameraCoords(u16 *, u16 *);
bool8 MapGridIsImpassableAt(s32, s32);
bool8 MapGridGetCollisionAt(s32, s32);
s32 GetMapBorderIdAt(s32, s32);
bool32 CanCameraMoveInDirection(s32);
const struct MapHeader * GetMapHeaderFromConnection(struct MapConnection * connection);
struct MapConnection * GetMapConnectionAtPos(s16 x, s16 y);
void Fieldmap_ApplyGlobalTintToPaletteSlot(u8 slot, u8 count);
void ApplyGlobalTintToPaletteSlot(u8 slot, u8 count);
void SaveMapView(void);
u32 ExtractMetatileAttribute(u32 attributes, u8 attributeType);
u32 MapGridGetMetatileAttributeAt(s16 x, s16 y, u8 attributeType);
+18 -7
View File
@@ -1,13 +1,23 @@
#ifndef GUARD_GLOBAL_FIELDMAP_H
#define GUARD_GLOBAL_FIELDMAP_H
#define METATILE_BEHAVIOR_MASK 0x00FF
#define METATILE_COLLISION_MASK 0x0C00
#define METATILE_ID_MASK 0x03FF
#define METATILE_ID_UNDEFINED 0x03FF
#define METATILE_ELEVATION_SHIFT 12
#define METATILE_COLLISION_SHIFT 10
#define METATILE_ELEVATION_MASK 0xF000
// 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
// This is the data stored in each data/layouts/*/map.bin file
#define MAPGRID_METATILE_ID_MASK 0x03FF // Bits 0-9
#define MAPGRID_COLLISION_MASK 0x0C00 // Bits 10-11
#define MAPGRID_ELEVATION_MASK 0xF000 // Bits 12-15
#define MAPGRID_COLLISION_SHIFT 10
#define MAPGRID_ELEVATION_SHIFT 12
// An undefined map grid block has all metatile id bits set and nothing else
#define MAPGRID_UNDEFINED MAPGRID_METATILE_ID_MASK
enum {
METATILE_LAYER_TYPE_NORMAL, // Metatile uses middle and top bg layers
METATILE_LAYER_TYPE_COVERED, // Metatile uses bottom and middle bg layers
METATILE_LAYER_TYPE_SPLIT, // Metatile uses bottom and top bg layers
};
#define METATILE_ID(tileset, name) (METATILE_##tileset##_##name)
@@ -22,6 +32,7 @@ enum
METATILE_ATTRIBUTE_LAYER_TYPE,
METATILE_ATTRIBUTE_7,
METATILE_ATTRIBUTE_COUNT,
METATILE_ATTRIBUTES_ALL = 255 // Special id to get the full attributes value
};
enum