MAP_NONE -> MAP_DYNAMIC

This commit is contained in:
GriffinR 2022-08-25 21:34:05 -04:00
parent 8a1130d046
commit ce4a6e9067
36 changed files with 53 additions and 50 deletions

View File

@ -469,7 +469,7 @@
formatwarp \map, \a, \b, \c formatwarp \map, \a, \b, \c
.endm .endm
@ Sets the dynamic warp destination. Warps with a destination map of MAP_NONE will target this destination. @ Sets the dynamic warp destination. Warps with a destination map of MAP_DYNAMIC will target this destination.
@ Warp commands can be given either the id of which warp location to go to on the destination map @ Warp commands can be given either the id of which warp location to go to on the destination map
@ or a pair of x/y coordinates to go to directly on the destination map. @ or a pair of x/y coordinates to go to directly on the destination map.
.macro setdynamicwarp map:req, a, b, c .macro setdynamicwarp map:req, a, b, c

View File

@ -33,14 +33,14 @@
"x": 6, "x": 6,
"y": 8, "y": 8,
"elevation": 3, "elevation": 3,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
}, },
{ {
"x": 7, "x": 7,
"y": 8, "y": 8,
"elevation": 3, "elevation": 3,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
} }
], ],

View File

@ -19,28 +19,28 @@
"x": 5, "x": 5,
"y": 8, "y": 8,
"elevation": 3, "elevation": 3,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
}, },
{ {
"x": 6, "x": 6,
"y": 8, "y": 8,
"elevation": 3, "elevation": 3,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
}, },
{ {
"x": 7, "x": 7,
"y": 8, "y": 8,
"elevation": 3, "elevation": 3,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
}, },
{ {
"x": 8, "x": 8,
"y": 8, "y": 8,
"elevation": 3, "elevation": 3,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
} }
], ],

View File

@ -59,21 +59,21 @@
"x": 4, "x": 4,
"y": 1, "y": 1,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
}, },
{ {
"x": 4, "x": 4,
"y": 2, "y": 2,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
}, },
{ {
"x": 4, "x": 4,
"y": 3, "y": 3,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
} }
], ],

View File

@ -33,14 +33,14 @@
"x": 1, "x": 1,
"y": 5, "y": 5,
"elevation": 3, "elevation": 3,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
}, },
{ {
"x": 2, "x": 2,
"y": 5, "y": 5,
"elevation": 3, "elevation": 3,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
} }
], ],

View File

@ -33,28 +33,28 @@
"x": 8, "x": 8,
"y": 9, "y": 9,
"elevation": 3, "elevation": 3,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
}, },
{ {
"x": 9, "x": 9,
"y": 9, "y": 9,
"elevation": 3, "elevation": 3,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
}, },
{ {
"x": 11, "x": 11,
"y": 9, "y": 9,
"elevation": 3, "elevation": 3,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
}, },
{ {
"x": 10, "x": 10,
"y": 9, "y": 9,
"elevation": 3, "elevation": 3,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 5, "x": 5,
"y": 7, "y": 7,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 7, "x": 7,
"y": 5, "y": 5,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 4, "x": 4,
"y": 15, "y": 15,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 4, "x": 4,
"y": 15, "y": 15,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 5, "x": 5,
"y": 7, "y": 7,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 1, "x": 1,
"y": 7, "y": 7,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 11, "x": 11,
"y": 9, "y": 9,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 2, "x": 2,
"y": 8, "y": 8,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 5, "x": 5,
"y": 7, "y": 7,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 3, "x": 3,
"y": 14, "y": 14,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 3, "x": 3,
"y": 6, "y": 6,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 2, "x": 2,
"y": 12, "y": 12,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 5, "x": 5,
"y": 7, "y": 7,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 7, "x": 7,
"y": 5, "y": 5,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 6, "x": 6,
"y": 9, "y": 9,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 11, "x": 11,
"y": 8, "y": 8,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 5, "x": 5,
"y": 7, "y": 7,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 3, "x": 3,
"y": 14, "y": 14,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 8, "x": 8,
"y": 6, "y": 6,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 7, "x": 7,
"y": 12, "y": 12,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 5, "x": 5,
"y": 7, "y": 7,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 12, "x": 12,
"y": 7, "y": 7,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 5, "x": 5,
"y": 9, "y": 9,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -216,7 +216,7 @@
"x": 6, "x": 6,
"y": 12, "y": 12,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 126 "dest_warp_id": 126
} }
], ],

