Alchemy
Loading...
Searching...
No Matches

world_map.c File Reference

The world map screen: place markers, the cursor and the place name. More...

Go to the source code of this file.

Data Structures

union  WorldMapMarkerPart
 The renderer's linked sprite entry and the three words that initialize it. More...
struct  WorldMapWork
 Scratch work while Map_ShowWorldMap owns gMapCellBuffer. More...

Macros

#define WORLD_MAP_MARKER_TILE_BYTES   0x80
#define WORLD_MAP_SCREEN_WIDTH   240
#define WORLD_MAP_SCREEN_HEIGHT   160
#define WORLD_MAP_WORLD_SIZE   4096
#define WORLD_MAP_X_ORIGIN   PIXELS(4096)
#define WORLD_MAP_FIRST_PLACE_ACTOR   11
#define WORLD_MAP_MARKER_CAPACITY   66
#define WORLD_MAP_CURSOR_PART   WORLD_MAP_MARKER_CAPACITY
#define WORLD_MAP_CURSOR_MIN_SPEED   PIXELS(1)
#define WORLD_MAP_CURSOR_MAX_SPEED   PIXELS(6)
#define WORLD_MAP_CURSOR_ACCELERATION   (PIXELS(1) / 8)
#define WORLD_MAP_MARKER_BLEND_STEPS   32
#define WORLD_MAP_CURSOR_MIN_X   16
#define WORLD_MAP_CURSOR_MAX_X   (WORLD_MAP_SCREEN_WIDTH - 1)
#define WORLD_MAP_CURSOR_MAX_Y   141
#define WORLD_MAP_MARKER_VIEW(marker)
#define WORLD_MAP_MARKER_ALLOCATION_SIZE   32
#define WORLD_MAP_CURSOR_SNAPS   0
#define WORLD_MAP_NAME_RANGE   100
#define WORLD_MAP_NAME_LEFT   1

Functions

 STATIC_ASSERT (sizeof(union WorldMapMarkerPart)==sizeof(struct AnimationSpritePart))
 STATIC_ASSERT (offsetof(struct WorldMapWork, markers)==0x20)
 STATIC_ASSERT (sizeof(struct WorldMapWork)==0x344)
 STATIC_ASSERT (WORLD_MAP_MARKER_CAPACITY==sizeof(((struct FieldWork *) 0) ->actors)/sizeof(((struct FieldWork *) 0) ->actors[0]))
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.
void BattleFx_CleanupResourcesAndWindow (void)
 Closes the world map screen: returns its VRAM blocks and removes the place-name window.
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.
void Map_ShowWorldMap (s32 picture)
 Borrows the map-cell buffer for the still map until A or B closes it.
void Field_UpdateObjectVisibilityBounds (void)
 On the world map, shows only the scene actors within 320 pixels sideways, 600 above and 400 below the camera.
void BattleFx_RunVisibilityTransition (void)
 On the world map, zooms the view out (0x9d89) while L is held, then back.

Detailed Description

The world map screen: place markers, the cursor and the place name.

Part of psynergy_effects.c, compiled only through it.

Definition in file world_map.c.

Macro Definition Documentation

◆ WORLD_MAP_MARKER_TILE_BYTES

#define WORLD_MAP_MARKER_TILE_BYTES   0x80

Definition at line 7 of file world_map.c.

Referenced by BattleFx_SetupResourcesAndWindow().

◆ WORLD_MAP_SCREEN_WIDTH

#define WORLD_MAP_SCREEN_WIDTH   240

◆ WORLD_MAP_SCREEN_HEIGHT

#define WORLD_MAP_SCREEN_HEIGHT   160

◆ WORLD_MAP_WORLD_SIZE

#define WORLD_MAP_WORLD_SIZE   4096

Definition at line 10 of file world_map.c.

Referenced by BattleFx_SetupResourcesAndWindow(), and Map_UpdateWorldMapMarkers().

◆ WORLD_MAP_X_ORIGIN

#define WORLD_MAP_X_ORIGIN   PIXELS(4096)

Definition at line 11 of file world_map.c.

Referenced by BattleFx_SetupResourcesAndWindow(), and Map_UpdateWorldMapMarkers().

◆ WORLD_MAP_FIRST_PLACE_ACTOR

#define WORLD_MAP_FIRST_PLACE_ACTOR   11

Definition at line 12 of file world_map.c.

Referenced by Map_UpdateWorldMapMarkers().

◆ WORLD_MAP_MARKER_CAPACITY

#define WORLD_MAP_MARKER_CAPACITY   66

◆ WORLD_MAP_CURSOR_PART

#define WORLD_MAP_CURSOR_PART   WORLD_MAP_MARKER_CAPACITY

Definition at line 14 of file world_map.c.

Referenced by Map_UpdateWorldMapMarkers().

◆ WORLD_MAP_CURSOR_MIN_SPEED

#define WORLD_MAP_CURSOR_MIN_SPEED   PIXELS(1)

