mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-13 15:13:42 +01:00
Merge pull request #1608 from GriffinRichards/fix-fieldmap
Fix some incorrect fieldmap names
This commit is contained in:
commit
2efbd5f549
@ -1,6 +1,6 @@
|
||||
gBGTilemapBuffers1
|
||||
gBGTilemapBuffers2
|
||||
gBGTilemapBuffers3
|
||||
gOverworldTilemapBuffer_Bg2
|
||||
gOverworldTilemapBuffer_Bg1
|
||||
gOverworldTilemapBuffer_Bg3
|
||||
gHeldKeyCodeToSend
|
||||
gFieldCallback
|
||||
gFieldCallback2
|
||||
|
@ -1053,7 +1053,7 @@ void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 widt
|
||||
for (x16 = x; x16 < (x + width); x16++)
|
||||
{
|
||||
CopyTileMapEntry(&firstTileNum, &((u16*)sGpuBgConfigs2[bg].tilemap)[(u16)GetTileMapIndexFromCoords(x16, y16, attribute, mode, mode2)], paletteSlot, 0, 0);
|
||||
firstTileNum = (firstTileNum & (METATILE_COLLISION_MASK | METATILE_ELEVATION_MASK)) + ((firstTileNum + tileNumDelta) & METATILE_ID_MASK);
|
||||
firstTileNum = (firstTileNum & (MAPGRID_COLLISION_MASK | MAPGRID_ELEVATION_MASK)) + ((firstTileNum + tileNumDelta) & MAPGRID_METATILE_ID_MASK);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1064,7 +1064,7 @@ void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 widt
|
||||
for (x16 = x; x16 < (x + width); x16++)
|
||||
{
|
||||
((u8*)sGpuBgConfigs2[bg].tilemap)[(y16 * mode3) + x16] = firstTileNum;
|
||||
firstTileNum = (firstTileNum & (METATILE_COLLISION_MASK | METATILE_ELEVATION_MASK)) + ((firstTileNum + tileNumDelta) & METATILE_ID_MASK);
|
||||
firstTileNum = (firstTileNum & (MAPGRID_COLLISION_MASK | MAPGRID_ELEVATION_MASK)) + ((firstTileNum + tileNumDelta) & MAPGRID_METATILE_ID_MASK);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
||||
|
@ -1022,7 +1022,7 @@ struct MapPosition
|
||||
{
|
||||
s16 x;
|
||||
s16 y;
|
||||
s8 height;
|
||||
s8 elevation;
|
||||
};
|
||||
|
||||
#endif // GUARD_GLOBAL_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);
|
||||
|
@ -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);
|
||||
|
@ -1239,7 +1239,7 @@ static u8 GetPostBattleDirectionHintTextIndex(int *hintType, u8 minDistanceForEx
|
||||
{
|
||||
for (x = 0; x < 32; x++)
|
||||
{
|
||||
if ((map[x] & METATILE_ID_MASK) == METATILE_BattlePyramid_Exit)
|
||||
if ((map[x] & MAPGRID_METATILE_ID_MASK) == METATILE_BattlePyramid_Exit)
|
||||
{
|
||||
x += MAP_OFFSET - gObjectEvents[gSelectedObjectEvent].initialCoords.x;
|
||||
y += MAP_OFFSET - gObjectEvents[gSelectedObjectEvent].initialCoords.y;
|
||||
@ -1545,7 +1545,7 @@ void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPositio
|
||||
{
|
||||
for (x = 0; x < mapLayout->width; x++)
|
||||
{
|
||||
if ((layoutMap[x] & METATILE_ID_MASK) != METATILE_BattlePyramid_Exit)
|
||||
if ((layoutMap[x] & MAPGRID_METATILE_ID_MASK) != METATILE_BattlePyramid_Exit)
|
||||
{
|
||||
map[x] = layoutMap[x];
|
||||
}
|
||||
@ -1556,7 +1556,7 @@ void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPositio
|
||||
gSaveBlock1Ptr->pos.x = (mapLayout->width * (i % 4)) + x;
|
||||
gSaveBlock1Ptr->pos.y = (mapLayout->height * (i / 4)) + y;
|
||||
}
|
||||
map[x] = (layoutMap[x] & (METATILE_ELEVATION_MASK | METATILE_COLLISION_MASK)) | METATILE_BattlePyramid_Floor;
|
||||
map[x] = (layoutMap[x] & (MAPGRID_ELEVATION_MASK | MAPGRID_COLLISION_MASK)) | METATILE_BattlePyramid_Floor;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -900,7 +900,7 @@ static bool8 IsRunningDisallowedByMetatile(u8 tile)
|
||||
{
|
||||
if (MetatileBehavior_IsRunningDisallowed(tile))
|
||||
return TRUE;
|
||||
if (MetatileBehavior_IsFortreeBridge(tile) && (PlayerGetZCoord() & 1) == 0)
|
||||
if (MetatileBehavior_IsFortreeBridge(tile) && (PlayerGetElevation() & 1) == 0)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -80,9 +80,9 @@ void DoBrailleDigEffect(void)
|
||||
MapGridSetMetatileIdAt( 9 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopLeft);
|
||||
MapGridSetMetatileIdAt(10 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopMid);
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopRight);
|
||||
MapGridSetMetatileIdAt( 9 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomLeft | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt( 9 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomLeft | MAPGRID_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(10 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomMid);
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomRight | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomRight | MAPGRID_COLLISION_MASK);
|
||||
DrawWholeMapView();
|
||||
PlaySE(SE_BANG);
|
||||
FlagSet(FLAG_SYS_BRAILLE_DIG);
|
||||
@ -207,9 +207,9 @@ static void DoBrailleRegirockEffect(void)
|
||||
MapGridSetMetatileIdAt(7 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopLeft);
|
||||
MapGridSetMetatileIdAt(8 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopMid);
|
||||
MapGridSetMetatileIdAt(9 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopRight);
|
||||
MapGridSetMetatileIdAt(7 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomLeft | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(7 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomLeft | MAPGRID_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(8 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomMid);
|
||||
MapGridSetMetatileIdAt(9 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomRight | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(9 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomRight | MAPGRID_COLLISION_MASK);
|
||||
DrawWholeMapView();
|
||||
PlaySE(SE_BANG);
|
||||
FlagSet(FLAG_SYS_REGIROCK_PUZZLE_COMPLETED);
|
||||
@ -246,9 +246,9 @@ static void DoBrailleRegisteelEffect(void)
|
||||
MapGridSetMetatileIdAt(7 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopLeft);
|
||||
MapGridSetMetatileIdAt(8 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopMid);
|
||||
MapGridSetMetatileIdAt(9 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopRight);
|
||||
MapGridSetMetatileIdAt(7 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomLeft | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(7 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomLeft | MAPGRID_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(8 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomMid);
|
||||
MapGridSetMetatileIdAt(9 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomRight | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(9 + MAP_OFFSET, 20 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_BottomRight | MAPGRID_COLLISION_MASK);
|
||||
DrawWholeMapView();
|
||||
PlaySE(SE_BANG);
|
||||
FlagSet(FLAG_SYS_REGISTEEL_PUZZLE_COMPLETED);
|
||||
|
@ -1185,10 +1185,10 @@ static u16 GetDecorationElevation(u8 decoration, u8 tileIndex)
|
||||
switch (decoration)
|
||||
{
|
||||
case DECOR_STAND:
|
||||
elevation = sDecorationStandElevations[tileIndex] << METATILE_ELEVATION_SHIFT;
|
||||
elevation = sDecorationStandElevations[tileIndex] << MAPGRID_ELEVATION_SHIFT;
|
||||
return elevation;
|
||||
case DECOR_SLIDE:
|
||||
elevation = sDecorationSlideElevation[tileIndex] << METATILE_ELEVATION_SHIFT;
|
||||
elevation = sDecorationSlideElevation[tileIndex] << MAPGRID_ELEVATION_SHIFT;
|
||||
return elevation;
|
||||
default:
|
||||
return elevation;
|
||||
@ -1199,7 +1199,7 @@ static void ShowDecorationOnMap_(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight,
|
||||
{
|
||||
u16 i, j;
|
||||
s16 x, y;
|
||||
u16 behavior;
|
||||
u16 attributes;
|
||||
u16 impassableFlag;
|
||||
u16 overlapsWall;
|
||||
u16 elevation;
|
||||
@ -1210,9 +1210,10 @@ static void ShowDecorationOnMap_(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight,
|
||||
for (i = 0; i < decWidth; i++)
|
||||
{
|
||||
x = mapX + i;
|
||||
behavior = GetBehaviorByMetatileId(NUM_TILES_IN_PRIMARY + gDecorations[decoration].tiles[j * decWidth + i]);
|
||||
if (MetatileBehavior_IsSecretBaseImpassable(behavior) == TRUE || (gDecorations[decoration].permission != DECORPERM_PASS_FLOOR && (behavior >> METATILE_ELEVATION_SHIFT)))
|
||||
impassableFlag = METATILE_COLLISION_MASK;
|
||||
attributes = GetMetatileAttributesById(NUM_TILES_IN_PRIMARY + gDecorations[decoration].tiles[j * decWidth + i]);
|
||||
if (MetatileBehavior_IsSecretBaseImpassable(attributes & METATILE_ATTR_BEHAVIOR_MASK) == TRUE
|
||||
|| (gDecorations[decoration].permission != DECORPERM_PASS_FLOOR && (attributes >> METATILE_ATTR_LAYER_SHIFT) != METATILE_LAYER_TYPE_NORMAL))
|
||||
impassableFlag = MAPGRID_COLLISION_MASK;
|
||||
else
|
||||
impassableFlag = 0;
|
||||
|
||||
@ -1471,24 +1472,26 @@ static void AttemptCancelPlaceDecoration(u8 taskId)
|
||||
DisplayItemMessageOnField(taskId, gStringVar4, CancelDecoratingPrompt);
|
||||
}
|
||||
|
||||
// Note: behaviorBy is pre-anded with METATILE_ELEVATION_MASK.
|
||||
static bool8 IsNonBlockNonElevated(u8 behaviorAt, u16 behaviorBy)
|
||||
static bool8 IsSecretBaseTrainerSpot(u8 behaviorAt, u16 layerType)
|
||||
{
|
||||
if (MetatileBehavior_IsBlockDecoration(behaviorAt) != TRUE || behaviorBy != 0)
|
||||
if (!(MetatileBehavior_IsSecretBaseTrainerSpot(behaviorAt) == TRUE && layerType == METATILE_LAYER_TYPE_NORMAL))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 IsntInitialPosition(u8 taskId, s16 x, s16 y, u16 behaviorBy)
|
||||
// Can't place decoration where the player was standing when they interacted with the PC
|
||||
static bool8 IsntInitialPosition(u8 taskId, s16 x, s16 y, u16 layerType)
|
||||
{
|
||||
if (x == gTasks[taskId].tInitialX + MAP_OFFSET && y == gTasks[taskId].tInitialY + MAP_OFFSET && behaviorBy != 0)
|
||||
if (x == gTasks[taskId].tInitialX + MAP_OFFSET
|
||||
&& y == gTasks[taskId].tInitialY + MAP_OFFSET
|
||||
&& layerType != METATILE_LAYER_TYPE_NORMAL)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 IsFloorOrBoardAndHole(u16 behaviorAt, const struct Decoration *decoration)
|
||||
{
|
||||
if (MetatileBehavior_IsBlockDecoration(behaviorAt) != TRUE)
|
||||
if (MetatileBehavior_IsSecretBaseTrainerSpot(behaviorAt) != TRUE)
|
||||
{
|
||||
if (decoration->id == DECOR_SOLID_BOARD && MetatileBehavior_IsSecretBaseHole(behaviorAt) == TRUE)
|
||||
return TRUE;
|
||||
@ -1505,7 +1508,7 @@ static bool8 CanPlaceDecoration(u8 taskId, const struct Decoration *decoration)
|
||||
u8 i;
|
||||
u8 j;
|
||||
u8 behaviorAt;
|
||||
u16 behaviorBy;
|
||||
u16 layerType;
|
||||
u8 mapY;
|
||||
u8 mapX;
|
||||
s16 curY;
|
||||
@ -1524,14 +1527,14 @@ static bool8 CanPlaceDecoration(u8 taskId, const struct Decoration *decoration)
|
||||
{
|
||||
curX = gTasks[taskId].tCursorX + j;
|
||||
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
|
||||
behaviorBy = GetBehaviorByMetatileId(NUM_TILES_IN_PRIMARY + decoration->tiles[(mapY - 1 - i) * mapX + j]) & METATILE_ELEVATION_MASK;
|
||||
layerType = GetMetatileAttributesById(NUM_TILES_IN_PRIMARY + decoration->tiles[(mapY - 1 - i) * mapX + j]) & METATILE_ATTR_LAYER_MASK;
|
||||
if (!IsFloorOrBoardAndHole(behaviorAt, decoration))
|
||||
return FALSE;
|
||||
|
||||
if (!IsntInitialPosition(taskId, curX, curY, behaviorBy))
|
||||
if (!IsntInitialPosition(taskId, curX, curY, layerType))
|
||||
return FALSE;
|
||||
|
||||
behaviorAt = GetObjectEventIdByXYZ(curX, curY, 0);
|
||||
behaviorAt = GetObjectEventIdByPosition(curX, curY, 0);
|
||||
if (behaviorAt != 0 && behaviorAt != OBJECT_EVENTS_COUNT)
|
||||
return FALSE;
|
||||
}
|
||||
@ -1545,14 +1548,14 @@ static bool8 CanPlaceDecoration(u8 taskId, const struct Decoration *decoration)
|
||||
{
|
||||
curX = gTasks[taskId].tCursorX + j;
|
||||
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
|
||||
behaviorBy = GetBehaviorByMetatileId(NUM_TILES_IN_PRIMARY + decoration->tiles[(mapY - 1 - i) * mapX + j]) & METATILE_ELEVATION_MASK;
|
||||
if (!MetatileBehavior_IsNormal(behaviorAt) && !IsNonBlockNonElevated(behaviorAt, behaviorBy))
|
||||
layerType = GetMetatileAttributesById(NUM_TILES_IN_PRIMARY + decoration->tiles[(mapY - 1 - i) * mapX + j]) & METATILE_ATTR_LAYER_MASK;
|
||||
if (!MetatileBehavior_IsNormal(behaviorAt) && !IsSecretBaseTrainerSpot(behaviorAt, layerType))
|
||||
return FALSE;
|
||||
|
||||
if (!IsntInitialPosition(taskId, curX, curY, behaviorBy))
|
||||
if (!IsntInitialPosition(taskId, curX, curY, layerType))
|
||||
return FALSE;
|
||||
|
||||
if (GetObjectEventIdByXYZ(curX, curY, 0) != OBJECT_EVENTS_COUNT)
|
||||
if (GetObjectEventIdByPosition(curX, curY, 0) != OBJECT_EVENTS_COUNT)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -1562,14 +1565,14 @@ static bool8 CanPlaceDecoration(u8 taskId, const struct Decoration *decoration)
|
||||
{
|
||||
curX = gTasks[taskId].tCursorX + j;
|
||||
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
|
||||
behaviorBy = GetBehaviorByMetatileId(NUM_TILES_IN_PRIMARY + decoration->tiles[j]) & METATILE_ELEVATION_MASK;
|
||||
layerType = GetMetatileAttributesById(NUM_TILES_IN_PRIMARY + decoration->tiles[j]) & METATILE_ATTR_LAYER_MASK;
|
||||
if (!MetatileBehavior_IsNormal(behaviorAt) && !MetatileBehavior_IsSecretBaseNorthWall(behaviorAt))
|
||||
return FALSE;
|
||||
|
||||
if (!IsntInitialPosition(taskId, curX, curY, behaviorBy))
|
||||
if (!IsntInitialPosition(taskId, curX, curY, layerType))
|
||||
return FALSE;
|
||||
|
||||
behaviorAt = GetObjectEventIdByXYZ(curX, curY, 0);
|
||||
behaviorAt = GetObjectEventIdByPosition(curX, curY, 0);
|
||||
if (behaviorAt != 0 && behaviorAt != OBJECT_EVENTS_COUNT)
|
||||
return FALSE;
|
||||
}
|
||||
@ -1606,7 +1609,7 @@ static bool8 CanPlaceDecoration(u8 taskId, const struct Decoration *decoration)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (GetObjectEventIdByXYZ(curX, curY, 0) != OBJECT_EVENTS_COUNT)
|
||||
if (GetObjectEventIdByPosition(curX, curY, 0) != OBJECT_EVENTS_COUNT)
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
@ -110,7 +110,7 @@ static void GetGroundEffectFlags_Seaweed(struct ObjectEvent*, u32*);
|
||||
static void GetGroundEffectFlags_JumpLanding(struct ObjectEvent*, u32*);
|
||||
static u8 ObjectEventGetNearbyReflectionType(struct ObjectEvent*);
|
||||
static u8 GetReflectionTypeByMetatileBehavior(u32);
|
||||
static void InitObjectPriorityByZCoord(struct Sprite *sprite, u8 z);
|
||||
static void InitObjectPriorityByElevation(struct Sprite *, u8);
|
||||
static void ObjectEventUpdateSubpriority(struct ObjectEvent*, struct Sprite*);
|
||||
static void DoTracksGroundEffect_None(struct ObjectEvent*, struct Sprite*, u8);
|
||||
static void DoTracksGroundEffect_Footprints(struct ObjectEvent*, struct Sprite*, u8);
|
||||
@ -142,27 +142,29 @@ static void ResetObjectEventFldEffData(struct ObjectEvent *);
|
||||
static u8 LoadSpritePaletteIfTagExists(const struct SpritePalette *);
|
||||
static u8 FindObjectEventPaletteIndexByTag(u16);
|
||||
static void _PatchObjectPalette(u16, u8);
|
||||
static bool8 ObjectEventDoesZCoordMatch(struct ObjectEvent *, u8);
|
||||
static bool8 ObjectEventDoesElevationMatch(struct ObjectEvent *, u8);
|
||||
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 localId, struct ObjectEventTemplate *templates, u8 count);
|
||||
static struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8, 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);
|
||||
static void InitSpriteForFigure8Anim(struct Sprite *sprite);
|
||||
static bool8 AnimateSpriteInFigure8(struct Sprite *sprite);
|
||||
static void InitSpriteForFigure8Anim(struct Sprite *);
|
||||
static bool8 AnimateSpriteInFigure8(struct Sprite *);
|
||||
static void SpriteCB_VirtualObject(struct Sprite *);
|
||||
static void DoShadowFieldEffect(struct ObjectEvent *);
|
||||
static void SetJumpSpriteData(struct Sprite *, u8, u8, u8);
|
||||
static void SetWalkSlowSpriteData(struct Sprite *sprite, u8 direction);
|
||||
static bool8 UpdateWalkSlowAnim(struct Sprite *sprite);
|
||||
static u8 DoJumpSpriteMovement(struct Sprite *sprite);
|
||||
static u8 DoJumpSpecialSpriteMovement(struct Sprite *sprite);
|
||||
static void SetWalkSlowSpriteData(struct Sprite *, u8);
|
||||
static bool8 UpdateWalkSlowAnim(struct Sprite *);
|
||||
static u8 DoJumpSpriteMovement(struct Sprite *);
|
||||
static u8 DoJumpSpecialSpriteMovement(struct Sprite *);
|
||||
static void CreateLevitateMovementTask(struct ObjectEvent *);
|
||||
static void DestroyLevitateMovementTask(u8);
|
||||
static bool8 NpcTakeStep(struct Sprite *sprite);
|
||||
static bool8 NpcTakeStep(struct Sprite *);
|
||||
static bool8 IsElevationMismatchAt(u8, s16, s16);
|
||||
static bool8 AreElevationsCompatible(u8 a, u8 b);
|
||||
|
||||
static const struct SpriteFrameImage sPicTable_PechaBerryTree[];
|
||||
|
||||
@ -1433,7 +1435,7 @@ static u8 TrySetupObjectEventSprite(struct ObjectEventTemplate *objectEventTempl
|
||||
if (!objectEvent->inanimate)
|
||||
StartSpriteAnim(sprite, GetFaceDirectionAnimNum(objectEvent->facingDirection));
|
||||
|
||||
SetObjectSubpriorityByZCoord(objectEvent->previousElevation, sprite, 1);
|
||||
SetObjectSubpriorityByElevation(objectEvent->previousElevation, sprite, 1);
|
||||
UpdateObjectEventVisibility(objectEvent, sprite);
|
||||
return objectEventId;
|
||||
}
|
||||
@ -1470,7 +1472,7 @@ u8 SpawnSpecialObjectEvent(struct ObjectEventTemplate *objectEventTemplate)
|
||||
return TrySpawnObjectEventTemplate(objectEventTemplate, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, cameraX, cameraY);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct ObjectEventTemplate objectEventTemplate;
|
||||
|
||||
@ -1481,7 +1483,7 @@ u8 SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 l
|
||||
objectEventTemplate.inConnection = 0;
|
||||
objectEventTemplate.x = x;
|
||||
objectEventTemplate.y = y;
|
||||
objectEventTemplate.elevation = z;
|
||||
objectEventTemplate.elevation = elevation;
|
||||
objectEventTemplate.movementType = movementBehavior;
|
||||
objectEventTemplate.movementRangeX = 0;
|
||||
objectEventTemplate.movementRangeY = 0;
|
||||
@ -1560,7 +1562,7 @@ u8 CreateObjectGraphicsSprite(u16 graphicsId, void (*callback)(struct Sprite *),
|
||||
// A unique id is given as an argument and stored in the sprite data to allow referring back to the same virtual object.
|
||||
// They can be turned (and, in the case of the Union Room, animated teleporting in and out) but do not have movement types
|
||||
// or any of the other data normally associated with object events.
|
||||
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)
|
||||
{
|
||||
u8 spriteId;
|
||||
struct Sprite *sprite;
|
||||
@ -1587,7 +1589,7 @@ u8 CreateVirtualObject(u8 graphicsId, u8 virtualObjId, s16 x, s16 y, u8 z, u8 di
|
||||
|
||||
sprite->coordOffsetEnabled = TRUE;
|
||||
sprite->sVirtualObjId = virtualObjId;
|
||||
sprite->sVirtualObjElev = z;
|
||||
sprite->sVirtualObjElev = elevation;
|
||||
if (graphicsInfo->paletteSlot == 10)
|
||||
LoadSpecialObjectReflectionPalette(graphicsInfo->paletteTag, graphicsInfo->paletteSlot);
|
||||
else if (graphicsInfo->paletteSlot >= 16)
|
||||
@ -1598,8 +1600,8 @@ u8 CreateVirtualObject(u8 graphicsId, u8 virtualObjId, s16 x, s16 y, u8 z, u8 di
|
||||
SetSubspriteTables(sprite, subspriteTables);
|
||||
sprite->subspriteMode = SUBSPRITES_IGNORE_PRIORITY;
|
||||
}
|
||||
InitObjectPriorityByZCoord(sprite, z);
|
||||
SetObjectSubpriorityByZCoord(z, sprite, 1);
|
||||
InitObjectPriorityByElevation(sprite, elevation);
|
||||
SetObjectSubpriorityByElevation(elevation, sprite, 1);
|
||||
StartSpriteAnim(sprite, GetFaceDirectionAnimNum(direction));
|
||||
}
|
||||
return spriteId;
|
||||
@ -1755,7 +1757,7 @@ static void SpawnObjectEventOnReturnToField(u8 objectEventId, s16 x, s16 y)
|
||||
StartSpriteAnim(sprite, GetFaceDirectionAnimNum(objectEvent->facingDirection));
|
||||
|
||||
ResetObjectEventFldEffData(objectEvent);
|
||||
SetObjectSubpriorityByZCoord(objectEvent->previousElevation, sprite, 1);
|
||||
SetObjectSubpriorityByElevation(objectEvent->previousElevation, sprite, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2148,7 +2150,7 @@ void UpdateObjectEventCoordsForCameraUpdate(void)
|
||||
}
|
||||
}
|
||||
|
||||
u8 GetObjectEventIdByXYZ(u16 x, u16 y, u8 z)
|
||||
u8 GetObjectEventIdByPosition(u16 x, u16 y, u8 elevation)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
@ -2156,16 +2158,18 @@ u8 GetObjectEventIdByXYZ(u16 x, u16 y, u8 z)
|
||||
{
|
||||
if (gObjectEvents[i].active)
|
||||
{
|
||||
if (gObjectEvents[i].currentCoords.x == x && gObjectEvents[i].currentCoords.y == y && ObjectEventDoesZCoordMatch(&gObjectEvents[i], z))
|
||||
if (gObjectEvents[i].currentCoords.x == x
|
||||
&& gObjectEvents[i].currentCoords.y == y
|
||||
&& ObjectEventDoesElevationMatch(&gObjectEvents[i], elevation))
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return OBJECT_EVENTS_COUNT;
|
||||
}
|
||||
|
||||
static bool8 ObjectEventDoesZCoordMatch(struct ObjectEvent *objectEvent, u8 z)
|
||||
static bool8 ObjectEventDoesElevationMatch(struct ObjectEvent *objectEvent, u8 elevation)
|
||||
{
|
||||
if (objectEvent->currentElevation != 0 && z != 0 && objectEvent->currentElevation != z)
|
||||
if (objectEvent->currentElevation != 0 && elevation != 0 && objectEvent->currentElevation != elevation)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
@ -4630,7 +4634,7 @@ u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dir)
|
||||
return COLLISION_IMPASSABLE;
|
||||
else if (objectEvent->trackedByCamera && !CanCameraMoveInDirection(direction))
|
||||
return COLLISION_IMPASSABLE;
|
||||
else if (IsZCoordMismatchAt(objectEvent->currentElevation, x, y))
|
||||
else if (IsElevationMismatchAt(objectEvent->currentElevation, x, y))
|
||||
return COLLISION_ELEVATION_MISMATCH;
|
||||
else if (DoesObjectCollideWithObjectAt(objectEvent, x, y))
|
||||
return COLLISION_OBJECT_EVENT;
|
||||
@ -4645,7 +4649,7 @@ u8 GetCollisionFlagsAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u8 d
|
||||
flags |= 1;
|
||||
if (MapGridIsImpassableAt(x, y) || GetMapBorderIdAt(x, y) == -1 || IsMetatileDirectionallyImpassable(objectEvent, x, y, direction) || (objectEvent->trackedByCamera && !CanCameraMoveInDirection(direction)))
|
||||
flags |= 2;
|
||||
if (IsZCoordMismatchAt(objectEvent->currentElevation, x, y))
|
||||
if (IsElevationMismatchAt(objectEvent->currentElevation, x, y))
|
||||
flags |= 4;
|
||||
if (DoesObjectCollideWithObjectAt(objectEvent, x, y))
|
||||
flags |= 8;
|
||||
@ -4699,7 +4703,7 @@ static bool8 DoesObjectCollideWithObjectAt(struct ObjectEvent *objectEvent, s16
|
||||
{
|
||||
if ((curObject->currentCoords.x == x && curObject->currentCoords.y == y) || (curObject->previousCoords.x == x && curObject->previousCoords.y == y))
|
||||
{
|
||||
if (AreZCoordsCompatible(objectEvent->currentElevation, curObject->currentElevation))
|
||||
if (AreElevationsCompatible(objectEvent->currentElevation, curObject->currentElevation))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -7667,23 +7671,23 @@ static void SetObjectEventSpriteOamTableForLongGrass(struct ObjectEvent *objEven
|
||||
|
||||
sprite->subspriteTableNum = 4;
|
||||
|
||||
if (ZCoordToPriority(objEvent->previousElevation) == 1)
|
||||
if (ElevationToPriority(objEvent->previousElevation) == 1)
|
||||
sprite->subspriteTableNum = 5;
|
||||
}
|
||||
|
||||
bool8 IsZCoordMismatchAt(u8 z, s16 x, s16 y)
|
||||
static bool8 IsElevationMismatchAt(u8 elevation, s16 x, s16 y)
|
||||
{
|
||||
u8 mapZ;
|
||||
u8 mapElevation;
|
||||
|
||||
if (z == 0)
|
||||
if (elevation == 0)
|
||||
return FALSE;
|
||||
|
||||
mapZ = MapGridGetZCoordAt(x, y);
|
||||
mapElevation = MapGridGetElevationAt(x, y);
|
||||
|
||||
if (mapZ == 0 || mapZ == 15)
|
||||
if (mapElevation == 0 || mapElevation == 15)
|
||||
return FALSE;
|
||||
|
||||
if (mapZ != z)
|
||||
if (mapElevation != elevation)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
@ -7701,43 +7705,43 @@ static const u8 sElevationToSubspriteTableNum[] = {
|
||||
1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 0, 1,
|
||||
};
|
||||
|
||||
void UpdateObjectEventZCoordAndPriority(struct ObjectEvent *objEvent, struct Sprite *sprite)
|
||||
static void UpdateObjectEventElevationAndPriority(struct ObjectEvent *objEvent, struct Sprite *sprite)
|
||||
{
|
||||
if (objEvent->fixedPriority)
|
||||
return;
|
||||
|
||||
ObjectEventUpdateZCoord(objEvent);
|
||||
ObjectEventUpdateElevation(objEvent);
|
||||
|
||||
sprite->subspriteTableNum = sElevationToSubspriteTableNum[objEvent->previousElevation];
|
||||
sprite->oam.priority = sElevationToPriority[objEvent->previousElevation];
|
||||
}
|
||||
|
||||
static void InitObjectPriorityByZCoord(struct Sprite *sprite, u8 z)
|
||||
static void InitObjectPriorityByElevation(struct Sprite *sprite, u8 elevation)
|
||||
{
|
||||
sprite->subspriteTableNum = sElevationToSubspriteTableNum[z];
|
||||
sprite->oam.priority = sElevationToPriority[z];
|
||||
sprite->subspriteTableNum = sElevationToSubspriteTableNum[elevation];
|
||||
sprite->oam.priority = sElevationToPriority[elevation];
|
||||
}
|
||||
|
||||
u8 ZCoordToPriority(u8 z)
|
||||
u8 ElevationToPriority(u8 elevation)
|
||||
{
|
||||
return sElevationToPriority[z];
|
||||
return sElevationToPriority[elevation];
|
||||
}
|
||||
|
||||
void ObjectEventUpdateZCoord(struct ObjectEvent *objEvent)
|
||||
void ObjectEventUpdateElevation(struct ObjectEvent *objEvent)
|
||||
{
|
||||
u8 z = MapGridGetZCoordAt(objEvent->currentCoords.x, objEvent->currentCoords.y);
|
||||
u8 z2 = MapGridGetZCoordAt(objEvent->previousCoords.x, objEvent->previousCoords.y);
|
||||
u8 curElevation = MapGridGetElevationAt(objEvent->currentCoords.x, objEvent->currentCoords.y);
|
||||
u8 prevElevation = MapGridGetElevationAt(objEvent->previousCoords.x, objEvent->previousCoords.y);
|
||||
|
||||
if (z == 0xF || z2 == 0xF)
|
||||
if (curElevation == 15 || prevElevation == 15)
|
||||
return;
|
||||
|
||||
objEvent->currentElevation = z;
|
||||
objEvent->currentElevation = curElevation;
|
||||
|
||||
if (z != 0 && z != 0xF)
|
||||
objEvent->previousElevation = z;
|
||||
if (curElevation != 0 && curElevation != 15)
|
||||
objEvent->previousElevation = curElevation;
|
||||
}
|
||||
|
||||
void SetObjectSubpriorityByZCoord(u8 elevation, struct Sprite *sprite, u8 subpriority)
|
||||
void SetObjectSubpriorityByElevation(u8 elevation, struct Sprite *sprite, u8 subpriority)
|
||||
{
|
||||
s32 tmp = sprite->centerToCornerVecY;
|
||||
u32 tmpa = *(u16 *)&sprite->y;
|
||||
@ -7752,10 +7756,10 @@ static void ObjectEventUpdateSubpriority(struct ObjectEvent *objEvent, struct Sp
|
||||
if (objEvent->fixedPriority)
|
||||
return;
|
||||
|
||||
SetObjectSubpriorityByZCoord(objEvent->previousElevation, sprite, 1);
|
||||
SetObjectSubpriorityByElevation(objEvent->previousElevation, sprite, 1);
|
||||
}
|
||||
|
||||
bool8 AreZCoordsCompatible(u8 a, u8 b)
|
||||
static bool8 AreElevationsCompatible(u8 a, u8 b)
|
||||
{
|
||||
if (a == 0 || b == 0)
|
||||
return TRUE;
|
||||
@ -8051,7 +8055,7 @@ static void DoGroundEffects_OnSpawn(struct ObjectEvent *objEvent, struct Sprite
|
||||
if (objEvent->triggerGroundEffectsOnMove)
|
||||
{
|
||||
flags = 0;
|
||||
UpdateObjectEventZCoordAndPriority(objEvent, sprite);
|
||||
UpdateObjectEventElevationAndPriority(objEvent, sprite);
|
||||
GetAllGroundEffectFlags_OnSpawn(objEvent, &flags);
|
||||
SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite);
|
||||
DoFlaggedGroundEffects(objEvent, sprite, flags);
|
||||
@ -8067,7 +8071,7 @@ static void DoGroundEffects_OnBeginStep(struct ObjectEvent *objEvent, struct Spr
|
||||
if (objEvent->triggerGroundEffectsOnMove)
|
||||
{
|
||||
flags = 0;
|
||||
UpdateObjectEventZCoordAndPriority(objEvent, sprite);
|
||||
UpdateObjectEventElevationAndPriority(objEvent, sprite);
|
||||
GetAllGroundEffectFlags_OnBeginStep(objEvent, &flags);
|
||||
SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite);
|
||||
filters_out_some_ground_effects(objEvent, &flags);
|
||||
@ -8084,7 +8088,7 @@ static void DoGroundEffects_OnFinishStep(struct ObjectEvent *objEvent, struct Sp
|
||||
if (objEvent->triggerGroundEffectsOnStop)
|
||||
{
|
||||
flags = 0;
|
||||
UpdateObjectEventZCoordAndPriority(objEvent, sprite);
|
||||
UpdateObjectEventElevationAndPriority(objEvent, sprite);
|
||||
GetAllGroundEffectFlags_OnFinishStep(objEvent, &flags);
|
||||
SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite);
|
||||
FilterOutStepOnPuddleGroundEffectIfJumping(objEvent, &flags);
|
||||
@ -8548,7 +8552,7 @@ void UpdateObjectEventSpriteInvisibility(struct Sprite *sprite, bool8 invisible)
|
||||
static void SpriteCB_VirtualObject(struct Sprite *sprite)
|
||||
{
|
||||
VirtualObject_UpdateAnim(sprite);
|
||||
SetObjectSubpriorityByZCoord(sprite->sVirtualObjElev, sprite, 1);
|
||||
SetObjectSubpriorityByElevation(sprite->sVirtualObjElev, sprite, 1);
|
||||
UpdateObjectEventSpriteInvisibility(sprite, sprite->sInvisible);
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
EWRAM_DATA bool8 gUnusedBikeCameraAheadPanback = FALSE;
|
||||
|
||||
// Static type declarations
|
||||
struct FieldCameraOffset
|
||||
{
|
||||
u8 xPixelOffset;
|
||||
@ -24,18 +23,16 @@ struct FieldCameraOffset
|
||||
bool8 copyBGToVRAM;
|
||||
};
|
||||
|
||||
// static functions
|
||||
static void RedrawMapSliceNorth(struct FieldCameraOffset *cameraOffset, const struct MapLayout *mapLayout);
|
||||
static void RedrawMapSliceSouth(struct FieldCameraOffset *cameraOffset, const struct MapLayout *mapLayout);
|
||||
static void RedrawMapSliceEast(struct FieldCameraOffset *cameraOffset, const struct MapLayout *mapLayout);
|
||||
static void RedrawMapSliceWest(struct FieldCameraOffset *cameraOffset, const struct MapLayout *mapLayout);
|
||||
static s32 MapPosToBgTilemapOffset(struct FieldCameraOffset *a, s32 x, s32 y);
|
||||
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 RedrawMapSliceNorth(struct FieldCameraOffset *, const struct MapLayout *);
|
||||
static void RedrawMapSliceSouth(struct FieldCameraOffset *, const struct MapLayout *);
|
||||
static void RedrawMapSliceEast(struct FieldCameraOffset *, const struct MapLayout *);
|
||||
static void RedrawMapSliceWest(struct FieldCameraOffset *, const struct MapLayout *);
|
||||
static s32 MapPosToBgTilemapOffset(struct FieldCameraOffset *, s32, s32);
|
||||
static void DrawWholeMapViewInternal(int, int, const struct MapLayout *);
|
||||
static void DrawMetatileAt(const struct MapLayout *, u16, int, int);
|
||||
static void DrawMetatile(s32, u16 *, u16);
|
||||
static void CameraPanningCB_PanAhead(void);
|
||||
|
||||
// IWRAM bss vars
|
||||
static struct FieldCameraOffset sFieldCameraOffset;
|
||||
static s16 sHorizontalCameraPan;
|
||||
static s16 sVerticalCameraPan;
|
||||
@ -46,7 +43,6 @@ struct CameraObject gFieldCamera;
|
||||
u16 gTotalCameraPixelOffsetY;
|
||||
u16 gTotalCameraPixelOffsetX;
|
||||
|
||||
// text
|
||||
static void ResetCameraOffset(struct FieldCameraOffset *cameraOffset)
|
||||
{
|
||||
cameraOffset->xTileOffset = 0;
|
||||
@ -222,7 +218,7 @@ void DrawDoorMetatileAt(int x, int y, u16 *arr)
|
||||
|
||||
if (offset >= 0)
|
||||
{
|
||||
DrawMetatile(1, arr, offset);
|
||||
DrawMetatile(METATILE_LAYER_TYPE_COVERED, arr, offset);
|
||||
sFieldCameraOffset.copyBGToVRAM = TRUE;
|
||||
}
|
||||
}
|
||||
@ -244,66 +240,66 @@ static void DrawMetatileAt(const struct MapLayout *mapLayout, u16 offset, int x,
|
||||
DrawMetatile(MapGridGetMetatileLayerTypeAt(x, y), metatiles + metatileId * 8, offset);
|
||||
}
|
||||
|
||||
static void DrawMetatile(s32 metatileLayerType, u16 *metatiles, u16 offset)
|
||||
static void DrawMetatile(s32 metatileLayerType, u16 *tiles, u16 offset)
|
||||
{
|
||||
switch (metatileLayerType)
|
||||
{
|
||||
case 2: // LAYER_TYPE_
|
||||
case METATILE_LAYER_TYPE_SPLIT:
|
||||
// Draw metatile's bottom layer to the bottom background layer.
|
||||
gBGTilemapBuffers3[offset] = metatiles[0];
|
||||
gBGTilemapBuffers3[offset + 1] = metatiles[1];
|
||||
gBGTilemapBuffers3[offset + 0x20] = metatiles[2];
|
||||
gBGTilemapBuffers3[offset + 0x21] = metatiles[3];
|
||||
gOverworldTilemapBuffer_Bg3[offset] = tiles[0];
|
||||
gOverworldTilemapBuffer_Bg3[offset + 1] = tiles[1];
|
||||
gOverworldTilemapBuffer_Bg3[offset + 0x20] = tiles[2];
|
||||
gOverworldTilemapBuffer_Bg3[offset + 0x21] = tiles[3];
|
||||
|
||||
// Draw transparent tiles to the middle background layer.
|
||||
gBGTilemapBuffers1[offset] = 0;
|
||||
gBGTilemapBuffers1[offset + 1] = 0;
|
||||
gBGTilemapBuffers1[offset + 0x20] = 0;
|
||||
gBGTilemapBuffers1[offset + 0x21] = 0;
|
||||
gOverworldTilemapBuffer_Bg2[offset] = 0;
|
||||
gOverworldTilemapBuffer_Bg2[offset + 1] = 0;
|
||||
gOverworldTilemapBuffer_Bg2[offset + 0x20] = 0;
|
||||
gOverworldTilemapBuffer_Bg2[offset + 0x21] = 0;
|
||||
|
||||
// Draw metatile's top layer to the top background layer.
|
||||
gBGTilemapBuffers2[offset] = metatiles[4];
|
||||
gBGTilemapBuffers2[offset + 1] = metatiles[5];
|
||||
gBGTilemapBuffers2[offset + 0x20] = metatiles[6];
|
||||
gBGTilemapBuffers2[offset + 0x21] = metatiles[7];
|
||||
gOverworldTilemapBuffer_Bg1[offset] = tiles[4];
|
||||
gOverworldTilemapBuffer_Bg1[offset + 1] = tiles[5];
|
||||
gOverworldTilemapBuffer_Bg1[offset + 0x20] = tiles[6];
|
||||
gOverworldTilemapBuffer_Bg1[offset + 0x21] = tiles[7];
|
||||
break;
|
||||
case 1: // LAYER_TYPE_COVERED_BY_OBJECTS
|
||||
case METATILE_LAYER_TYPE_COVERED:
|
||||
// Draw metatile's bottom layer to the bottom background layer.
|
||||
gBGTilemapBuffers3[offset] = metatiles[0];
|
||||
gBGTilemapBuffers3[offset + 1] = metatiles[1];
|
||||
gBGTilemapBuffers3[offset + 0x20] = metatiles[2];
|
||||
gBGTilemapBuffers3[offset + 0x21] = metatiles[3];
|
||||
gOverworldTilemapBuffer_Bg3[offset] = tiles[0];
|
||||
gOverworldTilemapBuffer_Bg3[offset + 1] = tiles[1];
|
||||
gOverworldTilemapBuffer_Bg3[offset + 0x20] = tiles[2];
|
||||
gOverworldTilemapBuffer_Bg3[offset + 0x21] = tiles[3];
|
||||
|
||||
// Draw metatile's top layer to the middle background layer.
|
||||
gBGTilemapBuffers1[offset] = metatiles[4];
|
||||
gBGTilemapBuffers1[offset + 1] = metatiles[5];
|
||||
gBGTilemapBuffers1[offset + 0x20] = metatiles[6];
|
||||
gBGTilemapBuffers1[offset + 0x21] = metatiles[7];
|
||||
gOverworldTilemapBuffer_Bg2[offset] = tiles[4];
|
||||
gOverworldTilemapBuffer_Bg2[offset + 1] = tiles[5];
|
||||
gOverworldTilemapBuffer_Bg2[offset + 0x20] = tiles[6];
|
||||
gOverworldTilemapBuffer_Bg2[offset + 0x21] = tiles[7];
|
||||
|
||||
// Draw transparent tiles to the top background layer.
|
||||
gBGTilemapBuffers2[offset] = 0;
|
||||
gBGTilemapBuffers2[offset + 1] = 0;
|
||||
gBGTilemapBuffers2[offset + 0x20] = 0;
|
||||
gBGTilemapBuffers2[offset + 0x21] = 0;
|
||||
gOverworldTilemapBuffer_Bg1[offset] = 0;
|
||||
gOverworldTilemapBuffer_Bg1[offset + 1] = 0;
|
||||
gOverworldTilemapBuffer_Bg1[offset + 0x20] = 0;
|
||||
gOverworldTilemapBuffer_Bg1[offset + 0x21] = 0;
|
||||
break;
|
||||
case 0: // LAYER_TYPE_NORMAL
|
||||
case METATILE_LAYER_TYPE_NORMAL:
|
||||
// Draw garbage to the bottom background layer.
|
||||
gBGTilemapBuffers3[offset] = 0x3014;
|
||||
gBGTilemapBuffers3[offset + 1] = 0x3014;
|
||||
gBGTilemapBuffers3[offset + 0x20] = 0x3014;
|
||||
gBGTilemapBuffers3[offset + 0x21] = 0x3014;
|
||||
gOverworldTilemapBuffer_Bg3[offset] = 0x3014;
|
||||
gOverworldTilemapBuffer_Bg3[offset + 1] = 0x3014;
|
||||
gOverworldTilemapBuffer_Bg3[offset + 0x20] = 0x3014;
|
||||
gOverworldTilemapBuffer_Bg3[offset + 0x21] = 0x3014;
|
||||
|
||||
// Draw metatile's bottom layer to the middle background layer.
|
||||
gBGTilemapBuffers1[offset] = metatiles[0];
|
||||
gBGTilemapBuffers1[offset + 1] = metatiles[1];
|
||||
gBGTilemapBuffers1[offset + 0x20] = metatiles[2];
|
||||
gBGTilemapBuffers1[offset + 0x21] = metatiles[3];
|
||||
gOverworldTilemapBuffer_Bg2[offset] = tiles[0];
|
||||
gOverworldTilemapBuffer_Bg2[offset + 1] = tiles[1];
|
||||
gOverworldTilemapBuffer_Bg2[offset + 0x20] = tiles[2];
|
||||
gOverworldTilemapBuffer_Bg2[offset + 0x21] = tiles[3];
|
||||
|
||||
// Draw metatile's top layer to the top background layer, which covers object event sprites.
|
||||
gBGTilemapBuffers2[offset] = metatiles[4];
|
||||
gBGTilemapBuffers2[offset + 1] = metatiles[5];
|
||||
gBGTilemapBuffers2[offset + 0x20] = metatiles[6];
|
||||
gBGTilemapBuffers2[offset + 0x21] = metatiles[7];
|
||||
gOverworldTilemapBuffer_Bg1[offset] = tiles[4];
|
||||
gOverworldTilemapBuffer_Bg1[offset + 1] = tiles[5];
|
||||
gOverworldTilemapBuffer_Bg1[offset + 0x20] = tiles[6];
|
||||
gOverworldTilemapBuffer_Bg1[offset + 0x21] = tiles[7];
|
||||
break;
|
||||
}
|
||||
ScheduleBgCopyTilemapToVram(1);
|
||||
|
@ -194,7 +194,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
|
||||
static void GetPlayerPosition(struct MapPosition *position)
|
||||
{
|
||||
PlayerGetDestCoords(&position->x, &position->y);
|
||||
position->height = PlayerGetZCoord();
|
||||
position->elevation = PlayerGetElevation();
|
||||
}
|
||||
|
||||
static void GetInFrontOfPlayerPosition(struct MapPosition *position)
|
||||
@ -203,10 +203,10 @@ static void GetInFrontOfPlayerPosition(struct MapPosition *position)
|
||||
|
||||
GetXYCoordsOneStepInFrontOfPlayer(&position->x, &position->y);
|
||||
PlayerGetDestCoords(&x, &y);
|
||||
if (MapGridGetZCoordAt(x, y) != 0)
|
||||
position->height = PlayerGetZCoord();
|
||||
if (MapGridGetElevationAt(x, y) != 0)
|
||||
position->elevation = PlayerGetElevation();
|
||||
else
|
||||
position->height = 0;
|
||||
position->elevation = 0;
|
||||
}
|
||||
|
||||
static u16 GetPlayerCurMetatileBehavior(int runningState)
|
||||
@ -264,9 +264,9 @@ const u8 *GetInteractedLinkPlayerScript(struct MapPosition *position, u8 metatil
|
||||
s32 i;
|
||||
|
||||
if (!MetatileBehavior_IsCounter(MapGridGetMetatileBehaviorAt(position->x, position->y)))
|
||||
objectEventId = GetObjectEventIdByXYZ(position->x, position->y, position->height);
|
||||
objectEventId = GetObjectEventIdByPosition(position->x, position->y, position->elevation);
|
||||
else
|
||||
objectEventId = GetObjectEventIdByXYZ(position->x + gDirectionToVectors[direction].x, position->y + gDirectionToVectors[direction].y, position->height);
|
||||
objectEventId = GetObjectEventIdByPosition(position->x + gDirectionToVectors[direction].x, position->y + gDirectionToVectors[direction].y, position->elevation);
|
||||
|
||||
if (objectEventId == OBJECT_EVENTS_COUNT || gObjectEvents[objectEventId].localId == OBJ_EVENT_ID_PLAYER)
|
||||
return NULL;
|
||||
@ -288,14 +288,14 @@ static const u8 *GetInteractedObjectEventScript(struct MapPosition *position, u8
|
||||
u8 objectEventId;
|
||||
const u8 *script;
|
||||
|
||||
objectEventId = GetObjectEventIdByXYZ(position->x, position->y, position->height);
|
||||
objectEventId = GetObjectEventIdByPosition(position->x, position->y, position->elevation);
|
||||
if (objectEventId == OBJECT_EVENTS_COUNT || gObjectEvents[objectEventId].localId == OBJ_EVENT_ID_PLAYER)
|
||||
{
|
||||
if (MetatileBehavior_IsCounter(metatileBehavior) != TRUE)
|
||||
return NULL;
|
||||
|
||||
// Look for an object event on the other side of the counter.
|
||||
objectEventId = GetObjectEventIdByXYZ(position->x + gDirectionToVectors[direction].x, position->y + gDirectionToVectors[direction].y, position->height);
|
||||
objectEventId = GetObjectEventIdByPosition(position->x + gDirectionToVectors[direction].x, position->y + gDirectionToVectors[direction].y, position->elevation);
|
||||
if (objectEventId == OBJECT_EVENTS_COUNT || gObjectEvents[objectEventId].localId == OBJ_EVENT_ID_PLAYER)
|
||||
return NULL;
|
||||
}
|
||||
@ -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->height);
|
||||
struct BgEvent *bgEvent = GetBackgroundEventAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
|
||||
|
||||
if (bgEvent == NULL)
|
||||
return NULL;
|
||||
@ -366,7 +366,7 @@ static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position
|
||||
|
||||
static const u8 *GetInteractedMetatileScript(struct MapPosition *position, u8 metatileBehavior, u8 direction)
|
||||
{
|
||||
s8 height;
|
||||
s8 elevation;
|
||||
|
||||
if (MetatileBehavior_IsPlayerFacingTVScreen(metatileBehavior, direction) == TRUE)
|
||||
return EventScript_TV;
|
||||
@ -409,8 +409,8 @@ static const u8 *GetInteractedMetatileScript(struct MapPosition *position, u8 me
|
||||
if (MetatileBehavior_IsTrainerHillTimer(metatileBehavior) == TRUE)
|
||||
return EventScript_TrainerHillTimer;
|
||||
|
||||
height = position->height;
|
||||
if (height == MapGridGetZCoordAt(position->x, position->y))
|
||||
elevation = position->elevation;
|
||||
if (elevation == MapGridGetElevationAt(position->x, position->y))
|
||||
{
|
||||
if (MetatileBehavior_IsSecretBasePC(metatileBehavior) == TRUE)
|
||||
return SecretBase_EventScript_PC;
|
||||
@ -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->height);
|
||||
u8 *script = GetCoordEventScriptAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
|
||||
|
||||
if (script == NULL)
|
||||
return FALSE;
|
||||
@ -783,7 +783,7 @@ static bool8 IsArrowWarpMetatileBehavior(u16 metatileBehavior, u8 direction)
|
||||
|
||||
static s8 GetWarpEventAtMapPosition(struct MapHeader *mapHeader, struct MapPosition *position)
|
||||
{
|
||||
return GetWarpEventAtPosition(mapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->height);
|
||||
return GetWarpEventAtPosition(mapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
|
||||
}
|
||||
|
||||
static void SetupWarp(struct MapHeader *unused, s8 warpEventId, struct MapPosition *position)
|
||||
@ -918,7 +918,7 @@ static u8 *GetCoordEventScriptAtPosition(struct MapHeader *mapHeader, u16 x, u16
|
||||
|
||||
u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position)
|
||||
{
|
||||
return GetCoordEventScriptAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->height);
|
||||
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)
|
||||
|
@ -359,7 +359,7 @@ void UpdateTallGrassFieldEffect(struct Sprite *sprite)
|
||||
|| objectEvent->previousCoords.y != sprite->sY))
|
||||
sprite->sObjectMoved = TRUE;
|
||||
|
||||
// Metatile behavior var re-used
|
||||
// Metatile behavior var re-used as subpriority
|
||||
metatileBehavior = 0;
|
||||
if (sprite->animCmdIndex == 0)
|
||||
metatileBehavior = 4;
|
||||
@ -423,7 +423,7 @@ u32 FldEff_LongGrass(void)
|
||||
{
|
||||
sprite = &gSprites[spriteId];
|
||||
sprite->coordOffsetEnabled = TRUE;
|
||||
sprite->oam.priority = ZCoordToPriority(gFieldEffectArguments[2]);
|
||||
sprite->oam.priority = ElevationToPriority(gFieldEffectArguments[2]);
|
||||
sprite->sElevation = gFieldEffectArguments[2];
|
||||
sprite->sX = gFieldEffectArguments[0];
|
||||
sprite->sY = gFieldEffectArguments[1];
|
||||
@ -1108,7 +1108,7 @@ void SynchroniseSurfPosition(struct ObjectEvent *playerObj, struct Sprite *sprit
|
||||
for (i = DIR_SOUTH; i <= DIR_EAST; i++, x = sprite->data[6], y = sprite->data[7])
|
||||
{
|
||||
MoveCoords(i, &x, &y);
|
||||
if (MapGridGetZCoordAt(x, y) == 3)
|
||||
if (MapGridGetElevationAt(x, y) == 3)
|
||||
{
|
||||
sprite->data[5]++;
|
||||
break;
|
||||
@ -1646,7 +1646,7 @@ void UpdateJumpImpactEffect(struct Sprite *sprite)
|
||||
else
|
||||
{
|
||||
UpdateObjectEventSpriteInvisibility(sprite, FALSE);
|
||||
SetObjectSubpriorityByZCoord(sprite->sElevation, sprite, 0);
|
||||
SetObjectSubpriorityByElevation(sprite->sElevation, sprite, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1658,14 +1658,14 @@ void WaitFieldEffectSpriteAnim(struct Sprite *sprite)
|
||||
UpdateObjectEventSpriteInvisibility(sprite, FALSE);
|
||||
}
|
||||
|
||||
static void UpdateGrassFieldEffectSubpriority(struct Sprite *sprite, u8 z, u8 offset)
|
||||
static void UpdateGrassFieldEffectSubpriority(struct Sprite *sprite, u8 elevation, u8 subpriority)
|
||||
{
|
||||
u8 i;
|
||||
s16 var, xhi, lyhi, yhi, ylo;
|
||||
const struct ObjectEventGraphicsInfo *graphicsInfo; // Unused Variable
|
||||
struct Sprite *linkedSprite;
|
||||
|
||||
SetObjectSubpriorityByZCoord(z, sprite, offset);
|
||||
SetObjectSubpriorityByElevation(elevation, sprite, subpriority);
|
||||
for (i = 0; i < OBJECT_EVENTS_COUNT; i ++)
|
||||
{
|
||||
struct ObjectEvent *objectEvent = &gObjectEvents[i];
|
||||
|
@ -708,8 +708,8 @@ static u8 CheckForObjectEventStaticCollision(struct ObjectEvent *objectEvent, s1
|
||||
static bool8 CanStopSurfing(s16 x, s16 y, u8 direction)
|
||||
{
|
||||
if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING)
|
||||
&& MapGridGetZCoordAt(x, y) == 3
|
||||
&& GetObjectEventIdByXYZ(x, y, 3) == OBJECT_EVENTS_COUNT)
|
||||
&& MapGridGetElevationAt(x, y) == 3
|
||||
&& GetObjectEventIdByPosition(x, y, 3) == OBJECT_EVENTS_COUNT)
|
||||
{
|
||||
CreateStopSurfingTask(direction);
|
||||
return TRUE;
|
||||
@ -1168,7 +1168,7 @@ u8 GetPlayerMovementDirection(void)
|
||||
return gObjectEvents[gPlayerAvatar.objectEventId].movementDirection;
|
||||
}
|
||||
|
||||
u8 PlayerGetZCoord(void)
|
||||
u8 PlayerGetElevation(void)
|
||||
{
|
||||
return gObjectEvents[gPlayerAvatar.objectEventId].previousElevation;
|
||||
}
|
||||
@ -1306,7 +1306,7 @@ bool8 IsPlayerFacingSurfableFishableWater(void)
|
||||
|
||||
MoveCoords(playerObjEvent->facingDirection, &x, &y);
|
||||
if (GetCollisionAtCoords(playerObjEvent, x, y, playerObjEvent->facingDirection) == COLLISION_ELEVATION_MISMATCH
|
||||
&& PlayerGetZCoord() == 3
|
||||
&& PlayerGetElevation() == 3
|
||||
&& MetatileBehavior_IsSurfableFishableWater(MapGridGetMetatileBehaviorAt(x, y)))
|
||||
return TRUE;
|
||||
else
|
||||
|
@ -650,10 +650,10 @@ void MauvilleGymSetDefaultBarriers(void)
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH2_On);
|
||||
break;
|
||||
case METATILE_MauvilleGym_GreenBeamH3_Off:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH3_On | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH3_On | MAPGRID_COLLISION_MASK);
|
||||
break;
|
||||
case METATILE_MauvilleGym_GreenBeamH4_Off:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH4_On | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH4_On | MAPGRID_COLLISION_MASK);
|
||||
break;
|
||||
case METATILE_MauvilleGym_RedBeamH1_On:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH1_Off);
|
||||
@ -674,37 +674,37 @@ void MauvilleGymSetDefaultBarriers(void)
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH2_On);
|
||||
break;
|
||||
case METATILE_MauvilleGym_RedBeamH3_Off:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH3_On | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH3_On | MAPGRID_COLLISION_MASK);
|
||||
break;
|
||||
case METATILE_MauvilleGym_RedBeamH4_Off:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH4_On | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH4_On | MAPGRID_COLLISION_MASK);
|
||||
break;
|
||||
case METATILE_MauvilleGym_GreenBeamV1_On:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_On | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_On | MAPGRID_COLLISION_MASK);
|
||||
break;
|
||||
case METATILE_MauvilleGym_GreenBeamV2_On:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_FloorTile);
|
||||
break;
|
||||
case METATILE_MauvilleGym_RedBeamV1_On:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_Off | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_Off | MAPGRID_COLLISION_MASK);
|
||||
break;
|
||||
case METATILE_MauvilleGym_RedBeamV2_On:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_FloorTile);
|
||||
break;
|
||||
case METATILE_MauvilleGym_PoleBottom_On:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamV1_On | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamV1_On | MAPGRID_COLLISION_MASK);
|
||||
break;
|
||||
case METATILE_MauvilleGym_FloorTile:
|
||||
if (MapGridGetMetatileIdAt(x, y - 1) == METATILE_MauvilleGym_GreenBeamV1_On)
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamV2_On | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamV2_On | MAPGRID_COLLISION_MASK);
|
||||
else
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamV2_On | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamV2_On | MAPGRID_COLLISION_MASK);
|
||||
break;
|
||||
case METATILE_MauvilleGym_PoleBottom_Off:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamV1_On | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamV1_On | MAPGRID_COLLISION_MASK);
|
||||
break;
|
||||
case METATILE_MauvilleGym_PoleTop_Off:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleTop_On | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleTop_On | MAPGRID_COLLISION_MASK);
|
||||
break;
|
||||
case METATILE_MauvilleGym_PoleTop_On:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleTop_Off);
|
||||
@ -755,10 +755,10 @@ void MauvilleGymDeactivatePuzzle(void)
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH4_Off);
|
||||
break;
|
||||
case METATILE_MauvilleGym_GreenBeamV1_On:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_On | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_On | MAPGRID_COLLISION_MASK);
|
||||
break;
|
||||
case METATILE_MauvilleGym_RedBeamV1_On:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_Off | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_Off | MAPGRID_COLLISION_MASK);
|
||||
break;
|
||||
case METATILE_MauvilleGym_GreenBeamV2_On:
|
||||
case METATILE_MauvilleGym_RedBeamV2_On:
|
||||
@ -867,8 +867,8 @@ static void PetalburgGymSetDoorMetatiles(u8 roomNumber, u16 metatileId)
|
||||
}
|
||||
for (i = 0; i < nDoors; i++)
|
||||
{
|
||||
MapGridSetMetatileIdAt(doorCoordsX[i] + MAP_OFFSET, doorCoordsY[i] + MAP_OFFSET, metatileId | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(doorCoordsX[i] + MAP_OFFSET, doorCoordsY[i] + MAP_OFFSET + 1, (metatileId + 8) | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(doorCoordsX[i] + MAP_OFFSET, doorCoordsY[i] + MAP_OFFSET, metatileId | MAPGRID_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(doorCoordsX[i] + MAP_OFFSET, doorCoordsY[i] + MAP_OFFSET + 1, (metatileId + 8) | MAPGRID_COLLISION_MASK);
|
||||
}
|
||||
DrawWholeMapView();
|
||||
}
|
||||
@ -1040,7 +1040,7 @@ static void PCTurnOnEffect_1(s16 isPcTurnedOn, s8 dx, s8 dy)
|
||||
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
|
||||
tileId = METATILE_BrendansMaysHouse_MayPC_On;
|
||||
}
|
||||
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | MAPGRID_COLLISION_MASK);
|
||||
}
|
||||
|
||||
void DoPCTurnOffEffect(void)
|
||||
@ -1075,7 +1075,7 @@ static void PCTurnOffEffect(void)
|
||||
tileId = METATILE_BrendansMaysHouse_BrendanPC_Off;
|
||||
else if (gSpecialVar_0x8004 == 2)
|
||||
tileId = METATILE_BrendansMaysHouse_MayPC_Off;
|
||||
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | MAPGRID_COLLISION_MASK);
|
||||
DrawWholeMapView();
|
||||
}
|
||||
|
||||
@ -1106,13 +1106,13 @@ static void LotteryCornerComputerEffect(struct Task *task)
|
||||
task->data[3] = 0;
|
||||
if (task->data[4] != 0)
|
||||
{
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Normal | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Normal | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Normal | MAPGRID_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Normal | MAPGRID_COLLISION_MASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Flash | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Flash | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Flash | MAPGRID_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Flash | MAPGRID_COLLISION_MASK);
|
||||
}
|
||||
DrawWholeMapView();
|
||||
task->data[4] ^= 1;
|
||||
@ -1124,8 +1124,8 @@ static void LotteryCornerComputerEffect(struct Task *task)
|
||||
|
||||
void EndLotteryCornerComputerEffect(void)
|
||||
{
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Normal | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Normal | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Normal | MAPGRID_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Normal | MAPGRID_COLLISION_MASK);
|
||||
DrawWholeMapView();
|
||||
}
|
||||
|
||||
@ -1872,7 +1872,7 @@ static void Task_MoveElevatorWindowLights(u8 taskId)
|
||||
for (y = 0; y < 3; y++)
|
||||
{
|
||||
for (x = 0; x < 3; x++)
|
||||
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Ascending[y][data[0] % 3] | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Ascending[y][data[0] % 3] | MAPGRID_COLLISION_MASK);
|
||||
}
|
||||
}
|
||||
// descending
|
||||
@ -1881,7 +1881,7 @@ static void Task_MoveElevatorWindowLights(u8 taskId)
|
||||
for (y = 0; y < 3; y++)
|
||||
{
|
||||
for (x = 0; x < 3; x++)
|
||||
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Descending[y][data[0] % 3] | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Descending[y][data[0] % 3] | MAPGRID_COLLISION_MASK);
|
||||
}
|
||||
}
|
||||
DrawWholeMapView();
|
||||
|
@ -445,8 +445,8 @@ static void PacifidlogBridgePerStepCallback(u8 taskId)
|
||||
|
||||
static void TryLowerFortreeBridge(s16 x, s16 y)
|
||||
{
|
||||
u8 z = PlayerGetZCoord();
|
||||
if (!(z & 1))
|
||||
u8 elevation = PlayerGetElevation();
|
||||
if (!(elevation & 1))
|
||||
{
|
||||
switch (MapGridGetMetatileIdAt(x, y))
|
||||
{
|
||||
@ -462,8 +462,8 @@ static void TryLowerFortreeBridge(s16 x, s16 y)
|
||||
|
||||
static void TryRaiseFortreeBridge(s16 x, s16 y)
|
||||
{
|
||||
u8 z = PlayerGetZCoord();
|
||||
if (!(z & 1))
|
||||
u8 elevation = PlayerGetElevation();
|
||||
if (!(elevation & 1))
|
||||
{
|
||||
switch (MapGridGetMetatileIdAt(x, y))
|
||||
{
|
||||
@ -488,7 +488,7 @@ static void FortreeBridgePerStepCallback(u8 taskId)
|
||||
{
|
||||
bool8 isFortreeBridgeCur;
|
||||
bool8 isFortreeBridgePrev;
|
||||
u8 z, onBridgeElevation;
|
||||
u8 elevation, onBridgeElevation;
|
||||
s16 x, y, prevX, prevY;
|
||||
s16 *data = gTasks[taskId].data;
|
||||
PlayerGetDestCoords(&x, &y);
|
||||
@ -520,9 +520,9 @@ static void FortreeBridgePerStepCallback(u8 taskId)
|
||||
isFortreeBridgePrev = MetatileBehavior_IsFortreeBridge(MapGridGetMetatileBehaviorAt(prevX, prevY));
|
||||
|
||||
// Make sure player isn't below bridge
|
||||
z = PlayerGetZCoord();
|
||||
elevation = PlayerGetElevation();
|
||||
onBridgeElevation = FALSE;
|
||||
if ((u8)(z & 1) == 0)
|
||||
if ((u8)(elevation & 1) == 0)
|
||||
onBridgeElevation = TRUE;
|
||||
|
||||
if (onBridgeElevation && (isFortreeBridgeCur == TRUE || isFortreeBridgePrev == TRUE))
|
||||
|
@ -43,12 +43,12 @@ static void FillWestConnection(struct MapHeader const *mapHeader, struct MapHead
|
||||
static void FillEastConnection(struct MapHeader const *mapHeader, struct MapHeader const *connectedMapHeader, s32 offset);
|
||||
static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader);
|
||||
static void LoadSavedMapView(void);
|
||||
static bool8 SkipCopyingMetatileFromSavedMap(u16* mapMetatilePtr, u16 mapWidth, u8 yMode);
|
||||
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 bool8 IsCoordInIncomingConnectingMap(int coord, int srcMax, int destMax, int offset);
|
||||
|
||||
#define MapGridGetBorderTileAt(x, y) ({ \
|
||||
#define GetBorderBlockAt(x, y)({ \
|
||||
u16 block; \
|
||||
int i; \
|
||||
u16 *border = gMapHeader.mapLayout->border; \
|
||||
@ -56,12 +56,12 @@ static bool8 IsCoordInIncomingConnectingMap(int coord, int srcMax, int destMax,
|
||||
i = (x + 1) & 1; \
|
||||
i += ((y + 1) & 1) * 2; \
|
||||
\
|
||||
block = gMapHeader.mapLayout->border[i] | METATILE_COLLISION_MASK; \
|
||||
block = gMapHeader.mapLayout->border[i] | MAPGRID_COLLISION_MASK; \
|
||||
})
|
||||
|
||||
#define AreCoordsWithinMapGridBounds(x, y) (x >= 0 && x < gBackupMapLayout.width && y >= 0 && y < gBackupMapLayout.height)
|
||||
|
||||
#define MapGridGetTileAt(x, y) (AreCoordsWithinMapGridBounds(x, y) ? gBackupMapLayout.map[x + gBackupMapLayout.width * y] : MapGridGetBorderTileAt(x, y))
|
||||
#define GetMapGridBlockAt(x, y) (AreCoordsWithinMapGridBounds(x, y) ? gBackupMapLayout.map[x + gBackupMapLayout.width * y] : GetBorderBlockAt(x, y))
|
||||
|
||||
struct MapHeader const *const GetMapHeaderFromConnection(struct MapConnection *connection)
|
||||
{
|
||||
@ -87,13 +87,13 @@ void InitMapFromSavedGame(void)
|
||||
|
||||
void InitBattlePyramidMap(bool8 setPlayerPosition)
|
||||
{
|
||||
CpuFastFill(METATILE_ID_UNDEFINED << 16 | METATILE_ID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData));
|
||||
CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData));
|
||||
GenerateBattlePyramidFloorLayout(gBackupMapData, setPlayerPosition);
|
||||
}
|
||||
|
||||
void InitTrainerHillMap(void)
|
||||
{
|
||||
CpuFastFill(METATILE_ID_UNDEFINED << 16 | METATILE_ID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData));
|
||||
CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData));
|
||||
GenerateTrainerHillFloorLayout(gBackupMapData);
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ static void InitMapLayoutData(struct MapHeader *mapHeader)
|
||||
int width;
|
||||
int height;
|
||||
mapLayout = mapHeader->mapLayout;
|
||||
CpuFastFill16(METATILE_ID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData));
|
||||
CpuFastFill16(MAPGRID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData));
|
||||
gBackupMapLayout.map = gBackupMapData;
|
||||
width = mapLayout->width + MAP_OFFSET_W;
|
||||
gBackupMapLayout.width = width;
|
||||
@ -342,46 +342,46 @@ static void FillEastConnection(struct MapHeader const *mapHeader, struct MapHead
|
||||
}
|
||||
}
|
||||
|
||||
u8 MapGridGetZCoordAt(int x, int y)
|
||||
u8 MapGridGetElevationAt(int x, int y)
|
||||
{
|
||||
u16 block = MapGridGetTileAt(x, y);
|
||||
u16 block = GetMapGridBlockAt(x, y);
|
||||
|
||||
if (block == METATILE_ID_UNDEFINED)
|
||||
if (block == MAPGRID_UNDEFINED)
|
||||
return 0;
|
||||
|
||||
return block >> METATILE_ELEVATION_SHIFT;
|
||||
return block >> MAPGRID_ELEVATION_SHIFT;
|
||||
}
|
||||
|
||||
bool8 MapGridIsImpassableAt(int x, int y)
|
||||
{
|
||||
u16 block = MapGridGetTileAt(x, y);
|
||||
u16 block = GetMapGridBlockAt(x, y);
|
||||
|
||||
if (block == METATILE_ID_UNDEFINED)
|
||||
if (block == MAPGRID_UNDEFINED)
|
||||
return TRUE;
|
||||
|
||||
return (block & METATILE_COLLISION_MASK) >> METATILE_COLLISION_SHIFT;
|
||||
return (block & MAPGRID_COLLISION_MASK) >> MAPGRID_COLLISION_SHIFT;
|
||||
}
|
||||
|
||||
u32 MapGridGetMetatileIdAt(int x, int y)
|
||||
{
|
||||
u16 block = MapGridGetTileAt(x, y);
|
||||
u16 block = GetMapGridBlockAt(x, y);
|
||||
|
||||
if (block == METATILE_ID_UNDEFINED)
|
||||
return MapGridGetBorderTileAt(x, y) & METATILE_ID_MASK;
|
||||
if (block == MAPGRID_UNDEFINED)
|
||||
return GetBorderBlockAt(x, y) & MAPGRID_METATILE_ID_MASK;
|
||||
|
||||
return block & METATILE_ID_MASK;
|
||||
return block & MAPGRID_METATILE_ID_MASK;
|
||||
}
|
||||
|
||||
u32 MapGridGetMetatileBehaviorAt(int x, int y)
|
||||
{
|
||||
u16 metatile = MapGridGetMetatileIdAt(x, y);
|
||||
return GetBehaviorByMetatileId(metatile) & METATILE_BEHAVIOR_MASK;
|
||||
return GetMetatileAttributesById(metatile) & METATILE_ATTR_BEHAVIOR_MASK;
|
||||
}
|
||||
|
||||
u8 MapGridGetMetatileLayerTypeAt(int x, int y)
|
||||
{
|
||||
u16 metatile = MapGridGetMetatileIdAt(x, y);
|
||||
return (GetBehaviorByMetatileId(metatile) & METATILE_ELEVATION_MASK) >> METATILE_ELEVATION_SHIFT;
|
||||
return (GetMetatileAttributesById(metatile) & METATILE_ATTR_LAYER_MASK) >> METATILE_ATTR_LAYER_SHIFT;
|
||||
}
|
||||
|
||||
void MapGridSetMetatileIdAt(int x, int y, u16 metatile)
|
||||
@ -390,7 +390,7 @@ void MapGridSetMetatileIdAt(int x, int y, u16 metatile)
|
||||
if (AreCoordsWithinMapGridBounds(x, y))
|
||||
{
|
||||
i = x + y * gBackupMapLayout.width;
|
||||
gBackupMapLayout.map[i] = (gBackupMapLayout.map[i] & METATILE_ELEVATION_MASK) | (metatile & ~METATILE_ELEVATION_MASK);
|
||||
gBackupMapLayout.map[i] = (gBackupMapLayout.map[i] & MAPGRID_ELEVATION_MASK) | (metatile & ~MAPGRID_ELEVATION_MASK);
|
||||
}
|
||||
}
|
||||
|
||||
@ -404,7 +404,7 @@ void MapGridSetMetatileEntryAt(int x, int y, u16 metatile)
|
||||
}
|
||||
}
|
||||
|
||||
u16 GetBehaviorByMetatileId(u16 metatile)
|
||||
u16 GetMetatileAttributesById(u16 metatile)
|
||||
{
|
||||
u16 *attributes;
|
||||
if (metatile < NUM_METATILES_IN_PRIMARY)
|
||||
@ -565,7 +565,7 @@ static void MoveMapViewToBackup(u8 direction)
|
||||
|
||||
int GetMapBorderIdAt(int x, int y)
|
||||
{
|
||||
if (MapGridGetTileAt(x, y) == METATILE_ID_UNDEFINED)
|
||||
if (GetMapGridBlockAt(x, y) == MAPGRID_UNDEFINED)
|
||||
return CONNECTION_INVALID;
|
||||
|
||||
if (x >= (gBackupMapLayout.width - (MAP_OFFSET + 1)))
|
||||
@ -817,23 +817,23 @@ void MapGridSetMetatileImpassabilityAt(int x, int y, bool32 impassable)
|
||||
if (AreCoordsWithinMapGridBounds(x, y))
|
||||
{
|
||||
if (impassable)
|
||||
gBackupMapLayout.map[x + gBackupMapLayout.width * y] |= METATILE_COLLISION_MASK;
|
||||
gBackupMapLayout.map[x + gBackupMapLayout.width * y] |= MAPGRID_COLLISION_MASK;
|
||||
else
|
||||
gBackupMapLayout.map[x + gBackupMapLayout.width * y] &= ~METATILE_COLLISION_MASK;
|
||||
gBackupMapLayout.map[x + gBackupMapLayout.width * y] &= ~MAPGRID_COLLISION_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
static bool8 SkipCopyingMetatileFromSavedMap(u16* mapMetatilePtr, u16 mapWidth, u8 yMode)
|
||||
static bool8 SkipCopyingMetatileFromSavedMap(u16* mapBlock, u16 mapWidth, u8 yMode)
|
||||
{
|
||||
if (yMode == 0xFF)
|
||||
return FALSE;
|
||||
|
||||
if (yMode == 0)
|
||||
mapMetatilePtr -= mapWidth;
|
||||
mapBlock -= mapWidth;
|
||||
else
|
||||
mapMetatilePtr += mapWidth;
|
||||
mapBlock += mapWidth;
|
||||
|
||||
if (IsLargeBreakableDecoration(*mapMetatilePtr & METATILE_ID_MASK, yMode) == TRUE)
|
||||
if (IsLargeBreakableDecoration(*mapBlock & MAPGRID_METATILE_ID_MASK, yMode) == TRUE)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ bool8 SetUpFieldMove_Cut(void)
|
||||
for (j = 0; j < CUT_NORMAL_SIDE; j++)
|
||||
{
|
||||
x = j - 1 + gPlayerFacingPosition.x;
|
||||
if (MapGridGetZCoordAt(x, y) == gPlayerFacingPosition.height)
|
||||
if (MapGridGetElevationAt(x, y) == gPlayerFacingPosition.elevation)
|
||||
{
|
||||
tileBehavior = MapGridGetMetatileBehaviorAt(x, y);
|
||||
if (MetatileBehavior_IsPokeGrass(tileBehavior) == TRUE
|
||||
@ -238,7 +238,7 @@ bool8 SetUpFieldMove_Cut(void)
|
||||
|
||||
if (tileCuttable == TRUE)
|
||||
{
|
||||
if (MapGridGetZCoordAt(x, y) == gPlayerFacingPosition.height)
|
||||
if (MapGridGetElevationAt(x, y) == gPlayerFacingPosition.elevation)
|
||||
{
|
||||
u8 tileArrayId = ((sHyperCutStruct[i].y * 5) + 12) + (sHyperCutStruct[i].x);
|
||||
tileBehavior = MapGridGetMetatileBehaviorAt(x, y);
|
||||
|
@ -126,13 +126,13 @@ static void Task_DrawEscalator(u8 taskId)
|
||||
SetEscalatorMetatile(taskId, sEscalatorMetatiles_1F_1, 0);
|
||||
break;
|
||||
case 2:
|
||||
SetEscalatorMetatile(taskId, sEscalatorMetatiles_1F_2, METATILE_COLLISION_MASK);
|
||||
SetEscalatorMetatile(taskId, sEscalatorMetatiles_1F_2, MAPGRID_COLLISION_MASK);
|
||||
break;
|
||||
case 3:
|
||||
SetEscalatorMetatile(taskId, sEscalatorMetatiles_1F_3, 0);
|
||||
break;
|
||||
case 4:
|
||||
SetEscalatorMetatile(taskId, sEscalatorMetatiles_2F_0, METATILE_COLLISION_MASK);
|
||||
SetEscalatorMetatile(taskId, sEscalatorMetatiles_2F_0, MAPGRID_COLLISION_MASK);
|
||||
break;
|
||||
case 5:
|
||||
SetEscalatorMetatile(taskId, sEscalatorMetatiles_2F_1, 0);
|
||||
|
@ -840,9 +840,9 @@ void DoSecretBasePCTurnOffEffect(void)
|
||||
PlaySE(SE_PC_OFF);
|
||||
|
||||
if (!VarGet(VAR_CURRENT_SECRET_BASE))
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_SecretBase_PC | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_SecretBase_PC | MAPGRID_COLLISION_MASK);
|
||||
else
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_SecretBase_RegisterPC | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_SecretBase_RegisterPC | MAPGRID_COLLISION_MASK);
|
||||
|
||||
CurrentMapDrawMetatileAt(x, y);
|
||||
}
|
||||
@ -1083,7 +1083,7 @@ static void SpriteCB_SandPillar_BreakTop(struct Sprite *sprite)
|
||||
PlaySE(SE_M_ROCK_THROW);
|
||||
|
||||
if (MapGridGetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6] - 1) == METATILE_SecretBase_SandOrnament_TopWall)
|
||||
MapGridSetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6] - 1, METATILE_SecretBase_Wall_TopMid | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6] - 1, METATILE_SecretBase_Wall_TopMid | MAPGRID_COLLISION_MASK);
|
||||
else
|
||||
MapGridSetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6] - 1, METATILE_SecretBase_SandOrnament_BrokenTop);
|
||||
|
||||
@ -1103,7 +1103,7 @@ static void SpriteCB_SandPillar_BreakBase(struct Sprite *sprite)
|
||||
}
|
||||
else
|
||||
{
|
||||
MapGridSetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6], METATILE_SecretBase_SandOrnament_BrokenBase | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(gFieldEffectArguments[5], gFieldEffectArguments[6], METATILE_SecretBase_SandOrnament_BrokenBase | MAPGRID_COLLISION_MASK);
|
||||
CurrentMapDrawMetatileAt(gFieldEffectArguments[5], gFieldEffectArguments[6]);
|
||||
sprite->data[0] = 0;
|
||||
sprite->callback = SpriteCB_SandPillar_End;
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "constants/map_types.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
// static functions
|
||||
static void Task_DoFieldMove_Init(u8 taskId);
|
||||
static void Task_DoFieldMove_ShowMonAfterPose(u8 taskId);
|
||||
static void Task_DoFieldMove_WaitForMon(u8 taskId);
|
||||
@ -28,14 +27,13 @@ static void Task_DoFieldMove_RunFunc(u8 taskId);
|
||||
static void FieldCallback_RockSmash(void);
|
||||
static void FieldMove_RockSmash(void);
|
||||
|
||||
// text
|
||||
bool8 CheckObjectGraphicsInFrontOfPlayer(u8 graphicsId)
|
||||
{
|
||||
u8 objEventId;
|
||||
|
||||
GetXYCoordsOneStepInFrontOfPlayer(&gPlayerFacingPosition.x, &gPlayerFacingPosition.y);
|
||||
gPlayerFacingPosition.height = PlayerGetZCoord();
|
||||
objEventId = GetObjectEventIdByXYZ(gPlayerFacingPosition.x, gPlayerFacingPosition.y, gPlayerFacingPosition.height);
|
||||
gPlayerFacingPosition.elevation = PlayerGetElevation();
|
||||
objEventId = GetObjectEventIdByPosition(gPlayerFacingPosition.x, gPlayerFacingPosition.y, gPlayerFacingPosition.elevation);
|
||||
if (gObjectEvents[objEventId].graphicsId != graphicsId)
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -725,11 +725,11 @@ static void ItemUseOnFieldCB_WailmerPailBerry(u8 taskId)
|
||||
static bool8 TryToWaterSudowoodo(void)
|
||||
{
|
||||
u16 x, y;
|
||||
u8 z;
|
||||
u8 elevation;
|
||||
u8 objId;
|
||||
GetXYCoordsOneStepInFrontOfPlayer(&x, &y);
|
||||
z = PlayerGetZCoord();
|
||||
objId = GetObjectEventIdByXYZ(x, y, z);
|
||||
elevation = PlayerGetElevation();
|
||||
objId = GetObjectEventIdByPosition(x, y, elevation);
|
||||
if (objId == OBJECT_EVENTS_COUNT || gObjectEvents[objId].graphicsId != OBJ_EVENT_GFX_SUDOWOODO)
|
||||
return FALSE;
|
||||
else
|
||||
|
@ -2,254 +2,129 @@
|
||||
#include "metatile_behavior.h"
|
||||
#include "constants/metatile_behaviors.h"
|
||||
|
||||
#define TILE_FLAG_ENCOUNTER_TILE 1
|
||||
#define TILE_FLAG_SURFABLE 2
|
||||
#define TILE_FLAG_HAS_ENCOUNTERS (1 << 0)
|
||||
#define TILE_FLAG_SURFABLE (1 << 1)
|
||||
#define TILE_FLAG_UNUSED (1 << 2) // Roughly all of the traversable metatiles. Set but never read
|
||||
|
||||
#define TILE_ATTRIBUTES(unused, surfable, wildEncounter) (((wildEncounter) ? 1 : 0) | ((surfable) ? 2 : 0) | ((unused) ? 4 : 0))
|
||||
|
||||
// wonder what the third flag is supposed to do
|
||||
static const u8 sTileBitAttributes[] =
|
||||
static const u8 sTileBitAttributes[NUM_METATILE_BEHAVIORS] =
|
||||
{
|
||||
[MB_NORMAL] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_WALL] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_TALL_GRASS] = TILE_ATTRIBUTES(TRUE, FALSE, TRUE),
|
||||
[MB_LONG_GRASS] = TILE_ATTRIBUTES(TRUE, FALSE, TRUE),
|
||||
[MB_UNUSED_04] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_05] = TILE_ATTRIBUTES(FALSE, FALSE, TRUE),
|
||||
[MB_DEEP_SAND] = TILE_ATTRIBUTES(TRUE, FALSE, TRUE),
|
||||
[MB_SHORT_GRASS] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_UNUSED_CAVE] = TILE_ATTRIBUTES(TRUE, FALSE, TRUE),
|
||||
[MB_LONG_GRASS_SOUTH_EDGE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_NO_RUNNING] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_INDOOR_ENCOUNTER] = TILE_ATTRIBUTES(TRUE, FALSE, TRUE),
|
||||
[MB_MOUNTAIN_TOP] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_BATTLE_PYRAMID_WARP] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_MOSSDEEP_GYM_WARP] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_MT_PYRE_HOLE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_POND_WATER] = TILE_ATTRIBUTES(TRUE, TRUE, TRUE),
|
||||
[MB_SEMI_DEEP_WATER] = TILE_ATTRIBUTES(TRUE, TRUE, TRUE),
|
||||
[MB_DEEP_WATER] = TILE_ATTRIBUTES(TRUE, TRUE, TRUE),
|
||||
[MB_WATERFALL] = TILE_ATTRIBUTES(TRUE, TRUE, FALSE),
|
||||
[MB_SOOTOPOLIS_DEEP_WATER] = TILE_ATTRIBUTES(TRUE, TRUE, FALSE),
|
||||
[MB_OCEAN_WATER] = TILE_ATTRIBUTES(TRUE, TRUE, TRUE),
|
||||
[MB_PUDDLE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SHALLOW_WATER] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_UNUSED_SOOTOPOLIS_DEEP_WATER] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_NO_SURFACING] = TILE_ATTRIBUTES(TRUE, TRUE, FALSE),
|
||||
[MB_UNUSED_SOOTOPOLIS_DEEP_WATER_2] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_STAIRS_OUTSIDE_ABANDONED_SHIP] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SHOAL_CAVE_ENTRANCE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_UNUSED_1D] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_1E] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_1F] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_ICE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SAND] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SEAWEED] = TILE_ATTRIBUTES(TRUE, TRUE, TRUE),
|
||||
[MB_UNUSED_23] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_ASHGRASS] = TILE_ATTRIBUTES(TRUE, FALSE, TRUE),
|
||||
[MB_FOOTPRINTS] = TILE_ATTRIBUTES(TRUE, FALSE, TRUE),
|
||||
[MB_THIN_ICE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_CRACKED_ICE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_HOT_SPRINGS] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_LAVARIDGE_GYM_B1F_WARP] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SEAWEED_NO_SURFACING] = TILE_ATTRIBUTES(TRUE, TRUE, TRUE),
|
||||
[MB_REFLECTION_UNDER_BRIDGE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_UNUSED_2C] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_2D] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_2E] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_2F] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_IMPASSABLE_EAST] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_IMPASSABLE_WEST] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_IMPASSABLE_NORTH] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_IMPASSABLE_SOUTH] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_IMPASSABLE_NORTHEAST] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_IMPASSABLE_NORTHWEST] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_IMPASSABLE_SOUTHEAST] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_IMPASSABLE_SOUTHWEST] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_JUMP_EAST] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_JUMP_WEST] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_JUMP_NORTH] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_JUMP_SOUTH] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_JUMP_NORTHEAST] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_JUMP_NORTHWEST] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_JUMP_SOUTHEAST] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_JUMP_SOUTHWEST] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_WALK_EAST] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_WALK_WEST] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_WALK_NORTH] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_WALK_SOUTH] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SLIDE_EAST] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SLIDE_WEST] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SLIDE_NORTH] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SLIDE_SOUTH] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_TRICK_HOUSE_PUZZLE_8_FLOOR] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_UNUSED_49] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_UNUSED_4A] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_UNUSED_4B] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_4C] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_4D] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_4E] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_4F] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_EASTWARD_CURRENT] = TILE_ATTRIBUTES(TRUE, TRUE, FALSE),
|
||||
[MB_WESTWARD_CURRENT] = TILE_ATTRIBUTES(TRUE, TRUE, FALSE),
|
||||
[MB_NORTHWARD_CURRENT] = TILE_ATTRIBUTES(TRUE, TRUE, FALSE),
|
||||
[MB_SOUTHWARD_CURRENT] = TILE_ATTRIBUTES(TRUE, TRUE, FALSE),
|
||||
[MB_UNUSED_54] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_55] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_56] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_57] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_58] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_59] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_5A] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_5B] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_5C] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_5D] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_5E] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_5F] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_NON_ANIMATED_DOOR] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_LADDER] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_EAST_ARROW_WARP] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_WEST_ARROW_WARP] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_NORTH_ARROW_WARP] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SOUTH_ARROW_WARP] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_CRACKED_FLOOR_HOLE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_AQUA_HIDEOUT_WARP] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_LAVARIDGE_GYM_1F_WARP] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_ANIMATED_DOOR] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_UP_ESCALATOR] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_DOWN_ESCALATOR] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_WATER_DOOR] = TILE_ATTRIBUTES(TRUE, TRUE, FALSE),
|
||||
[MB_WATER_SOUTH_ARROW_WARP] = TILE_ATTRIBUTES(TRUE, TRUE, FALSE),
|
||||
[MB_DEEP_SOUTH_WARP] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_UNUSED_6F] = TILE_ATTRIBUTES(TRUE, TRUE, FALSE),
|
||||
[MB_BRIDGE_OVER_OCEAN] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_BRIDGE_OVER_POND_LOW] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_BRIDGE_OVER_POND_MED] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_BRIDGE_OVER_POND_HIGH] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_PACIFIDLOG_VERTICAL_LOG_TOP] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_PACIFIDLOG_VERTICAL_LOG_BOTTOM] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_PACIFIDLOG_HORIZONTAL_LOG_LEFT] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_PACIFIDLOG_HORIZONTAL_LOG_RIGHT] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_FORTREE_BRIDGE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_UNUSED_79] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_BRIDGE_OVER_POND_MED_EDGE_1] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_BRIDGE_OVER_POND_MED_EDGE_2] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_BRIDGE_OVER_POND_HIGH_EDGE_1] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_BRIDGE_OVER_POND_HIGH_EDGE_2] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_UNUSED_BRIDGE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_BIKE_BRIDGE_OVER_BARRIER] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_COUNTER] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_81] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_82] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_PC] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_CABLE_BOX_RESULTS_1] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_REGION_MAP] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_TELEVISION] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_POKEBLOCK_FEEDER] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_88] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SLOT_MACHINE] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_ROULETTE] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_CLOSED_SOOTOPOLIS_DOOR] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_TRICK_HOUSE_PUZZLE_DOOR] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_PETALBURG_GYM_DOOR] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_RUNNING_SHOES_INSTRUCTION] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_QUESTIONNAIRE] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_SPOT_RED_CAVE] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_SPOT_RED_CAVE_OPEN] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_SPOT_BROWN_CAVE] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_SPOT_BROWN_CAVE_OPEN] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_SPOT_YELLOW_CAVE] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_SPOT_YELLOW_CAVE_OPEN] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_SPOT_TREE_LEFT] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_SPOT_TREE_LEFT_OPEN] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_SPOT_SHRUB] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_SPOT_SHRUB_OPEN] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_SPOT_BLUE_CAVE] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_SPOT_BLUE_CAVE_OPEN] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_SPOT_TREE_RIGHT] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_SPOT_TREE_RIGHT_OPEN] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_9E] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_9F] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_BERRY_TREE_SOIL] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_A1] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_A2] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_A3] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_A4] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_A5] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_A6] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_A7] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_A8] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_A9] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_AA] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_AB] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_AC] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_AD] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_AE] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_AF] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_PC] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_REGISTER_PC] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_UNUSED] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_BLOCK_DECORATION] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_DECORATION] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_HOLDS_SMALL_DECORATION] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_UNUSED_B6] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_NORTH_WALL] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_BALLOON] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_IMPASSABLE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_GLITTER_MAT] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_JUMP_MAT] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_SPIN_MAT] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_SOUND_MAT] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_BREAKABLE_DOOR] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_SAND_ORNAMENT] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_IMPASSABLE_SOUTH_AND_NORTH] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_IMPASSABLE_WEST_AND_EAST] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_HOLE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_HOLDS_LARGE_DECORATION] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_TV_SHIELD] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_PLAYER_ROOM_PC_ON] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_DECORATION_BASE] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SECRET_BASE_POSTER] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_C8] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_C9] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_CA] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_CB] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_CC] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_CD] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_CE] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_CF] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_MUDDY_SLOPE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_BUMPY_SLOPE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_CRACKED_FLOOR] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_ISOLATED_VERTICAL_RAIL] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_ISOLATED_HORIZONTAL_RAIL] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_VERTICAL_RAIL] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_HORIZONTAL_RAIL] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_UNUSED_D7] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_D8] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_D9] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_DA] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_DB] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_DC] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_DD] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_DE] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_DF] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_PICTURE_BOOK_SHELF] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_BOOKSHELF] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_POKEMON_CENTER_BOOKSHELF] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_VASE] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_TRASH_CAN] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SHOP_SHELF] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_BLUEPRINT] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_CABLE_BOX_RESULTS_2] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_WIRELESS_BOX_RESULTS] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_TRAINER_HILL_TIMER] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SKY_PILLAR_CLOSED_DOOR] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_EB] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_EC] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_ED] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_EE] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_EF] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_NORMAL] = TILE_FLAG_UNUSED,
|
||||
[MB_TALL_GRASS] = TILE_FLAG_UNUSED | TILE_FLAG_HAS_ENCOUNTERS,
|
||||
[MB_LONG_GRASS] = TILE_FLAG_UNUSED | TILE_FLAG_HAS_ENCOUNTERS,
|
||||
[MB_UNUSED_05] = TILE_FLAG_HAS_ENCOUNTERS,
|
||||
[MB_DEEP_SAND] = TILE_FLAG_UNUSED | TILE_FLAG_HAS_ENCOUNTERS,
|
||||
[MB_SHORT_GRASS] = TILE_FLAG_UNUSED,
|
||||
[MB_CAVE] = TILE_FLAG_UNUSED | TILE_FLAG_HAS_ENCOUNTERS,
|
||||
[MB_LONG_GRASS_SOUTH_EDGE] = TILE_FLAG_UNUSED,
|
||||
[MB_NO_RUNNING] = TILE_FLAG_UNUSED,
|
||||
[MB_INDOOR_ENCOUNTER] = TILE_FLAG_UNUSED | TILE_FLAG_HAS_ENCOUNTERS,
|
||||
[MB_MOUNTAIN_TOP] = TILE_FLAG_UNUSED,
|
||||
[MB_BATTLE_PYRAMID_WARP] = TILE_FLAG_UNUSED,
|
||||
[MB_MOSSDEEP_GYM_WARP] = TILE_FLAG_UNUSED,
|
||||
[MB_MT_PYRE_HOLE] = TILE_FLAG_UNUSED,
|
||||
[MB_POND_WATER] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE | TILE_FLAG_HAS_ENCOUNTERS,
|
||||
[MB_SEMI_DEEP_WATER] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE | TILE_FLAG_HAS_ENCOUNTERS,
|
||||
[MB_DEEP_WATER] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE | TILE_FLAG_HAS_ENCOUNTERS,
|
||||
[MB_WATERFALL] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
|
||||
[MB_SOOTOPOLIS_DEEP_WATER] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
|
||||
[MB_OCEAN_WATER] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE | TILE_FLAG_HAS_ENCOUNTERS,
|
||||
[MB_PUDDLE] = TILE_FLAG_UNUSED,
|
||||
[MB_SHALLOW_WATER] = TILE_FLAG_UNUSED,
|
||||
[MB_NO_SURFACING] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
|
||||
[MB_STAIRS_OUTSIDE_ABANDONED_SHIP] = TILE_FLAG_UNUSED,
|
||||
[MB_SHOAL_CAVE_ENTRANCE] = TILE_FLAG_UNUSED,
|
||||
[MB_ICE] = TILE_FLAG_UNUSED,
|
||||
[MB_SAND] = TILE_FLAG_UNUSED,
|
||||
[MB_SEAWEED] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE | TILE_FLAG_HAS_ENCOUNTERS,
|
||||
[MB_UNUSED_23] = TILE_FLAG_UNUSED,
|
||||
[MB_ASHGRASS] = TILE_FLAG_UNUSED | TILE_FLAG_HAS_ENCOUNTERS,
|
||||
[MB_FOOTPRINTS] = TILE_FLAG_UNUSED | TILE_FLAG_HAS_ENCOUNTERS,
|
||||
[MB_THIN_ICE] = TILE_FLAG_UNUSED,
|
||||
[MB_CRACKED_ICE] = TILE_FLAG_UNUSED,
|
||||
[MB_HOT_SPRINGS] = TILE_FLAG_UNUSED,
|
||||
[MB_LAVARIDGE_GYM_B1F_WARP] = TILE_FLAG_UNUSED,
|
||||
[MB_SEAWEED_NO_SURFACING] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE | TILE_FLAG_HAS_ENCOUNTERS,
|
||||
[MB_REFLECTION_UNDER_BRIDGE] = TILE_FLAG_UNUSED,
|
||||
[MB_IMPASSABLE_EAST] = TILE_FLAG_UNUSED,
|
||||
[MB_IMPASSABLE_WEST] = TILE_FLAG_UNUSED,
|
||||
[MB_IMPASSABLE_NORTH] = TILE_FLAG_UNUSED,
|
||||
[MB_IMPASSABLE_SOUTH] = TILE_FLAG_UNUSED,
|
||||
[MB_IMPASSABLE_NORTHEAST] = TILE_FLAG_UNUSED,
|
||||
[MB_IMPASSABLE_NORTHWEST] = TILE_FLAG_UNUSED,
|
||||
[MB_IMPASSABLE_SOUTHEAST] = TILE_FLAG_UNUSED,
|
||||
[MB_IMPASSABLE_SOUTHWEST] = TILE_FLAG_UNUSED,
|
||||
[MB_JUMP_NORTHEAST] = TILE_FLAG_UNUSED,
|
||||
[MB_JUMP_NORTHWEST] = TILE_FLAG_UNUSED,
|
||||
[MB_JUMP_SOUTHEAST] = TILE_FLAG_UNUSED,
|
||||
[MB_JUMP_SOUTHWEST] = TILE_FLAG_UNUSED,
|
||||
[MB_WALK_EAST] = TILE_FLAG_UNUSED,
|
||||
[MB_WALK_WEST] = TILE_FLAG_UNUSED,
|
||||
[MB_WALK_NORTH] = TILE_FLAG_UNUSED,
|
||||
[MB_WALK_SOUTH] = TILE_FLAG_UNUSED,
|
||||
[MB_SLIDE_EAST] = TILE_FLAG_UNUSED,
|
||||
[MB_SLIDE_WEST] = TILE_FLAG_UNUSED,
|
||||
[MB_SLIDE_NORTH] = TILE_FLAG_UNUSED,
|
||||
[MB_SLIDE_SOUTH] = TILE_FLAG_UNUSED,
|
||||
[MB_TRICK_HOUSE_PUZZLE_8_FLOOR] = TILE_FLAG_UNUSED,
|
||||
[MB_UNUSED_49] = TILE_FLAG_UNUSED,
|
||||
[MB_UNUSED_4A] = TILE_FLAG_UNUSED,
|
||||
[MB_EASTWARD_CURRENT] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
|
||||
[MB_WESTWARD_CURRENT] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
|
||||
[MB_NORTHWARD_CURRENT] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
|
||||
[MB_SOUTHWARD_CURRENT] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
|
||||
[MB_NON_ANIMATED_DOOR] = TILE_FLAG_UNUSED,
|
||||
[MB_LADDER] = TILE_FLAG_UNUSED,
|
||||
[MB_EAST_ARROW_WARP] = TILE_FLAG_UNUSED,
|
||||
[MB_WEST_ARROW_WARP] = TILE_FLAG_UNUSED,
|
||||
[MB_NORTH_ARROW_WARP] = TILE_FLAG_UNUSED,
|
||||
[MB_SOUTH_ARROW_WARP] = TILE_FLAG_UNUSED,
|
||||
[MB_CRACKED_FLOOR_HOLE] = TILE_FLAG_UNUSED,
|
||||
[MB_AQUA_HIDEOUT_WARP] = TILE_FLAG_UNUSED,
|
||||
[MB_LAVARIDGE_GYM_1F_WARP] = TILE_FLAG_UNUSED,
|
||||
[MB_ANIMATED_DOOR] = TILE_FLAG_UNUSED,
|
||||
[MB_UP_ESCALATOR] = TILE_FLAG_UNUSED,
|
||||
[MB_DOWN_ESCALATOR] = TILE_FLAG_UNUSED,
|
||||
[MB_WATER_DOOR] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
|
||||
[MB_WATER_SOUTH_ARROW_WARP] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
|
||||
[MB_DEEP_SOUTH_WARP] = TILE_FLAG_UNUSED,
|
||||
[MB_UNUSED_6F] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
|
||||
[MB_BRIDGE_OVER_POND_LOW] = TILE_FLAG_UNUSED,
|
||||
[MB_BRIDGE_OVER_POND_MED] = TILE_FLAG_UNUSED,
|
||||
[MB_BRIDGE_OVER_POND_HIGH] = TILE_FLAG_UNUSED,
|
||||
[MB_PACIFIDLOG_VERTICAL_LOG_TOP] = TILE_FLAG_UNUSED,
|
||||
[MB_PACIFIDLOG_VERTICAL_LOG_BOTTOM] = TILE_FLAG_UNUSED,
|
||||
[MB_PACIFIDLOG_HORIZONTAL_LOG_LEFT] = TILE_FLAG_UNUSED,
|
||||
[MB_PACIFIDLOG_HORIZONTAL_LOG_RIGHT] = TILE_FLAG_UNUSED,
|
||||
[MB_FORTREE_BRIDGE] = TILE_FLAG_UNUSED,
|
||||
[MB_BRIDGE_OVER_POND_MED_EDGE_1] = TILE_FLAG_UNUSED,
|
||||
[MB_BRIDGE_OVER_POND_MED_EDGE_2] = TILE_FLAG_UNUSED,
|
||||
[MB_BRIDGE_OVER_POND_HIGH_EDGE_1] = TILE_FLAG_UNUSED,
|
||||
[MB_BRIDGE_OVER_POND_HIGH_EDGE_2] = TILE_FLAG_UNUSED,
|
||||
[MB_UNUSED_BRIDGE] = TILE_FLAG_UNUSED,
|
||||
[MB_BIKE_BRIDGE_OVER_BARRIER] = TILE_FLAG_UNUSED,
|
||||
[MB_SECRET_BASE_SCENERY] = TILE_FLAG_UNUSED,
|
||||
[MB_SECRET_BASE_TRAINER_SPOT] = TILE_FLAG_UNUSED,
|
||||
[MB_HOLDS_SMALL_DECORATION] = TILE_FLAG_UNUSED,
|
||||
[MB_SECRET_BASE_BALLOON] = TILE_FLAG_UNUSED,
|
||||
[MB_SECRET_BASE_IMPASSABLE] = TILE_FLAG_UNUSED,
|
||||
[MB_SECRET_BASE_GLITTER_MAT] = TILE_FLAG_UNUSED,
|
||||
[MB_SECRET_BASE_JUMP_MAT] = TILE_FLAG_UNUSED,
|
||||
[MB_SECRET_BASE_SPIN_MAT] = TILE_FLAG_UNUSED,
|
||||
[MB_SECRET_BASE_SOUND_MAT] = TILE_FLAG_UNUSED,
|
||||
[MB_SECRET_BASE_BREAKABLE_DOOR] = TILE_FLAG_UNUSED,
|
||||
[MB_IMPASSABLE_SOUTH_AND_NORTH] = TILE_FLAG_UNUSED,
|
||||
[MB_IMPASSABLE_WEST_AND_EAST] = TILE_FLAG_UNUSED,
|
||||
[MB_SECRET_BASE_HOLE] = TILE_FLAG_UNUSED,
|
||||
[MB_HOLDS_LARGE_DECORATION] = TILE_FLAG_UNUSED,
|
||||
[MB_SECRET_BASE_TV_SHIELD] = TILE_FLAG_UNUSED,
|
||||
[MB_PLAYER_ROOM_PC_ON] = TILE_FLAG_UNUSED,
|
||||
[MB_MUDDY_SLOPE] = TILE_FLAG_UNUSED,
|
||||
[MB_BUMPY_SLOPE] = TILE_FLAG_UNUSED,
|
||||
[MB_CRACKED_FLOOR] = TILE_FLAG_UNUSED,
|
||||
[MB_ISOLATED_VERTICAL_RAIL] = TILE_FLAG_UNUSED,
|
||||
[MB_ISOLATED_HORIZONTAL_RAIL] = TILE_FLAG_UNUSED,
|
||||
[MB_VERTICAL_RAIL] = TILE_FLAG_UNUSED,
|
||||
[MB_HORIZONTAL_RAIL] = TILE_FLAG_UNUSED,
|
||||
};
|
||||
|
||||
bool8 MetatileBehavior_IsATile(u8 metatileBehavior)
|
||||
@ -259,7 +134,7 @@ bool8 MetatileBehavior_IsATile(u8 metatileBehavior)
|
||||
|
||||
bool8 MetatileBehavior_IsEncounterTile(u8 metatileBehavior)
|
||||
{
|
||||
if ((sTileBitAttributes[metatileBehavior] & TILE_FLAG_ENCOUNTER_TILE))
|
||||
if ((sTileBitAttributes[metatileBehavior] & TILE_FLAG_HAS_ENCOUNTERS))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@ -687,17 +562,19 @@ bool8 MetatileBehavior_IsRecordMixingSecretBasePC(u8 metatileBehavior)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 Unref_MetatileBehavior_IsSecretBaseUnused_B2(u8 metatileBehavior)
|
||||
// Used by the rock/grass floor spaces that the secret base trainer is not standing on
|
||||
bool8 MetatileBehavior_IsSecretBaseScenery1(u8 metatileBehavior)
|
||||
{
|
||||
if (metatileBehavior == MB_SECRET_BASE_UNUSED)
|
||||
if (metatileBehavior == MB_SECRET_BASE_SCENERY)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MetatileBehavior_IsBlockDecoration(u8 metatileBehavior)
|
||||
// Used by the rock/grass floor space that the secret base trainer stands on
|
||||
bool8 MetatileBehavior_IsSecretBaseTrainerSpot(u8 metatileBehavior)
|
||||
{
|
||||
if (metatileBehavior == MB_BLOCK_DECORATION)
|
||||
if (metatileBehavior == MB_SECRET_BASE_TRAINER_SPOT)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@ -743,9 +620,9 @@ bool8 MetatileBehavior_IsSecretBaseNorthWall(u8 metatileBehavior)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 Unref_MetatileBehavior_IsSecretBaseUnused_B2_2(u8 metatileBehavior)
|
||||
bool8 MetatileBehavior_IsSecretBaseScenery2(u8 metatileBehavior)
|
||||
{
|
||||
if (metatileBehavior == MB_SECRET_BASE_UNUSED)
|
||||
if (metatileBehavior == MB_SECRET_BASE_SCENERY)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
@ -183,9 +183,9 @@ static u16 (*sPlayerKeyInterceptCallback)(u32);
|
||||
static bool8 sReceivingFromLink;
|
||||
static u8 sRfuKeepAliveTimer;
|
||||
|
||||
u16 *gBGTilemapBuffers1;
|
||||
u16 *gBGTilemapBuffers2;
|
||||
u16 *gBGTilemapBuffers3;
|
||||
u16 *gOverworldTilemapBuffer_Bg2;
|
||||
u16 *gOverworldTilemapBuffer_Bg1;
|
||||
u16 *gOverworldTilemapBuffer_Bg3;
|
||||
u16 gHeldKeyCodeToSend;
|
||||
void (*gFieldCallback)(void);
|
||||
bool8 (*gFieldCallback2)(void);
|
||||
@ -1394,12 +1394,12 @@ static void InitOverworldBgs(void)
|
||||
SetBgAttribute(1, BG_ATTR_MOSAIC, 1);
|
||||
SetBgAttribute(2, BG_ATTR_MOSAIC, 1);
|
||||
SetBgAttribute(3, BG_ATTR_MOSAIC, 1);
|
||||
gBGTilemapBuffers2 = AllocZeroed(BG_SCREEN_SIZE);
|
||||
gBGTilemapBuffers1 = AllocZeroed(BG_SCREEN_SIZE);
|
||||
gBGTilemapBuffers3 = AllocZeroed(BG_SCREEN_SIZE);
|
||||
SetBgTilemapBuffer(1, gBGTilemapBuffers2);
|
||||
SetBgTilemapBuffer(2, gBGTilemapBuffers1);
|
||||
SetBgTilemapBuffer(3, gBGTilemapBuffers3);
|
||||
gOverworldTilemapBuffer_Bg1 = AllocZeroed(BG_SCREEN_SIZE);
|
||||
gOverworldTilemapBuffer_Bg2 = AllocZeroed(BG_SCREEN_SIZE);
|
||||
gOverworldTilemapBuffer_Bg3 = AllocZeroed(BG_SCREEN_SIZE);
|
||||
SetBgTilemapBuffer(1, gOverworldTilemapBuffer_Bg1);
|
||||
SetBgTilemapBuffer(2, gOverworldTilemapBuffer_Bg2);
|
||||
SetBgTilemapBuffer(3, gOverworldTilemapBuffer_Bg3);
|
||||
InitStandardTextBoxWindows();
|
||||
}
|
||||
|
||||
@ -1407,12 +1407,9 @@ void CleanupOverworldWindowsAndTilemaps(void)
|
||||
{
|
||||
ClearMirageTowerPulseBlendEffect();
|
||||
FreeAllOverworldWindowBuffers();
|
||||
if (gBGTilemapBuffers3)
|
||||
FREE_AND_SET_NULL(gBGTilemapBuffers3);
|
||||
if (gBGTilemapBuffers1)
|
||||
FREE_AND_SET_NULL(gBGTilemapBuffers1);
|
||||
if (gBGTilemapBuffers2)
|
||||
FREE_AND_SET_NULL(gBGTilemapBuffers2);
|
||||
TRY_FREE_AND_SET_NULL(gOverworldTilemapBuffer_Bg3);
|
||||
TRY_FREE_AND_SET_NULL(gOverworldTilemapBuffer_Bg2);
|
||||
TRY_FREE_AND_SET_NULL(gOverworldTilemapBuffer_Bg1);
|
||||
}
|
||||
|
||||
static void ResetSafariZoneFlag_(void)
|
||||
@ -2695,7 +2692,7 @@ static void LoadCableClubPlayer(s32 linkPlayerId, s32 myPlayerId, struct CableCl
|
||||
GetLinkPlayerCoords(linkPlayerId, &x, &y);
|
||||
trainer->pos.x = x;
|
||||
trainer->pos.y = y;
|
||||
trainer->pos.height = GetLinkPlayerElevation(linkPlayerId);
|
||||
trainer->pos.elevation = GetLinkPlayerElevation(linkPlayerId);
|
||||
trainer->metatileBehavior = MapGridGetMetatileBehaviorAt(x, y);
|
||||
}
|
||||
|
||||
@ -2748,7 +2745,7 @@ static const u8 *TryInteractWithPlayer(struct CableClubPlayer *player)
|
||||
otherPlayerPos = player->pos;
|
||||
otherPlayerPos.x += gDirectionToVectors[player->facing].x;
|
||||
otherPlayerPos.y += gDirectionToVectors[player->facing].y;
|
||||
otherPlayerPos.height = 0;
|
||||
otherPlayerPos.elevation = 0;
|
||||
linkPlayerId = GetLinkPlayerIdAt(otherPlayerPos.x, otherPlayerPos.y);
|
||||
|
||||
if (linkPlayerId != MAX_LINK_PLAYERS)
|
||||
@ -2958,7 +2955,7 @@ static void InitLinkPlayerObjectEventPos(struct ObjectEvent *objEvent, s16 x, s1
|
||||
objEvent->previousCoords.y = y;
|
||||
SetSpritePosToMapCoords(x, y, &objEvent->initialCoords.x, &objEvent->initialCoords.y);
|
||||
objEvent->initialCoords.x += 8;
|
||||
ObjectEventUpdateZCoord(objEvent);
|
||||
ObjectEventUpdateElevation(objEvent);
|
||||
}
|
||||
|
||||
static void SetLinkPlayerObjectRange(u8 linkPlayerId, u8 dir)
|
||||
@ -3098,7 +3095,7 @@ static bool8 FacingHandler_DpadMovement(struct LinkPlayerObjectEvent *linkPlayer
|
||||
{
|
||||
objEvent->directionSequenceIndex = 16;
|
||||
ShiftObjectEventCoords(objEvent, x, y);
|
||||
ObjectEventUpdateZCoord(objEvent);
|
||||
ObjectEventUpdateElevation(objEvent);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -3204,8 +3201,8 @@ static void SpriteCB_LinkPlayer(struct Sprite *sprite)
|
||||
struct ObjectEvent *objEvent = &gObjectEvents[linkPlayerObjEvent->objEventId];
|
||||
sprite->x = objEvent->initialCoords.x;
|
||||
sprite->y = objEvent->initialCoords.y;
|
||||
SetObjectSubpriorityByZCoord(objEvent->previousElevation, sprite, 1);
|
||||
sprite->oam.priority = ZCoordToPriority(objEvent->previousElevation);
|
||||
SetObjectSubpriorityByElevation(objEvent->previousElevation, sprite, 1);
|
||||
sprite->oam.priority = ElevationToPriority(objEvent->previousElevation);
|
||||
|
||||
if (linkPlayerObjEvent->movementMode == MOVEMENT_MODE_FREE)
|
||||
StartSpriteAnim(sprite, GetFaceDirectionAnimNum(linkDirection(objEvent)));
|
||||
|
@ -2046,7 +2046,7 @@ bool8 ScrCmd_setmetatile(struct ScriptContext *ctx)
|
||||
if (!isImpassable)
|
||||
MapGridSetMetatileIdAt(x, y, tileId);
|
||||
else
|
||||
MapGridSetMetatileIdAt(x, y, tileId | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, tileId | MAPGRID_COLLISION_MASK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ static void FindMetatileIdMapCoords(s16 *x, s16 *y, u16 metatileId)
|
||||
{
|
||||
for (i = 0; i < mapLayout->width; i++)
|
||||
{
|
||||
if ((mapLayout->map[j * mapLayout->width + i] & METATILE_ID_MASK) == metatileId)
|
||||
if ((mapLayout->map[j * mapLayout->width + i] & MAPGRID_METATILE_ID_MASK) == metatileId)
|
||||
{
|
||||
*x = i;
|
||||
*y = j;
|
||||
@ -330,7 +330,7 @@ void ToggleSecretBaseEntranceMetatile(void)
|
||||
{
|
||||
if (sSecretBaseEntranceMetatiles[i].closedMetatileId == metatileId)
|
||||
{
|
||||
MapGridSetMetatileIdAt(x, y, sSecretBaseEntranceMetatiles[i].openMetatileId | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, sSecretBaseEntranceMetatiles[i].openMetatileId | MAPGRID_COLLISION_MASK);
|
||||
CurrentMapDrawMetatileAt(x, y);
|
||||
return;
|
||||
}
|
||||
@ -341,7 +341,7 @@ void ToggleSecretBaseEntranceMetatile(void)
|
||||
{
|
||||
if (sSecretBaseEntranceMetatiles[i].openMetatileId == metatileId)
|
||||
{
|
||||
MapGridSetMetatileIdAt(x, y, sSecretBaseEntranceMetatiles[i].closedMetatileId | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, sSecretBaseEntranceMetatiles[i].closedMetatileId | MAPGRID_COLLISION_MASK);
|
||||
CurrentMapDrawMetatileAt(x, y);
|
||||
return;
|
||||
}
|
||||
@ -396,7 +396,7 @@ void SetOccupiedSecretBaseEntranceMetatiles(struct MapEvents const *events)
|
||||
{
|
||||
if (sSecretBaseEntranceMetatiles[i].closedMetatileId == tile_id)
|
||||
{
|
||||
MapGridSetMetatileIdAt(x, y, sSecretBaseEntranceMetatiles[i].openMetatileId | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, sSecretBaseEntranceMetatiles[i].openMetatileId | MAPGRID_COLLISION_MASK);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -475,7 +475,7 @@ static void EnterNewlyCreatedSecretBase_StartFadeIn(void)
|
||||
FindMetatileIdMapCoords(&x, &y, METATILE_SecretBase_PC);
|
||||
x += MAP_OFFSET;
|
||||
y += MAP_OFFSET;
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_SecretBase_PC | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_SecretBase_PC | MAPGRID_COLLISION_MASK);
|
||||
CurrentMapDrawMetatileAt(x, y);
|
||||
FadeInFromBlack();
|
||||
CreateTask(EnterNewlyCreatedSecretBase_WaitFadeIn, 0);
|
||||
@ -536,13 +536,13 @@ void InitSecretBaseAppearance(bool8 hidePC)
|
||||
{
|
||||
// Another player's secret base. Change PC type to the "Register" PC.
|
||||
FindMetatileIdMapCoords(&x, &y, METATILE_SecretBase_PC);
|
||||
MapGridSetMetatileIdAt(x + MAP_OFFSET, y + MAP_OFFSET, METATILE_SecretBase_RegisterPC | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x + MAP_OFFSET, y + MAP_OFFSET, METATILE_SecretBase_RegisterPC | MAPGRID_COLLISION_MASK);
|
||||
}
|
||||
else if (hidePC == TRUE && VarGet(VAR_SECRET_BASE_INITIALIZED) == 1)
|
||||
{
|
||||
// Change PC to regular ground tile.
|
||||
FindMetatileIdMapCoords(&x, &y, METATILE_SecretBase_PC);
|
||||
MapGridSetMetatileIdAt(x + MAP_OFFSET, y + MAP_OFFSET, METATILE_SecretBase_Ground | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x + MAP_OFFSET, y + MAP_OFFSET, METATILE_SecretBase_Ground | MAPGRID_COLLISION_MASK);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -838,7 +838,7 @@ static void ClosePlayerSecretBaseEntrance(void)
|
||||
{
|
||||
MapGridSetMetatileIdAt(events->bgEvents[i].x + MAP_OFFSET,
|
||||
events->bgEvents[i].y + MAP_OFFSET,
|
||||
sSecretBaseEntranceMetatiles[j].closedMetatileId | METATILE_COLLISION_MASK);
|
||||
sSecretBaseEntranceMetatiles[j].closedMetatileId | MAPGRID_COLLISION_MASK);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
10
src/shop.c
10
src/shop.c
@ -743,7 +743,7 @@ static void BuyMenuDrawMapBg(void)
|
||||
if (BuyMenuCheckForOverlapWithMenuBg(i, j) == TRUE)
|
||||
metatileLayerType = MapGridGetMetatileLayerTypeAt(x + i, y + j);
|
||||
else
|
||||
metatileLayerType = 1;
|
||||
metatileLayerType = METATILE_LAYER_TYPE_COVERED;
|
||||
|
||||
if (metatile < NUM_METATILES_IN_PRIMARY)
|
||||
{
|
||||
@ -764,15 +764,15 @@ static void BuyMenuDrawMapMetatile(s16 x, s16 y, const u16 *src, u8 metatileLaye
|
||||
|
||||
switch (metatileLayerType)
|
||||
{
|
||||
case 0:
|
||||
case METATILE_LAYER_TYPE_NORMAL:
|
||||
BuyMenuDrawMapMetatileLayer(sShopData->tilemapBuffers[3], offset1, offset2, src);
|
||||
BuyMenuDrawMapMetatileLayer(sShopData->tilemapBuffers[1], offset1, offset2, src + 4);
|
||||
break;
|
||||
case 1:
|
||||
case METATILE_LAYER_TYPE_COVERED:
|
||||
BuyMenuDrawMapMetatileLayer(sShopData->tilemapBuffers[2], offset1, offset2, src);
|
||||
BuyMenuDrawMapMetatileLayer(sShopData->tilemapBuffers[3], offset1, offset2, src + 4);
|
||||
break;
|
||||
case 2:
|
||||
case METATILE_LAYER_TYPE_SPLIT:
|
||||
BuyMenuDrawMapMetatileLayer(sShopData->tilemapBuffers[2], offset1, offset2, src);
|
||||
BuyMenuDrawMapMetatileLayer(sShopData->tilemapBuffers[1], offset1, offset2, src + 4);
|
||||
break;
|
||||
@ -866,7 +866,7 @@ static void BuyMenuDrawObjectEvents(void)
|
||||
|
||||
static bool8 BuyMenuCheckIfObjectEventOverlapsMenuBg(s16 *object)
|
||||
{
|
||||
if (!BuyMenuCheckForOverlapWithMenuBg(object[X_COORD], object[Y_COORD] + 2) && object[LAYER_TYPE] != MB_SECRET_BASE_WALL)
|
||||
if (!BuyMenuCheckForOverlapWithMenuBg(object[X_COORD], object[Y_COORD] + 2) && object[LAYER_TYPE] != METATILE_LAYER_TYPE_COVERED)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -677,9 +677,9 @@ static u16 GetMetatileForFloor(u8 floorId, u32 x, u32 y, u32 stride) // stride i
|
||||
|
||||
impassable = (sHillData->floors[floorId].display.collisionData[y] >> (15 - x) & 1);
|
||||
metatile = sHillData->floors[floorId].display.metatileData[stride * y + x] + NUM_METATILES_IN_PRIMARY;
|
||||
elevation = 3 << METATILE_ELEVATION_SHIFT;
|
||||
elevation = 3 << MAPGRID_ELEVATION_SHIFT;
|
||||
|
||||
return ((impassable << METATILE_COLLISION_SHIFT) & METATILE_COLLISION_MASK) | elevation | (metatile & METATILE_ID_MASK);
|
||||
return ((impassable << MAPGRID_COLLISION_SHIFT) & MAPGRID_COLLISION_MASK) | elevation | (metatile & MAPGRID_METATILE_ID_MASK);
|
||||
}
|
||||
|
||||
void GenerateTrainerHillFloorLayout(u16 *mapArg)
|
||||
|
4
src/tv.c
4
src/tv.c
@ -852,7 +852,7 @@ void UpdateTVScreensOnMap(int width, int height)
|
||||
}
|
||||
}
|
||||
|
||||
static void SetTVMetatilesOnMap(int width, int height, u16 tileId)
|
||||
static void SetTVMetatilesOnMap(int width, int height, u16 metatileId)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
@ -862,7 +862,7 @@ static void SetTVMetatilesOnMap(int width, int height, u16 tileId)
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
if (MapGridGetMetatileBehaviorAt(x, y) == MB_TELEVISION)
|
||||
MapGridSetMetatileIdAt(x, y, tileId | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x, y, metatileId | MAPGRID_COLLISION_MASK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user