View File

@ -19,7 +19,7 @@
"x": 8, "x": 8,
"y": 18, "y": 18,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
}, },
{ {

View File

@ -33,14 +33,14 @@
"x": 5, "x": 5,
"y": 8, "y": 8,
"elevation": 3, "elevation": 3,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
}, },
{ {
"x": 6, "x": 6,
"y": 8, "y": 8,
"elevation": 3, "elevation": 3,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
} }
], ],

View File

@ -19,7 +19,7 @@
"x": 9, "x": 9,
"y": 8, "y": 8,
"elevation": 0, "elevation": 0,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
} }
], ],

View File

@ -137,14 +137,14 @@
"x": 7, "x": 7,
"y": 11, "y": 11,
"elevation": 3, "elevation": 3,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
}, },
{ {
"x": 8, "x": 8,
"y": 11, "y": 11,
"elevation": 3, "elevation": 3,
"dest_map": "MAP_NONE", "dest_map": "MAP_DYNAMIC",
"dest_warp_id": 127 "dest_warp_id": 127
} }
], ],

View File

@ -3,14 +3,17 @@
#include "map_groups.h" #include "map_groups.h"
#define MAP_NONE (0x7F | (0x7F << 8)) // Warps using this map will instead use the warp data stored in gSaveBlock1Ptr->dynamicWarp.
// Used for warps that need to change destinations, e.g. when stepping off an elevator.
#define MAP_DYNAMIC (0x7F | (0x7F << 8))
#define MAP_UNDEFINED (0xFF | (0xFF << 8)) #define MAP_UNDEFINED (0xFF | (0xFF << 8))
#define MAP_GROUP(map) (MAP_##map >> 8) #define MAP_GROUP(map) (MAP_##map >> 8)
#define MAP_NUM(map) (MAP_##map & 0xFF) #define MAP_NUM(map) (MAP_##map & 0xFF)
// IDs for dynamic warps. Both are used in the dest_warp_id field for warp events, but they // IDs for dynamic warps. Both are used in the dest_warp_id field for warp events, but they
// are never read in practice. A dest_map of MAP_NONE is used to indicate that a // are never read in practice. A dest_map of MAP_DYNAMIC is used to indicate that a
// dynamic warp should be used, at which point the warp id is ignored. It can be passed to // dynamic warp should be used, at which point the warp id is ignored. It can be passed to
// SetDynamicWarp/SetDynamicWarpWithCoords as the first argument, but this argument is unused. // SetDynamicWarp/SetDynamicWarpWithCoords as the first argument, but this argument is unused.
// As only one dynamic warp is saved at a time there's no need to distinguish between them. // As only one dynamic warp is saved at a time there's no need to distinguish between them.

View File

@ -815,7 +815,7 @@ static void SetupWarp(struct MapHeader *unused, s8 warpEventId, struct MapPositi
warpEvent = &gMapHeader.events->warps[warpEventId]; warpEvent = &gMapHeader.events->warps[warpEventId];
} }
if (warpEvent->mapNum == MAP_NUM(NONE)) if (warpEvent->mapNum == MAP_NUM(DYNAMIC))
{ {
SetWarpDestinationToDynamicWarp(warpEvent->warpId); SetWarpDestinationToDynamicWarp(warpEvent->warpId);
} }
@ -826,7 +826,7 @@ static void SetupWarp(struct MapHeader *unused, s8 warpEventId, struct MapPositi
SetWarpDestinationToMapWarp(warpEvent->mapGroup, warpEvent->mapNum, warpEvent->warpId); SetWarpDestinationToMapWarp(warpEvent->mapGroup, warpEvent->mapNum, warpEvent->warpId);
UpdateEscapeWarp(position->x, position->y); UpdateEscapeWarp(position->x, position->y);
mapHeader = Overworld_GetMapHeaderByGroupAndId(warpEvent->mapGroup, warpEvent->mapNum); mapHeader = Overworld_GetMapHeaderByGroupAndId(warpEvent->mapGroup, warpEvent->mapNum);
if (mapHeader->events->warps[warpEvent->warpId].mapNum == MAP_NUM(NONE)) if (mapHeader->events->warps[warpEvent->warpId].mapNum == MAP_NUM(DYNAMIC))
SetDynamicWarp(mapHeader->events->warps[warpEventId].warpId, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, warpEventId); SetDynamicWarp(mapHeader->events->warps[warpEventId].warpId, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, warpEventId);
} }
} }