world_map.c
The world map screen: place markers, the cursor and the place name.
games/tbs/src/object/psynergy_effects/world_map.c on GitHub
The world map screen: place markers, the cursor and the place name. Part of psynergy_effects.c, compiled only through it.
Functions
BattleFx_SetupResourcesAndWindow
void BattleFx_SetupResourcesAndWindow(void)
Sets up the world map screen: the marker tiles and their OAM entries, the cursor where the leader is on the map (or mid-screen when the place is not on it), and the place-name window.
Used by Map_ShowWorldMap.
BattleFx_CleanupResourcesAndWindow
void BattleFx_CleanupResourcesAndWindow(void)
Closes the world map screen: returns its VRAM blocks and removes the place-name window.
Used by Map_ShowWorldMap.
Map_UpdateWorldMapMarkers
void Map_UpdateWorldMapMarkers(void)
Scheduler callback of the world map screen: shows a marker at each place whose flag is set, moves the cursor with the d-pad (to the current place while L or R is held) and shows the name of the marker nearest the cursor.
Used by Map_ShowWorldMap.
Map_ShowWorldMap
void Map_ShowWorldMap(s32 picture)
Borrows the map-cell buffer for the still map until A or B closes it. Field_RunScene reaches this for event -888 in world-map mode. The marker task stops before map graphics are restored, so neither uses the other's scratch storage. The picture argument is unused; the resource is fixed.
Used by Field_RunScene.
Field_UpdateObjectVisibilityBounds
void Field_UpdateObjectVisibilityBounds(void)
On the world map, shows only the scene actors within 320 pixels sideways, 600 above and 400 below the camera.
Used by BattleFx_RunVisibilityTransition.
BattleFx_RunVisibilityTransition
void BattleFx_RunVisibilityTransition(void)
On the world map, zooms the view out (0x9d89) while L is held, then back.
Used by Field_RunScene.
Structures
WorldMapWork
struct WorldMapWork
Scratch work while Map_ShowWorldMap owns gMapCellBuffer. Setup runs before the marker task; cleanup removes its window before map graphics reuse it.
| Field | Declared as | |
|---|---|---|
markerVramBlock | u16 markerVramBlock | owns the four generated marker tiles |
cursorVramBlock | u16 cursorVramBlock | owns the cursor picture's tiles |
cursorX | union FieldCoordinate cursorX | screen column, 16.16 pixels |
cursorY | union FieldCoordinate cursorY | screen row, 16.16 pixels |
padding0c | u8 padding0c[6] | not read by this screen |
namedMarker | s16 namedMarker | actor whose name is drawn; -1 clears the name |
padding14 | u8 padding14[4] | not read by this screen |
cursorSpeed | s32 cursorSpeed | 16.16 screen pixels per frame |
nameWindow | struct UiWindow *nameWindow | owned until this screen closes |
markers | union WorldMapMarkerPart markers[WORLD_MAP_MARKER_CAPACITY + 1] | |
markers | struct AnimationSpritePart markers[WORLD_MAP_MARKER_CAPACITY + 1] |
Used by BattleFx_CleanupResourcesAndWindow, BattleFx_SetupResourcesAndWindow, Map_UpdateWorldMapMarkers.
Unions
WorldMapMarkerPart
union WorldMapMarkerPart
The renderer's linked sprite entry and the three words that initialize it.
| Field | Declared as | |
|---|---|---|
sprite | struct AnimationSpritePart sprite | |
words | u32 words[3] |
Used by BattleFx_SetupResourcesAndWindow, Map_UpdateWorldMapMarkers.
Macros
WORLD_MAP_CURSOR_SNAPS
#define WORLD_MAP_CURSOR_SNAPS 1
The cursor snaps to the nearest place when the d-pad is released.
Used by Map_UpdateWorldMapMarkers.
Also, macros without a comment: WORLD_MAP_MARKER_TILE_BYTES, WORLD_MAP_SCREEN_WIDTH, WORLD_MAP_SCREEN_HEIGHT, WORLD_MAP_WORLD_SIZE, WORLD_MAP_X_ORIGIN, WORLD_MAP_FIRST_PLACE_ACTOR, WORLD_MAP_MARKER_CAPACITY, WORLD_MAP_CURSOR_PART, WORLD_MAP_CURSOR_MIN_SPEED, WORLD_MAP_CURSOR_MAX_SPEED, WORLD_MAP_CURSOR_ACCELERATION, WORLD_MAP_MARKER_BLEND_STEPS, WORLD_MAP_CURSOR_MIN_X, WORLD_MAP_CURSOR_MAX_X, WORLD_MAP_CURSOR_MAX_Y, WORLD_MAP_MARKER_VIEW, WORLD_MAP_MARKER_VIEW, WORLD_MAP_MARKER_ALLOCATION_SIZE, WORLD_MAP_MARKER_ALLOCATION_SIZE, WORLD_MAP_NAME_RANGE, WORLD_MAP_NAME_LEFT, WORLD_MAP_CURSOR_SNAPS, WORLD_MAP_NAME_RANGE, WORLD_MAP_NAME_LEFT.