Definition at line 15 of file world_map.c.

Referenced by BattleFx_SetupResourcesAndWindow(), and Map_UpdateWorldMapMarkers().

◆ WORLD_MAP_CURSOR_MAX_SPEED

#define WORLD_MAP_CURSOR_MAX_SPEED   PIXELS(6)

Definition at line 16 of file world_map.c.

Referenced by Map_UpdateWorldMapMarkers().

◆ WORLD_MAP_CURSOR_ACCELERATION

#define WORLD_MAP_CURSOR_ACCELERATION   (PIXELS(1) / 8)

Definition at line 17 of file world_map.c.

Referenced by Map_UpdateWorldMapMarkers().

◆ WORLD_MAP_MARKER_BLEND_STEPS

#define WORLD_MAP_MARKER_BLEND_STEPS   32

Definition at line 18 of file world_map.c.

Referenced by Map_UpdateWorldMapMarkers().

◆ WORLD_MAP_CURSOR_MIN_X

#define WORLD_MAP_CURSOR_MIN_X   16

Definition at line 19 of file world_map.c.

Referenced by Map_UpdateWorldMapMarkers().

◆ WORLD_MAP_CURSOR_MAX_X

#define WORLD_MAP_CURSOR_MAX_X   (WORLD_MAP_SCREEN_WIDTH - 1)

Definition at line 20 of file world_map.c.

Referenced by Map_UpdateWorldMapMarkers().

◆ WORLD_MAP_CURSOR_MAX_Y

#define WORLD_MAP_CURSOR_MAX_Y   141

Definition at line 21 of file world_map.c.

Referenced by Map_UpdateWorldMapMarkers().

◆ WORLD_MAP_MARKER_VIEW

#define WORLD_MAP_MARKER_VIEW ( marker)
Value:
(*(marker))

Definition at line 32 of file world_map.c.

Referenced by Map_UpdateWorldMapMarkers().

◆ WORLD_MAP_MARKER_ALLOCATION_SIZE

#define WORLD_MAP_MARKER_ALLOCATION_SIZE   32

Definition at line 43 of file world_map.c.

Referenced by BattleFx_SetupResourcesAndWindow().

◆ WORLD_MAP_CURSOR_SNAPS

#define WORLD_MAP_CURSOR_SNAPS   0

Definition at line 170 of file world_map.c.

◆ WORLD_MAP_NAME_RANGE

#define WORLD_MAP_NAME_RANGE   100

Definition at line 171 of file world_map.c.

Referenced by Map_UpdateWorldMapMarkers().

◆ WORLD_MAP_NAME_LEFT

#define WORLD_MAP_NAME_LEFT   1

Definition at line 172 of file world_map.c.

Referenced by Map_UpdateWorldMapMarkers().

Function Documentation

◆ STATIC_ASSERT() [1/4]

STATIC_ASSERT ( sizeof(union WorldMapMarkerPart) = =sizeof(struct AnimationSpritePart))

◆ STATIC_ASSERT() [2/4]

STATIC_ASSERT ( offsetof(struct WorldMapWork, markers) = =0x20)

◆ STATIC_ASSERT() [3/4]

STATIC_ASSERT ( sizeof(struct WorldMapWork) = =0x344)

◆ STATIC_ASSERT() [4/4]

STATIC_ASSERT ( WORLD_MAP_MARKER_CAPACITY = =sizeof(((struct FieldWork *) 0) ->actors)/sizeof(((struct FieldWork *) 0) ->actors[0]))

◆ 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.

Definition at line 75 of file world_map.c.

Referenced by BattleFx_SetupResourcesAndWindow(), Djinn_ResolvePendingEvent(), and Map_ShowWorldMap().

◆ BattleFx_CleanupResourcesAndWindow()

void BattleFx_CleanupResourcesAndWindow ( void )

Closes the world map screen: returns its VRAM blocks and removes the place-name window.

Definition at line 177 of file world_map.c.

Referenced by BattleFx_CleanupResourcesAndWindow(), Djinn_ResolvePendingEvent(), and 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.

Definition at line 188 of file world_map.c.

Referenced by Djinn_ResolvePendingEvent(), Map_ShowWorldMap(), and Map_UpdateWorldMapMarkers().

◆ 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.

Definition at line 427 of file world_map.c.

Referenced by Djinn_ResolvePendingEvent(), Field_RunScene(), and Map_ShowWorldMap().

◆ 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.

Definition at line 496 of file world_map.c.

Referenced by BattleFx_RunVisibilityTransition(), Djinn_ResolvePendingEvent(), and Field_UpdateObjectVisibilityBounds().

◆ BattleFx_RunVisibilityTransition()

void BattleFx_RunVisibilityTransition ( void )

On the world map, zooms the view out (0x9d89) while L is held, then back.

Definition at line 535 of file world_map.c.

Referenced by BattleFx_RunVisibilityTransition(), Djinn_ResolvePendingEvent(), and Field_RunScene().