mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Merge pull request #1869 from GriffinRichards/const-map
Treat map data as const
This commit is contained in:
commit
8d67bebd51
@ -32,7 +32,7 @@ bool8 TryDoDiveWarp(struct MapPosition *position, u16 b);
|
||||
int SetCableClubWarp(void);
|
||||
u8 TrySetDiveWarp(void);
|
||||
const u8 *GetInteractedLinkPlayerScript(struct MapPosition *position, u8 metatileBehavior, u8 direction);
|
||||
u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position);
|
||||
const u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position);
|
||||
void ClearPoisonStepCounter(void);
|
||||
|
||||
#endif // GUARD_FIELDCONTROLAVATAR_H
|
||||
|
@ -48,8 +48,8 @@ void LoadSecondaryTilesetPalette(struct MapLayout const *mapLayout);
|
||||
void CopySecondaryTilesetToVramUsingHeap(struct MapLayout const *mapLayout);
|
||||
void CopyPrimaryTilesetToVram(const struct MapLayout *);
|
||||
void CopySecondaryTilesetToVram(const struct MapLayout *);
|
||||
struct MapHeader const *const GetMapHeaderFromConnection(struct MapConnection *connection);
|
||||
struct MapConnection *GetMapConnectionAtPos(s16 x, s16 y);
|
||||
const struct MapHeader *const GetMapHeaderFromConnection(const struct MapConnection *connection);
|
||||
const struct MapConnection *GetMapConnectionAtPos(s16 x, s16 y);
|
||||
void MapGridSetMetatileImpassabilityAt(int x, int y, bool32 impassable);
|
||||
|
||||
// field_region_map.c
|
||||
|
@ -50,10 +50,10 @@ struct MapLayout
|
||||
{
|
||||
/*0x00*/ s32 width;
|
||||
/*0x04*/ s32 height;
|
||||
/*0x08*/ u16 *border;
|
||||
/*0x0C*/ u16 *map;
|
||||
/*0x10*/ struct Tileset *primaryTileset;
|
||||
/*0x14*/ struct Tileset *secondaryTileset;
|
||||
/*0x08*/ const u16 *border;
|
||||
/*0x0C*/ const u16 *map;
|
||||
/*0x10*/ const struct Tileset *primaryTileset;
|
||||
/*0x14*/ const struct Tileset *secondaryTileset;
|
||||
};
|
||||
|
||||
struct BackupMapLayout
|
||||
@ -98,7 +98,7 @@ struct CoordEvent
|
||||
u8 elevation;
|
||||
u16 trigger;
|
||||
u16 index;
|
||||
u8 *script;
|
||||
const u8 *script;
|
||||
};
|
||||
|
||||
struct BgEvent
|
||||
@ -107,7 +107,7 @@ struct BgEvent
|
||||
u8 elevation;
|
||||
u8 kind; // The "kind" field determines how to access bgUnion union below.
|
||||
union {
|
||||
u8 *script;
|
||||
const u8 *script;
|
||||
struct {
|
||||
u16 item;
|
||||
u16 hiddenItemId;
|
||||
@ -122,10 +122,10 @@ struct MapEvents
|
||||
u8 warpCount;
|
||||
u8 coordEventCount;
|
||||
u8 bgEventCount;
|
||||
struct ObjectEventTemplate *objectEvents;
|
||||
struct WarpEvent *warps;
|
||||
struct CoordEvent *coordEvents;
|
||||
struct BgEvent *bgEvents;
|
||||
const struct ObjectEventTemplate *objectEvents;
|
||||
const struct WarpEvent *warps;
|
||||
const struct CoordEvent *coordEvents;
|
||||
const struct BgEvent *bgEvents;
|
||||
};
|
||||
|
||||
struct MapConnection
|
||||
@ -139,7 +139,7 @@ struct MapConnection
|
||||
struct MapConnections
|
||||
{
|
||||
s32 count;
|
||||
struct MapConnection *connections;
|
||||
const struct MapConnection *connections;
|
||||
};
|
||||
|
||||
struct MapHeader
|
||||
|
@ -131,9 +131,9 @@ static void SetObjectEventDynamicGraphicsId(struct ObjectEvent *);
|
||||
static void RemoveObjectEventInternal(struct ObjectEvent *);
|
||||
static u16 GetObjectEventFlagIdByObjectEventId(u8);
|
||||
static void UpdateObjectEventVisibility(struct ObjectEvent *, struct Sprite *);
|
||||
static void MakeSpriteTemplateFromObjectEventTemplate(struct ObjectEventTemplate *, struct SpriteTemplate *, const struct SubspriteTable **);
|
||||
static void MakeSpriteTemplateFromObjectEventTemplate(const struct ObjectEventTemplate *, struct SpriteTemplate *, const struct SubspriteTable **);
|
||||
static void GetObjectEventMovingCameraOffset(s16 *, s16 *);
|
||||
static struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8, u8, u8);
|
||||
static const struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8, u8, u8);
|
||||
static void LoadObjectEventPalette(u16);
|
||||
static void RemoveObjectEventIfOutsideView(struct ObjectEvent *);
|
||||
static void SpawnObjectEventOnReturnToField(u8, s16, s16);
|
||||
@ -147,7 +147,7 @@ static void SpriteCB_CameraObject(struct Sprite *);
|
||||
static void CameraObject_0(struct Sprite *);
|
||||
static void CameraObject_1(struct Sprite *);
|
||||
static void CameraObject_2(struct Sprite *);
|
||||
static struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8, struct ObjectEventTemplate *, u8);
|
||||
static const struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8, const struct ObjectEventTemplate *, u8);
|
||||
static void ClearObjectEventMovement(struct ObjectEvent *, struct Sprite *);
|
||||
static void ObjectEventSetSingleMovement(struct ObjectEvent *, struct Sprite *, u8);
|
||||
static void SetSpriteDataForNormalStep(struct Sprite *, u8, u8);
|
||||
@ -1267,7 +1267,7 @@ static u8 GetObjectEventIdByLocalId(u8 localId)
|
||||
return OBJECT_EVENTS_COUNT;
|
||||
}
|
||||
|
||||
static u8 InitObjectEventStateFromTemplate(struct ObjectEventTemplate *template, u8 mapNum, u8 mapGroup)
|
||||
static u8 InitObjectEventStateFromTemplate(const struct ObjectEventTemplate *template, u8 mapNum, u8 mapGroup)
|
||||
{
|
||||
struct ObjectEvent *objectEvent;
|
||||
u8 objectEventId;
|
||||
@ -1398,7 +1398,7 @@ void RemoveAllObjectEventsExceptPlayer(void)
|
||||
}
|
||||
}
|
||||
|
||||
static u8 TrySetupObjectEventSprite(struct ObjectEventTemplate *objectEventTemplate, struct SpriteTemplate *spriteTemplate, u8 mapNum, u8 mapGroup, s16 cameraX, s16 cameraY)
|
||||
static u8 TrySetupObjectEventSprite(const struct ObjectEventTemplate *objectEventTemplate, struct SpriteTemplate *spriteTemplate, u8 mapNum, u8 mapGroup, s16 cameraX, s16 cameraY)
|
||||
{
|
||||
u8 spriteId;
|
||||
u8 paletteSlot;
|
||||
@ -1458,7 +1458,7 @@ static u8 TrySetupObjectEventSprite(struct ObjectEventTemplate *objectEventTempl
|
||||
return objectEventId;
|
||||
}
|
||||
|
||||
static u8 TrySpawnObjectEventTemplate(struct ObjectEventTemplate *objectEventTemplate, u8 mapNum, u8 mapGroup, s16 cameraX, s16 cameraY)
|
||||
static u8 TrySpawnObjectEventTemplate(const struct ObjectEventTemplate *objectEventTemplate, u8 mapNum, u8 mapGroup, s16 cameraX, s16 cameraY)
|
||||
{
|
||||
u8 objectEventId;
|
||||
struct SpriteTemplate spriteTemplate;
|
||||
@ -1512,7 +1512,7 @@ u8 SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 l
|
||||
|
||||
u8 TrySpawnObjectEvent(u8 localId, u8 mapNum, u8 mapGroup)
|
||||
{
|
||||
struct ObjectEventTemplate *objectEventTemplate;
|
||||
const struct ObjectEventTemplate *objectEventTemplate;
|
||||
s16 cameraX, cameraY;
|
||||
|
||||
objectEventTemplate = GetObjectEventTemplateByLocalIdAndMap(localId, mapNum, mapGroup);
|
||||
@ -1542,7 +1542,7 @@ static void CopyObjectGraphicsInfoToSpriteTemplate_WithMovementType(u16 graphics
|
||||
CopyObjectGraphicsInfoToSpriteTemplate(graphicsId, sMovementTypeCallbacks[movementType], spriteTemplate, subspriteTables);
|
||||
}
|
||||
|
||||
static void MakeSpriteTemplateFromObjectEventTemplate(struct ObjectEventTemplate *objectEventTemplate, struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables)
|
||||
static void MakeSpriteTemplateFromObjectEventTemplate(const struct ObjectEventTemplate *objectEventTemplate, struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables)
|
||||
{
|
||||
CopyObjectGraphicsInfoToSpriteTemplate_WithMovementType(objectEventTemplate->graphicsId, objectEventTemplate->movementType, spriteTemplate, subspriteTables);
|
||||
}
|
||||
@ -2374,7 +2374,7 @@ const u8 *GetObjectEventScriptPointerByObjectEventId(u8 objectEventId)
|
||||
|
||||
static u16 GetObjectEventFlagIdByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
|
||||
{
|
||||
struct ObjectEventTemplate *obj = GetObjectEventTemplateByLocalIdAndMap(localId, mapNum, mapGroup);
|
||||
const struct ObjectEventTemplate *obj = GetObjectEventTemplateByLocalIdAndMap(localId, mapNum, mapGroup);
|
||||
#ifdef UBFIX
|
||||
// BUG: The function may return NULL, and attempting to read from NULL may freeze the game using modern compilers.
|
||||
if (obj == NULL)
|
||||
@ -2421,9 +2421,9 @@ u8 GetObjectEventBerryTreeId(u8 objectEventId)
|
||||
return gObjectEvents[objectEventId].trainerRange_berryTreeId;
|
||||
}
|
||||
|
||||
static struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
|
||||
static const struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
|
||||
{
|
||||
struct ObjectEventTemplate *templates;
|
||||
const struct ObjectEventTemplate *templates;
|
||||
const struct MapHeader *mapHeader;
|
||||
u8 count;
|
||||
|
||||
@ -2441,7 +2441,7 @@ static struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8 loca
|
||||
return FindObjectEventTemplateByLocalId(localId, templates, count);
|
||||
}
|
||||
|
||||
static struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8 localId, struct ObjectEventTemplate *templates, u8 count)
|
||||
static const struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8 localId, const struct ObjectEventTemplate *templates, u8 count)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
|
@ -60,8 +60,8 @@ static s8 GetWarpEventAtMapPosition(struct MapHeader *, struct MapPosition *);
|
||||
static void SetupWarp(struct MapHeader *, s8, struct MapPosition *);
|
||||
static bool8 TryDoorWarp(struct MapPosition *, u16, u8);
|
||||
static s8 GetWarpEventAtPosition(struct MapHeader *, u16, u16, u8);
|
||||
static u8 *GetCoordEventScriptAtPosition(struct MapHeader *, u16, u16, u8);
|
||||
static struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *, u16, u16, u8);
|
||||
static const u8 *GetCoordEventScriptAtPosition(struct MapHeader *, u16, u16, u8);
|
||||
static const struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *, u16, u16, u8);
|
||||
static bool8 TryStartCoordEventScript(struct MapPosition *);
|
||||
static bool8 TryStartWarpEventScript(struct MapPosition *, u16);
|
||||
static bool8 TryStartMiscWalkingScripts(u16);
|
||||
@ -315,7 +315,7 @@ static const u8 *GetInteractedObjectEventScript(struct MapPosition *position, u8
|
||||
|
||||
static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position, u8 metatileBehavior, u8 direction)
|
||||
{
|
||||
struct BgEvent *bgEvent = GetBackgroundEventAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
|
||||
const struct BgEvent *bgEvent = GetBackgroundEventAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
|
||||
|
||||
if (bgEvent == NULL)
|
||||
return NULL;
|
||||
@ -497,7 +497,7 @@ static bool8 TryStartStepBasedScript(struct MapPosition *position, u16 metatileB
|
||||
|
||||
static bool8 TryStartCoordEventScript(struct MapPosition *position)
|
||||
{
|
||||
u8 *script = GetCoordEventScriptAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
|
||||
const u8 *script = GetCoordEventScriptAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
|
||||
|
||||
if (script == NULL)
|
||||
return FALSE;
|
||||
@ -861,7 +861,7 @@ static bool8 TryDoorWarp(struct MapPosition *position, u16 metatileBehavior, u8
|
||||
static s8 GetWarpEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
|
||||
{
|
||||
s32 i;
|
||||
struct WarpEvent *warpEvent = mapHeader->events->warps;
|
||||
const struct WarpEvent *warpEvent = mapHeader->events->warps;
|
||||
u8 warpCount = mapHeader->events->warpCount;
|
||||
|
||||
for (i = 0; i < warpCount; i++, warpEvent++)
|
||||
@ -875,7 +875,7 @@ static s8 GetWarpEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 e
|
||||
return WARP_ID_NONE;
|
||||
}
|
||||
|
||||
static u8 *TryRunCoordEventScript(struct CoordEvent *coordEvent)
|
||||
static const u8 *TryRunCoordEventScript(const struct CoordEvent *coordEvent)
|
||||
{
|
||||
if (coordEvent != NULL)
|
||||
{
|
||||
@ -895,10 +895,10 @@ static u8 *TryRunCoordEventScript(struct CoordEvent *coordEvent)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static u8 *GetCoordEventScriptAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
|
||||
static const u8 *GetCoordEventScriptAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
|
||||
{
|
||||
s32 i;
|
||||
struct CoordEvent *coordEvents = mapHeader->events->coordEvents;
|
||||
const struct CoordEvent *coordEvents = mapHeader->events->coordEvents;
|
||||
u8 coordEventCount = mapHeader->events->coordEventCount;
|
||||
|
||||
for (i = 0; i < coordEventCount; i++)
|
||||
@ -907,7 +907,7 @@ static u8 *GetCoordEventScriptAtPosition(struct MapHeader *mapHeader, u16 x, u16
|
||||
{
|
||||
if (coordEvents[i].elevation == elevation || coordEvents[i].elevation == 0)
|
||||
{
|
||||
u8 *script = TryRunCoordEventScript(&coordEvents[i]);
|
||||
const u8 *script = TryRunCoordEventScript(&coordEvents[i]);
|
||||
if (script != NULL)
|
||||
return script;
|
||||
}
|
||||
@ -916,15 +916,15 @@ static u8 *GetCoordEventScriptAtPosition(struct MapHeader *mapHeader, u16 x, u16
|
||||
return NULL;
|
||||
}
|
||||
|
||||
u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position)
|
||||
const u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position)
|
||||
{
|
||||
return GetCoordEventScriptAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
|
||||
}
|
||||
|
||||
static struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
|
||||
static const struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
|
||||
{
|
||||
u8 i;
|
||||
struct BgEvent *bgEvents = mapHeader->events->bgEvents;
|
||||
const struct BgEvent *bgEvents = mapHeader->events->bgEvents;
|
||||
u8 bgEventCount = mapHeader->events->bgEventCount;
|
||||
|
||||
for (i = 0; i < bgEventCount; i++)
|
||||
|
@ -36,7 +36,7 @@ struct BackupMapLayout gBackupMapLayout;
|
||||
static const struct ConnectionFlags sDummyConnectionFlags = {0};
|
||||
|
||||
static void InitMapLayoutData(struct MapHeader *mapHeader);
|
||||
static void InitBackupMapLayoutData(u16 *map, u16 width, u16 height);
|
||||
static void InitBackupMapLayoutData(const u16 *map, u16 width, u16 height);
|
||||
static void FillSouthConnection(struct MapHeader const *mapHeader, struct MapHeader const *connectedMapHeader, s32 offset);
|
||||
static void FillNorthConnection(struct MapHeader const *mapHeader, struct MapHeader const *connectedMapHeader, s32 offset);
|
||||
static void FillWestConnection(struct MapHeader const *mapHeader, struct MapHeader const *connectedMapHeader, s32 offset);
|
||||
@ -44,14 +44,14 @@ static void FillEastConnection(struct MapHeader const *mapHeader, struct MapHead
|
||||
static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader);
|
||||
static void LoadSavedMapView(void);
|
||||
static bool8 SkipCopyingMetatileFromSavedMap(u16 *mapBlock, u16 mapWidth, u8 yMode);
|
||||
static struct MapConnection *GetIncomingConnection(u8 direction, int x, int y);
|
||||
static bool8 IsPosInIncomingConnectingMap(u8 direction, int x, int y, struct MapConnection *connection);
|
||||
static const struct MapConnection *GetIncomingConnection(u8 direction, int x, int y);
|
||||
static bool8 IsPosInIncomingConnectingMap(u8 direction, int x, int y, const struct MapConnection *connection);
|
||||
static bool8 IsCoordInIncomingConnectingMap(int coord, int srcMax, int destMax, int offset);
|
||||
|
||||
#define GetBorderBlockAt(x, y)({ \
|
||||
u16 block; \
|
||||
int i; \
|
||||
u16 *border = gMapHeader.mapLayout->border; \
|
||||
const u16 *border = gMapHeader.mapLayout->border; /* Unused, they read it again below */ \
|
||||
\
|
||||
i = (x + 1) & 1; \
|
||||
i += ((y + 1) & 1) * 2; \
|
||||
@ -63,7 +63,7 @@ static bool8 IsCoordInIncomingConnectingMap(int coord, int srcMax, int destMax,
|
||||
|
||||
#define GetMapGridBlockAt(x, y) (AreCoordsWithinMapGridBounds(x, y) ? gBackupMapLayout.map[x + gBackupMapLayout.width * y] : GetBorderBlockAt(x, y))
|
||||
|
||||
struct MapHeader const *const GetMapHeaderFromConnection(struct MapConnection *connection)
|
||||
const struct MapHeader *const GetMapHeaderFromConnection(const struct MapConnection *connection)
|
||||
{
|
||||
return Overworld_GetMapHeaderByGroupAndId(connection->mapGroup, connection->mapNum);
|
||||
}
|
||||
@ -116,7 +116,7 @@ static void InitMapLayoutData(struct MapHeader *mapHeader)
|
||||
}
|
||||
}
|
||||
|
||||
static void InitBackupMapLayoutData(u16 *map, u16 width, u16 height)
|
||||
static void InitBackupMapLayoutData(const u16 *map, u16 width, u16 height)
|
||||
{
|
||||
u16 *dest;
|
||||
int y;
|
||||
@ -133,7 +133,7 @@ static void InitBackupMapLayoutData(u16 *map, u16 width, u16 height)
|
||||
static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader)
|
||||
{
|
||||
int count;
|
||||
struct MapConnection *connection;
|
||||
const struct MapConnection *connection;
|
||||
int i;
|
||||
|
||||
if (mapHeader->connections)
|
||||
@ -171,7 +171,7 @@ static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader)
|
||||
static void FillConnection(int x, int y, struct MapHeader const *connectedMapHeader, int x2, int y2, int width, int height)
|
||||
{
|
||||
int i;
|
||||
u16 *src;
|
||||
const u16 *src;
|
||||
u16 *dest;
|
||||
int mapWidth;
|
||||
|
||||
@ -619,7 +619,7 @@ bool32 CanCameraMoveInDirection(int direction)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void SetPositionFromConnection(struct MapConnection *connection, int direction, int x, int y)
|
||||
static void SetPositionFromConnection(const struct MapConnection *connection, int direction, int x, int y)
|
||||
{
|
||||
struct MapHeader const *mapHeader;
|
||||
mapHeader = GetMapHeaderFromConnection(connection);
|
||||
@ -647,7 +647,7 @@ static void SetPositionFromConnection(struct MapConnection *connection, int dire
|
||||
bool8 CameraMove(int x, int y)
|
||||
{
|
||||
int direction;
|
||||
struct MapConnection *connection;
|
||||
const struct MapConnection *connection;
|
||||
int old_x, old_y;
|
||||
gCamera.active = FALSE;
|
||||
direction = GetPostCameraMoveMapBorderId(x, y);
|
||||
@ -675,11 +675,11 @@ bool8 CameraMove(int x, int y)
|
||||
return gCamera.active;
|
||||
}
|
||||
|
||||
static struct MapConnection *GetIncomingConnection(u8 direction, int x, int y)
|
||||
static const struct MapConnection *GetIncomingConnection(u8 direction, int x, int y)
|
||||
{
|
||||
int count;
|
||||
int i;
|
||||
struct MapConnection *connection;
|
||||
const struct MapConnection *connection;
|
||||
const struct MapConnections *connections = gMapHeader.connections;
|
||||
|
||||
#ifdef UBFIX // UB: Multiple possible null dereferences
|
||||
@ -696,7 +696,7 @@ static struct MapConnection *GetIncomingConnection(u8 direction, int x, int y)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool8 IsPosInIncomingConnectingMap(u8 direction, int x, int y, struct MapConnection *connection)
|
||||
static bool8 IsPosInIncomingConnectingMap(u8 direction, int x, int y, const struct MapConnection *connection)
|
||||
{
|
||||
struct MapHeader const *mapHeader;
|
||||
mapHeader = GetMapHeaderFromConnection(connection);
|
||||
@ -737,7 +737,7 @@ static int IsCoordInConnectingMap(int coord, int max)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int IsPosInConnectingMap(struct MapConnection *connection, int x, int y)
|
||||
static int IsPosInConnectingMap(const struct MapConnection *connection, int x, int y)
|
||||
{
|
||||
struct MapHeader const *mapHeader;
|
||||
mapHeader = GetMapHeaderFromConnection(connection);
|
||||
@ -753,10 +753,10 @@ static int IsPosInConnectingMap(struct MapConnection *connection, int x, int y)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
struct MapConnection *GetMapConnectionAtPos(s16 x, s16 y)
|
||||
const struct MapConnection *GetMapConnectionAtPos(s16 x, s16 y)
|
||||
{
|
||||
int count;
|
||||
struct MapConnection *connection;
|
||||
const struct MapConnection *connection;
|
||||
int i;
|
||||
u8 direction;
|
||||
if (!gMapHeader.connections)
|
||||
|
@ -375,7 +375,7 @@ static bool8 ItemfinderCheckForHiddenItems(const struct MapEvents *events, u8 ta
|
||||
static bool8 IsHiddenItemPresentAtCoords(const struct MapEvents *events, s16 x, s16 y)
|
||||
{
|
||||
u8 bgEventCount = events->bgEventCount;
|
||||
struct BgEvent *bgEvent = events->bgEvents;
|
||||
const struct BgEvent *bgEvent = events->bgEvents;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < bgEventCount; i++)
|
||||
@ -391,7 +391,7 @@ static bool8 IsHiddenItemPresentAtCoords(const struct MapEvents *events, s16 x,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool8 IsHiddenItemPresentInConnection(struct MapConnection *connection, int x, int y)
|
||||
static bool8 IsHiddenItemPresentInConnection(const struct MapConnection *connection, int x, int y)
|
||||
{
|
||||
|
||||
u16 localX, localY;
|
||||
@ -456,7 +456,7 @@ static void CheckForHiddenItemsInMapConnection(u8 taskId)
|
||||
|| var2 > y
|
||||
|| y >= height)
|
||||
{
|
||||
struct MapConnection *conn = GetMapConnectionAtPos(x, y);
|
||||
const struct MapConnection *conn = GetMapConnectionAtPos(x, y);
|
||||
if (conn && IsHiddenItemPresentInConnection(conn, x, y) == TRUE)
|
||||
SetDistanceOfClosestHiddenItem(taskId, x - playerX, y - playerY);
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ static void InitMenuBasedScript(const u8 *);
|
||||
static void LoadCableClubPlayer(s32, s32, struct CableClubPlayer *);
|
||||
static bool32 IsCableClubPlayerUnfrozen(struct CableClubPlayer *);
|
||||
static bool32 CanCableClubPlayerPressStart(struct CableClubPlayer *);
|
||||
static u8 *TryGetTileEventScript(struct CableClubPlayer *);
|
||||
static const u8 *TryGetTileEventScript(struct CableClubPlayer *);
|
||||
static bool32 PlayerIsAtSouthExit(struct CableClubPlayer *);
|
||||
static const u8 *TryInteractWithPlayer(struct CableClubPlayer *);
|
||||
static u16 KeyInterCB_DeferToRecvQueue(u32);
|
||||
@ -482,7 +482,7 @@ void LoadObjEventTemplatesFromHeader(void)
|
||||
|
||||
void LoadSaveblockObjEventScripts(void)
|
||||
{
|
||||
struct ObjectEventTemplate *mapHeaderObjTemplates = gMapHeader.events->objectEvents;
|
||||
const struct ObjectEventTemplate *mapHeaderObjTemplates = gMapHeader.events->objectEvents;
|
||||
struct ObjectEventTemplate *savObjTemplates = gSaveBlock1Ptr->objectEventTemplates;
|
||||
s32 i;
|
||||
|
||||
@ -2714,7 +2714,7 @@ static bool32 CanCableClubPlayerPressStart(struct CableClubPlayer *player)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static u8 *TryGetTileEventScript(struct CableClubPlayer *player)
|
||||
static const u8 *TryGetTileEventScript(struct CableClubPlayer *player)
|
||||
{
|
||||
if (player->movementMode != MOVEMENT_MODE_SCRIPTED)
|
||||
return FACING_NONE;
|
||||
|
@ -685,7 +685,8 @@ static u16 GetMetatileForFloor(u8 floorId, u32 x, u32 y, u32 floorWidth) // floo
|
||||
void GenerateTrainerHillFloorLayout(u16 *mapArg)
|
||||
{
|
||||
s32 y, x;
|
||||
u16 *src, *dst;
|
||||
const u16 *src;
|
||||
u16 *dst;
|
||||
u8 mapId = GetCurrentTrainerHillMapId();
|
||||
|
||||
if (mapId == TRAINER_HILL_ENTRANCE)
|
||||
|
Loading…
Reference in New Issue
Block a user