summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rwxr-xr-xinclude/constants/metatile_behaviors.h9
-rw-r--r--include/event_object_movement.h18
-rw-r--r--include/field_player_avatar.h2
-rw-r--r--include/fieldmap.h4
-rw-r--r--include/global.fieldmap.h31
-rw-r--r--include/global.h2
-rw-r--r--include/metatile_behavior.h2
-rw-r--r--include/overworld.h8
8 files changed, 46 insertions, 30 deletions
diff --git a/include/constants/metatile_behaviors.h b/include/constants/metatile_behaviors.h
index 5f37713f3..86f35ce50 100755
--- a/include/constants/metatile_behaviors.h
+++ b/include/constants/metatile_behaviors.h
@@ -9,7 +9,7 @@
#define MB_UNUSED_05 0x05
#define MB_DEEP_SAND 0x06
#define MB_SHORT_GRASS 0x07
-#define MB_UNUSED_CAVE 0x08
+#define MB_CAVE 0x08
#define MB_LONG_GRASS_SOUTH_EDGE 0x09
#define MB_NO_RUNNING 0x0A
#define MB_INDOOR_ENCOUNTER 0x0B
@@ -179,8 +179,8 @@
#define MB_UNUSED_AF 0xAF
#define MB_SECRET_BASE_PC 0xB0
#define MB_SECRET_BASE_REGISTER_PC 0xB1
-#define MB_SECRET_BASE_UNUSED 0xB2
-#define MB_BLOCK_DECORATION 0xB3
+#define MB_SECRET_BASE_SCENERY 0xB2
+#define MB_SECRET_BASE_TRAINER_SPOT 0xB3
#define MB_SECRET_BASE_DECORATION 0xB4
#define MB_HOLDS_SMALL_DECORATION 0xB5
#define MB_UNUSED_B6 0xB6
@@ -241,6 +241,9 @@
#define MB_UNUSED_ED 0xED
#define MB_UNUSED_EE 0xEE
#define MB_UNUSED_EF 0xEF
+
+#define NUM_METATILE_BEHAVIORS 0xF0
+
#define MB_INVALID 0xFF
#endif // GUARD_METATILE_BEHAVIORS_H
diff --git a/include/event_object_movement.h b/include/event_object_movement.h
index bd8232027..d31802a67 100644
--- a/include/event_object_movement.h
+++ b/include/event_object_movement.h
@@ -98,7 +98,7 @@ void ObjectEventClearHeldMovementIfActive(struct ObjectEvent *);
void TrySpawnObjectEvents(s16, s16);
u8 CreateObjectGraphicsSprite(u16, void (*)(struct Sprite *), s16 x, s16 y, u8 subpriority);
u8 TrySpawnObjectEvent(u8, u8, u8);
-u8 SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 z);
+u8 SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 elevation);
u8 SpawnSpecialObjectEvent(struct ObjectEventTemplate *);
void SetSpritePosToMapCoords(s16, s16, s16 *, s16 *);
void CameraObjectReset1(void);
@@ -128,7 +128,7 @@ u8 GetCollisionAtCoords(struct ObjectEvent *, s16, s16, u32);
void MoveCoords(u8, s16 *, s16 *);
bool8 ObjectEventIsHeldMovementActive(struct ObjectEvent *);
u8 ObjectEventClearHeldMovementIfFinished(struct ObjectEvent *);
-u8 GetObjectEventIdByXYZ(u16 x, u16 y, u8 z);
+u8 GetObjectEventIdByPosition(u16 x, u16 y, u8 elevation);
void SetTrainerMovementType(struct ObjectEvent *objectEvent, u8 movementType);
u8 GetTrainerFacingDirectionMovementType(u8 direction);
const u8 *GetObjectEventScriptPointerByObjectEventId(u8 objectEventId);
@@ -162,17 +162,15 @@ u8 ObjectEventCheckHeldMovementStatus(struct ObjectEvent *objectEvent);
u8 ObjectEventGetHeldMovementActionId(struct ObjectEvent *objectEvent);
void TryOverrideTemplateCoordsForObjectEvent(const struct ObjectEvent *objectEvent, u8 movementType);
void OverrideTemplateCoordsForObjectEvent(const struct ObjectEvent *objectEvent);
-void ShiftStillObjectEventCoords(struct ObjectEvent *pObject);
-void ObjectEventMoveDestCoords(struct ObjectEvent *pObject, u32 unk_19, s16 *pInt, s16 *pInt1);
+void ShiftStillObjectEventCoords(struct ObjectEvent *objEvent);
+void ObjectEventMoveDestCoords(struct ObjectEvent *objEvent, u32 direction, s16 *x, s16 *y);
u8 AddCameraObject(u8 linkedSpriteId);
void UpdateObjectEventsForCameraUpdate(s16 x, s16 y);
u8 GetWalkSlowMovementAction(u32);
u8 GetJumpMovementAction(u32);
-bool8 AreZCoordsCompatible(u8, u8);
-u8 ZCoordToPriority(u8);
-void ObjectEventUpdateZCoord(struct ObjectEvent *pObject);
-void SetObjectSubpriorityByZCoord(u8, struct Sprite *, u8);
-bool8 IsZCoordMismatchAt(u8, s16, s16);
+u8 ElevationToPriority(u8);
+void ObjectEventUpdateElevation(struct ObjectEvent *objEvent);
+void SetObjectSubpriorityByElevation(u8, struct Sprite *, u8);
void UnfreezeObjectEvent(struct ObjectEvent *);
u8 FindLockedObjectEventIndex(struct ObjectEvent *);
void SetAndStartSpriteAnim(struct Sprite *, u8, u8);
@@ -413,7 +411,7 @@ u8 MovementType_Invisible_Step0(struct ObjectEvent *, struct Sprite *);
u8 MovementType_Invisible_Step1(struct ObjectEvent *, struct Sprite *);
u8 MovementType_Invisible_Step2(struct ObjectEvent *, struct Sprite *);
-u8 CreateVirtualObject(u8 graphicsId, u8 virtualObjId, s16 x, s16 y, u8 z, u8 direction);
+u8 CreateVirtualObject(u8 graphicsId, u8 virtualObjId, s16 x, s16 y, u8 elevation, u8 direction);
void TurnVirtualObject(u8 virtualObjId, u8 direction);
void SetVirtualObjectGraphics(u8 virtualObjId, u8 graphicsId);
void SetVirtualObjectInvisibility(u8 virtualObjId, bool32 invisible);
diff --git a/include/field_player_avatar.h b/include/field_player_avatar.h
index 823564f22..d382de08c 100644
--- a/include/field_player_avatar.h
+++ b/include/field_player_avatar.h
@@ -30,7 +30,7 @@ void PlayerSetAnimId(u8 a, u8 b);
bool8 IsPlayerCollidingWithFarawayIslandMew(u8 direction);
void PlayerOnBikeCollideWithFarawayIslandMew(u8 direction);
u8 CheckForObjectEventCollision(struct ObjectEvent *a, s16 b, s16 c, u8 d, u8 e);
-u8 PlayerGetZCoord(void);
+u8 PlayerGetElevation(void);
void SetPlayerAvatarTransitionFlags(u16 a);
void CancelPlayerForcedMovement(void);
void InitPlayerAvatar(s16 a, s16 b, u8 c, u8 d);
diff --git a/include/fieldmap.h b/include/fieldmap.h
index aabfce461..e7497f7bd 100644
--- a/include/fieldmap.h
+++ b/include/fieldmap.h
@@ -29,10 +29,10 @@ void GetCameraCoords(u16*, u16*);
bool8 MapGridIsImpassableAt(int, int);
int GetMapBorderIdAt(int x, int y);
bool32 CanCameraMoveInDirection(int direction);
-u16 GetBehaviorByMetatileId(u16 metatileId);
+u16 GetMetatileAttributesById(u16 metatileId);
void GetCameraFocusCoords(u16 *x, u16 *y);
u8 MapGridGetMetatileLayerTypeAt(int x, int y);
-u8 MapGridGetZCoordAt(int x, int y);
+u8 MapGridGetElevationAt(int x, int y);
bool8 CameraMove(int deltaX, int deltaY);
void SaveMapView(void);
void SetCameraFocusCoords(u16 x, u16 y);
diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h
index 33be942c8..21c354658 100644
--- a/include/global.fieldmap.h
+++ b/include/global.fieldmap.h
@@ -1,13 +1,30 @@
#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 1-10
+#define MAPGRID_COLLISION_MASK 0x0C00 // Bits 11-12
+#define MAPGRID_ELEVATION_MASK 0xF000 // Bits 13-16
+#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
+
+// Masks/shifts for metatile attributes
+// 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
+#define METATILE_ATTR_BEHAVIOR_MASK 0x00FF // Bits 1-8
+#define METATILE_ATTR_LAYER_MASK 0xF000 // Bits 13-16
+#define METATILE_ATTR_LAYER_SHIFT 12
+
+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)
diff --git a/include/global.h b/include/global.h
index 51ecbcbce..0122ecd5c 100644
--- a/include/global.h
+++ b/include/global.h
@@ -1022,7 +1022,7 @@ struct MapPosition
{
s16 x;
s16 y;
- s8 height;
+ s8 elevation;
};
#endif // GUARD_GLOBAL_H
diff --git a/include/metatile_behavior.h b/include/metatile_behavior.h
index 5895426cf..c2d0d23ee 100644
--- a/include/metatile_behavior.h
+++ b/include/metatile_behavior.h
@@ -57,7 +57,7 @@ bool8 MetatileBehavior_IsSecretBaseTree(u8);
bool8 MetatileBehavior_IsSecretBaseShrub(u8);
bool8 MetatileBehavior_IsSecretBasePC(u8);
bool8 MetatileBehavior_IsRecordMixingSecretBasePC(u8);
-bool8 MetatileBehavior_IsBlockDecoration(u8);
+bool8 MetatileBehavior_IsSecretBaseTrainerSpot(u8);
bool8 MetatileBehavior_IsSecretBaseImpassable(u8);
bool8 MetatileBehavior_IsSecretBaseDecorationBase(u8);
bool8 MetatileBehavior_IsSecretBasePoster(u8);
diff --git a/include/overworld.h b/include/overworld.h
index 04b61f7fd..b8794ea70 100644
--- a/include/overworld.h
+++ b/include/overworld.h
@@ -40,20 +40,18 @@ struct LinkPlayerObjectEvent
u8 movementMode;
};
-// Exported RAM declarations
extern struct WarpData gLastUsedWarp;
extern struct LinkPlayerObjectEvent gLinkPlayerObjectEvents[4];
-extern u16 *gBGTilemapBuffers1;
-extern u16 *gBGTilemapBuffers2;
-extern u16 *gBGTilemapBuffers3;
+extern u16 *gOverworldTilemapBuffer_Bg2;
+extern u16 *gOverworldTilemapBuffer_Bg1;
+extern u16 *gOverworldTilemapBuffer_Bg3;
extern u16 gHeldKeyCodeToSend;
extern void (*gFieldCallback)(void);
extern bool8 (*gFieldCallback2)(void);
extern u8 gLocalLinkPlayerId;
extern u8 gFieldLinkPlayerCount;
-// Exported ROM declarations
extern const struct UCoords32 gDirectionToVectors[];
void DoWhiteOut(void);