Skip to Content
The Alchemy Project

src/field/field_psynergy_map_screen.c

The map screen: its markers and cursor (The Broken Seal's script_commands_map_screen.c), and where the leader stands on it. More…

Included by field_psynergy.c.

Macros

NameDescription
#defineWORLD_MAP_MARKER_TILE_BYTES (4 * TILE_SIZE_4BPP)The generated marker pictures: four 16-colour 8 by 8 tiles, 32 bytes each.
#defineMARKER_ROW_WORD (tile, row) ((tile) * (TILE_SIZE_4BPP / 4) + (row))The word of a marker tile's pixel row, eight 4-bit pixels a word.
#defineMAP_SCREEN_MARKER_ROW (p0, p1, p2, p3, p4)The first five of a marker tile row's eight 4-bit pixels, the leftmost in the low bits; the rest are 0.
#defineWORLD_MAP_MARKER_ALLOCATION_SIZEThe bytes reserved for the map screen's marker tiles.

Functions

NameDescription
voidfdMapScreenInit (void)Sets up the map screen: the marker tiles and their OAM entries, the cursor where the leader is on the map (or mid-screen when the area is not on it), and the name window.
voidfdMapScreenRelease (void)Closes the map screen: returns its VRAM blocks and removes the name window.
voidfdMapScreenPlaceLeaderAt (Sint32 x, Sint32 z)Unused: nothing calls it.
voidfdMapScreenGetLeaderPoint (Sint32 *screenX, Sint32 *screenY)The leader's point on the map screen: its world map position scaled by 853 and 640 in 16384, a far corner of the map folded in (FLAG_LEADER_OFF_MAP_SCREEN set while the leader is there); off the world map, the image's fixed point (264, 16).
Uint32fdWorldMapPlaceGetMarker (const WORLD_MAP_PLACE *place)Returns a World Map place's marker: the high nibble of its markers when MapScreenFirstListOnly is set, else the low nibble (0 and 15 show none).

Description

The map screen: its markers and cursor (The Broken Seal's script_commands_map_screen.c), and where the leader stands on it. Part of field_psynergy.c.

Macros in detail

WORLD_MAP_MARKER_TILE_BYTES

#define WORLD_MAP_MARKER_TILE_BYTES (4 * TILE_SIZE_4BPP)

The generated marker pictures: four 16-colour 8 by 8 tiles, 32 bytes each.

Referenced by fdMapScreenInit().

Definition at line 6 of file field_psynergy_map_screen.c.

MARKER_ROW_WORD

#define MARKER_ROW_WORD(tile, row) ((tile) * (TILE_SIZE_4BPP / 4) + (row))

The word of a marker tile's pixel row, eight 4-bit pixels a word.

Referenced by fdMapScreenInit().

Definition at line 8 of file field_psynergy_map_screen.c.

MAP_SCREEN_MARKER_ROW

#define MAP_SCREEN_MARKER_ROW(p0, p1, p2, p3, p4)

The first five of a marker tile row's eight 4-bit pixels, the leftmost in the low bits; the rest are 0.

Referenced by fdMapScreenInit().

Definition at line 11 of file field_psynergy_map_screen.c.

WORLD_MAP_MARKER_ALLOCATION_SIZE

#define WORLD_MAP_MARKER_ALLOCATION_SIZE

The bytes reserved for the map screen's marker tiles. BUG: the original reserves 32 bytes but writes and uploads 128, as The Broken Seal's does. The bump allocator takes bytes, not words; reserve the whole tile buffer with BUGFIX.

Referenced by fdMapScreenInit().

Definition at line 18 of file field_psynergy_map_screen.c.

Functions in detail

fdMapScreenInit

void fdMapScreenInit(void)

Sets up the map screen: the marker tiles and their OAM entries, the cursor where the leader is on the map (or mid-screen when the area is not on it), and the name window.

References fdActorGetById(), fdMapScreenGetLeaderPoint(), fdPartyGetLeaderActor(), mnPointingHandLoadIntoFreeSlotStub(), mnWindowCreateStub(), Sint32, syGameFlagGet(), syHeapAllocateEWRAM(), syHeapRelease(), syVRAMCacheFindFreeEntry(), syVRAMCacheLoad() and VramCacheEntries.

Referenced by fdMapScreenShow().

Definition at line 24 of file field_psynergy_map_screen.c.

fdMapScreenRelease

void fdMapScreenRelease(void)

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

References mnWindowCloseStub(), syVRAMCacheFreeEntry() and WorldMapStateWork.

Referenced by fdMapScreenShow().

Definition at line 132 of file field_psynergy_map_screen.c.

fdMapScreenPlaceLeaderAt

void fdMapScreenPlaceLeaderAt(Sint32 x, Sint32 z)

Unused: nothing calls it. Puts the leader at the world map position of image point (x, z), the inverse of fdMapScreenGetLeaderPoint's scale, and the camera on it.

References fdActorLookup(), fdPartyGetLeaderActor() and Sint32.

Definition at line 142 of file field_psynergy_map_screen.c.

fdMapScreenGetLeaderPoint

void fdMapScreenGetLeaderPoint(Sint32 *screenX, Sint32 *screenY)

The leader's point on the map screen: its world map position scaled by 853 and 640 in 16384, a far corner of the map folded in (FLAG_LEADER_OFF_MAP_SCREEN set while the leader is there); off the world map, the image's fixed point (264, 16).

References fdActorLookup(), fdPartyGetLeaderActor(), Sint32, syGameFlagClear() and syGameFlagSet().

Referenced by fdMapScreenInit(), fdMapScreenShow(), fdMapScreenStepToPlace() and fdMapScreenUpdateMarkers().

Definition at line 164 of file field_psynergy_map_screen.c.

fdWorldMapPlaceGetMarker

Uint32 fdWorldMapPlaceGetMarker(const WORLD_MAP_PLACE *place)

Returns a World Map place's marker: the high nibble of its markers when MapScreenFirstListOnly is set, else the low nibble (0 and 15 show none).

References MapScreenFirstListOnly.

Referenced by fdMapScreenStepToPlace() and fdMapScreenUpdateMarkers().

Definition at line 214 of file field_psynergy_map_screen.c.