src/field/field_psynergy_map_screen_image.c
The map screen's image: drawing it, scrolling it with the cursor, its area markers, and zooming the view out while L is held. More…
Included by field_psynergy.c.
Macros
| Name | Description | |
|---|---|---|
#define | IMAGE_WIDTH 512 | The map screen's image on BG1, in 256 colours. |
#define | IMAGE_HEIGHT 384 | |
#define | IMAGE_TILES_ACROSS (IMAGE_WIDTH / 8) | |
#define | IMAGE_ROW_BYTES (IMAGE_TILES_ACROSS * TILE_SIZE_8BPP) | |
#define | MAP_SCREEN_TILES (MAP_SCREEN_TILE_ROWS * BG_SCREEN_WIDTH) | The image's tiles BG1 holds, where its map's tile numbers wrap. |
#define | IMAGE_SCROLL_MAX_X toFIXED(IMAGE_WIDTH - DISPLAY_WIDTH) | The scroll that shows the image's bottom right corner. |
#define | IMAGE_SCROLL_MAX_Y toFIXED(IMAGE_HEIGHT - DISPLAY_HEIGHT) | |
#define | IMAGE_DRAWN_COLUMNS (DISPLAY_WIDTH / 8 + 1) | The tiles drawn for one screen: 30 by 20, and the column and row partly scrolled in. |
#define | IMAGE_DRAWN_ROWS (DISPLAY_HEIGHT / 8 + 1) | |
#define | WORLD_MAP_CURSOR_MIN_X 16 | The cursor's limits on the image, in pixels; y goes from 0. |
#define | WORLD_MAP_CURSOR_MAX_X (IMAGE_WIDTH - 1) | |
#define | WORLD_MAP_CURSOR_MAX_Y 365 | |
#define | WORLD_MAP_CURSOR_MIN_SPEED toFIXED(1) | Cursor min and max speed, in pixels a tick. |
#define | WORLD_MAP_CURSOR_MAX_SPEED toFIXED(6) | |
#define | WORLD_MAP_CURSOR_ACCELERATION (toFIXED(1) / 8) | Added to the cursor's speed each tick the d-pad is held. |
#define | WORLD_MAP_NAME_REACH 8 | How near the cursor a marker's name shows, in pixels. |
#define | WORLD_MAP_MARKER_BLEND_STEPS 32 | WorldMapMarkerBlendCycle's rows. |
#define | WORLD_MAP_NAME_ABOVE 11 | Where the name of the place nearest the cursor is drawn: its top this many pixels above the place, and its left edge WORLD_MAP_NAME_LEFT pixels left of it (1 when zoomed). |
#define | WORLD_MAP_NAME_RIGHT_MARGIN 8 | |
#define | WORLD_MAP_NAME_RAISE 10 | |
#define | MAP_SCREEN_CURSOR_LEFT 17 | The cursor sprite's left edge, this many pixels left of the cursor's point. |
#define | WORLD_MAP_NAME_LEFT GERMAN_OR(3, 1) | The scrolled name's left edge, in pixels left of its place. |
#define | WORLD_MAP_HIGH (value) (((Sint16 *)&(value))[1]) | The upper halfword of value, its whole pixels. |
#define | WORLD_MAP_SCALE (value) ((value) * 300 / 640) | A place on the World Map, in pixels, as a place on the image, 300 pixels to every 640. |
#define | MARKER_NAME_PARTY -1 | The names a marker shows besides its place's own. |
#define | MARKER_NAME_SHIP -2 | "Boat" |
#define | SCROLL_X RamWorldMapScroll[0] | The map screen's scroll, x then y. |
#define | SCROLL_Y RamWorldMapScroll[1] |
Functions
| Name | Description | |
|---|---|---|
void | fdMapScreenStepToPlace (Sint32 *screenX, Sint32 *screenY, Sint32 step) | R (step 1) and L (step -1) on the map screen: the cursor jumps to the next or the previous marked place round from the one nearest it, and its point on the image is written to screenX and screenY. |
void | fdWindowSpriteListMove (WINDOW_SPR_LIST *list, Sint32 dx, Sint32 dy) | Moves every window sprite of a list by dx, dy: the output's position and its queued sprite's OAM x and y. |
void | fdMapScreenUpdateMarkers (void) | Each tick of the map screen: moves the cursor with the d-pad, faster the longer it is held, or glides it toward its target; draws a marker at each place visited, at the ship once it sails and at the party; with the d-pad released draws the cursor onto the nearest marker in reach, and shows that marker's name beside it. |
void | fdMapScreenDraw (void) | Draws the map screen on BG1 with the cursor in the middle of the screen (or the whole world, RESOURCE_WORLD_MAP_PICTURE, at the origin while WorldMapStateWork.centered is set): the palette, then 21 rows of 31 tiles. |
void | fdMapScreenDrawRow (Uint32 column, Sint32 row) | Draws one row of the map screen on BG1 as it scrolls in, from a column to the image's right edge, at most 31 tiles (the Japanese release always draws 32): decodes the row into the map-metatile buffer and copies its tiles to BG1's. |
void | fdMapScreenDrawColumn (Sint32 column, Sint32 row) | Draws one column of the map screen on BG1 as it scrolls in, 21 tiles down from a row, from the rows already decoded in the map-metatile buffer. |
void | fdMapScreenUpdateScroll (void) | The map screen's scroll follows the cursor. |
Sint32 | fdMapScreenShow (Sint32 mode) | The map screen, over the map-metatile buffer, until A or B closes it, to look or to choose where to Teleport (MAP_SCREEN_MODE). |
void | fdWorldMapZoomOutWhileLHeld (void) | On the world map, zooms the view out to eight thirteenths while L is held, then back, six ticks each way (FIELD_RAISED_CUE_WORLD_MAP_ZOOM). |
const WORLD_MAP_PLACE * | fdWorldMapPlacesGetTable (void) | Returns the flag entry table, 20-byte entries ended by a zero flag. |
Variables
| Name | Description | |
|---|---|---|
extern const WORLD_MAP_PLACE | WorldMapPlaces [] | The World Map's places, ended by a zero flag. |
Description
The map screen's image: drawing it, scrolling it with the cursor, its area
markers, and zooming the view out while L is held. Part of field_psynergy.c.
Macros in detail
IMAGE_WIDTH
#define IMAGE_WIDTH 512
The map screen's image on BG1, in 256 colours. The large image
(RESOURCE_WORLD_MAP_PICTURE_LARGE) is 64 by 48 tiles, each row of tiles
packed on its own and decoded into the map-metatile buffer, which holds 24
rows and wraps. BG1 holds 32 by 24 of its tiles from char block 1 on,
wrapping the same way, and BG1's map (fdWorldMapLoadGraphics) numbers them
from the fifth row, where the still image starts.
Definition at line 10 of file field_psynergy_map_screen_image.c.
IMAGE_HEIGHT
#define IMAGE_HEIGHT 384
Definition at line 11 of file field_psynergy_map_screen_image.c.
IMAGE_TILES_ACROSS
#define IMAGE_TILES_ACROSS (IMAGE_WIDTH / 8)
Referenced by fdMapScreenDraw(), fdMapScreenDrawColumn() and fdMapScreenDrawRow().
Definition at line 12 of file field_psynergy_map_screen_image.c.
IMAGE_ROW_BYTES
#define IMAGE_ROW_BYTES (IMAGE_TILES_ACROSS * TILE_SIZE_8BPP)
Referenced by fdMapScreenDraw() and fdMapScreenDrawRow().
Definition at line 13 of file field_psynergy_map_screen_image.c.
MAP_SCREEN_TILES
#define MAP_SCREEN_TILES (MAP_SCREEN_TILE_ROWS * BG_SCREEN_WIDTH)
The image's tiles BG1 holds, where its map's tile numbers wrap.
Referenced by fdMapScreenDraw(), fdMapScreenDrawColumn() and fdMapScreenDrawRow().
Definition at line 15 of file field_psynergy_map_screen_image.c.
IMAGE_SCROLL_MAX_X
#define IMAGE_SCROLL_MAX_X toFIXED(IMAGE_WIDTH - DISPLAY_WIDTH)
The scroll that shows the image's bottom right corner.
Referenced by fdMapScreenDraw() and fdMapScreenUpdateScroll().
Definition at line 17 of file field_psynergy_map_screen_image.c.
IMAGE_SCROLL_MAX_Y
#define IMAGE_SCROLL_MAX_Y toFIXED(IMAGE_HEIGHT - DISPLAY_HEIGHT)
Referenced by fdMapScreenDraw() and fdMapScreenUpdateScroll().
Definition at line 18 of file field_psynergy_map_screen_image.c.
IMAGE_DRAWN_COLUMNS
#define IMAGE_DRAWN_COLUMNS (DISPLAY_WIDTH / 8 + 1)
The tiles drawn for one screen: 30 by 20, and the column and row partly scrolled in.
Referenced by fdMapScreenDraw() and fdMapScreenDrawRow().
Definition at line 21 of file field_psynergy_map_screen_image.c.
IMAGE_DRAWN_ROWS
#define IMAGE_DRAWN_ROWS (DISPLAY_HEIGHT / 8 + 1)
Referenced by fdMapScreenDraw() and fdMapScreenDrawColumn().
Definition at line 22 of file field_psynergy_map_screen_image.c.
WORLD_MAP_CURSOR_MIN_X
#define WORLD_MAP_CURSOR_MIN_X 16
The cursor's limits on the image, in pixels; y goes from 0.
Referenced by fdMapScreenUpdateMarkers().
Definition at line 25 of file field_psynergy_map_screen_image.c.
WORLD_MAP_CURSOR_MAX_X
#define WORLD_MAP_CURSOR_MAX_X (IMAGE_WIDTH - 1)
Referenced by fdMapScreenUpdateMarkers().
Definition at line 26 of file field_psynergy_map_screen_image.c.
WORLD_MAP_CURSOR_MAX_Y
#define WORLD_MAP_CURSOR_MAX_Y 365
Referenced by fdMapScreenUpdateMarkers().
Definition at line 27 of file field_psynergy_map_screen_image.c.
WORLD_MAP_CURSOR_MIN_SPEED
#define WORLD_MAP_CURSOR_MIN_SPEED toFIXED(1)
Cursor min and max speed, in pixels a tick.
Referenced by fdMapScreenUpdateMarkers().
Definition at line 29 of file field_psynergy_map_screen_image.c.
WORLD_MAP_CURSOR_MAX_SPEED
#define WORLD_MAP_CURSOR_MAX_SPEED toFIXED(6)
Referenced by fdMapScreenUpdateMarkers().
Definition at line 30 of file field_psynergy_map_screen_image.c.
WORLD_MAP_CURSOR_ACCELERATION
#define WORLD_MAP_CURSOR_ACCELERATION (toFIXED(1) / 8)
Added to the cursor's speed each tick the d-pad is held.
Referenced by fdMapScreenUpdateMarkers().
Definition at line 32 of file field_psynergy_map_screen_image.c.
WORLD_MAP_NAME_REACH
#define WORLD_MAP_NAME_REACH 8
How near the cursor a marker's name shows, in pixels.
Referenced by fdMapScreenUpdateMarkers().
Definition at line 34 of file field_psynergy_map_screen_image.c.
WORLD_MAP_MARKER_BLEND_STEPS
#define WORLD_MAP_MARKER_BLEND_STEPS 32
WorldMapMarkerBlendCycle's rows.
Referenced by fdMapScreenUpdateMarkers().
Definition at line 36 of file field_psynergy_map_screen_image.c.
WORLD_MAP_NAME_ABOVE
#define WORLD_MAP_NAME_ABOVE 11
Where the name of the place nearest the cursor is drawn: its top this many
pixels above the place, and its left edge WORLD_MAP_NAME_LEFT pixels left of
it (1 when zoomed). A name that would run off the screen's right edge ends
WORLD_MAP_NAME_RIGHT_MARGIN pixels short of it instead, and is raised
WORLD_MAP_NAME_RAISE more.
Referenced by fdMapScreenUpdateMarkers().
Definition at line 163 of file field_psynergy_map_screen_image.c.
WORLD_MAP_NAME_RIGHT_MARGIN
#define WORLD_MAP_NAME_RIGHT_MARGIN 8
Referenced by fdMapScreenUpdateMarkers().
Definition at line 164 of file field_psynergy_map_screen_image.c.
WORLD_MAP_NAME_RAISE
#define WORLD_MAP_NAME_RAISE 10
Referenced by fdMapScreenUpdateMarkers().
Definition at line 165 of file field_psynergy_map_screen_image.c.
MAP_SCREEN_CURSOR_LEFT
#define MAP_SCREEN_CURSOR_LEFT 17
The cursor sprite's left edge, this many pixels left of the cursor's point.
Referenced by fdMapScreenUpdateMarkers().
Definition at line 167 of file field_psynergy_map_screen_image.c.
WORLD_MAP_NAME_LEFT
#define WORLD_MAP_NAME_LEFT GERMAN_OR(3, 1)
The scrolled name's left edge, in pixels left of its place.
Referenced by fdMapScreenUpdateMarkers().
Definition at line 170 of file field_psynergy_map_screen_image.c.
WORLD_MAP_HIGH
#define WORLD_MAP_HIGH(value) (((Sint16 *)&(value))[1])
The upper halfword of value, its whole pixels.
Referenced by fdMapScreenUpdateMarkers().
Definition at line 173 of file field_psynergy_map_screen_image.c.
WORLD_MAP_SCALE
#define WORLD_MAP_SCALE(value) ((value) * 300 / 640)
A place on the World Map, in pixels, as a place on the image, 300 pixels to every 640.
Referenced by fdMapScreenUpdateMarkers().
Definition at line 176 of file field_psynergy_map_screen_image.c.
MARKER_NAME_PARTY
#define MARKER_NAME_PARTY -1
The names a marker shows besides its place's own.
"Present location"
Referenced by fdMapScreenUpdateMarkers().
Definition at line 179 of file field_psynergy_map_screen_image.c.
MARKER_NAME_SHIP
#define MARKER_NAME_SHIP -2
"Boat"
Referenced by fdMapScreenUpdateMarkers().
Definition at line 180 of file field_psynergy_map_screen_image.c.
SCROLL_X
#define SCROLL_X RamWorldMapScroll[0]
The map screen's scroll, x then y.
Referenced by fdMapScreenUpdateScroll().
Definition at line 696 of file field_psynergy_map_screen_image.c.
SCROLL_Y
#define SCROLL_Y RamWorldMapScroll[1]
Referenced by fdMapScreenUpdateScroll().
Definition at line 697 of file field_psynergy_map_screen_image.c.
Functions in detail
fdMapScreenStepToPlace
void fdMapScreenStepToPlace(Sint32 *screenX, Sint32 *screenY, Sint32 step)
R (step 1) and L (step -1) on the map screen: the cursor jumps to the next or the previous marked place round from the one nearest it, and its point on the image is written to screenX and screenY.
References fdMapScreenGetLeaderPoint(), fdPartyGetLeaderActor(), fdWorldMapPlaceGetMarker(), fdWorldMapPlacesGetTable(), Sint32 and syGameFlagGet().
Referenced by fdMapScreenShow().
Definition at line 41 of file field_psynergy_map_screen_image.c.
fdWindowSpriteListMove
void fdWindowSpriteListMove(WINDOW_SPR_LIST *list, Sint32 dx, Sint32 dy)
Moves every window sprite of a list by dx, dy: the output's position and its queued sprite's OAM x and y.
References mnWindowSpriteGetSprite() and Sint32.
Referenced by fdMapScreenUpdateMarkers().
Definition at line 139 of file field_psynergy_map_screen_image.c.
fdMapScreenUpdateMarkers
void fdMapScreenUpdateMarkers(void)
Each tick of the map screen: moves the cursor with the d-pad, faster the longer it is held, or glides it toward its target; draws a marker at each place visited, at the ship once it sails and at the party; with the d-pad released draws the cursor onto the nearest marker in reach, and shows that marker's name beside it.
References fdAreaGetNameIndex(), fdMapScreenGetLeaderPoint(), fdPartyGetLeaderActor(), fdWindowSpriteListMove(), fdWorldMapPlaceGetMarker(), fdWorldMapPlacesGetTable(), MainRoutineStateWork, MapScreenCursorMarker, MapScreenFirstListOnly, MapScreenGlideTargetX, MapScreenGlideTargetY, MapScreenNameRedrawDelay, MapScreenNameRedrawPending, MapScreenZoomed, mnTextDrawMessageStub(), mnTextMeasureMessageStub(), mnWindowSpritePrepareForRedrawStub(), PerWork, Sint32, syAtan(), syDivFX(), syGameFlagGet(), syOAMAddSpriteAtDepthClamped(), sySquartFX(), sySquartIWRAM(), syVectorAddPolarOffset(), TickCount, VramCacheEntries, WorldMapCursorDirectionAngles and WorldMapMarkerBlendCycle.
Referenced by fdMapScreenShow().
Definition at line 187 of file field_psynergy_map_screen_image.c.
fdMapScreenDraw
void fdMapScreenDraw(void)
Draws the map screen on BG1 with the cursor in the middle of the screen (or
the whole world, RESOURCE_WORLD_MAP_PICTURE, at the origin while
WorldMapStateWork.centered is set): the palette, then 21 rows of 31 tiles.
References BgScrollWork, Sint32, syDecompressTaggedLZ(), syDMAXCopy(), syResourceGetTableEntry() and WorldMapStateWork.
Referenced by fdMapScreenShow().
Definition at line 546 of file field_psynergy_map_screen_image.c.
fdMapScreenDrawRow
void fdMapScreenDrawRow(Uint32 column, Sint32 row)
Draws one row of the map screen on BG1 as it scrolls in, from a column to the image's right edge, at most 31 tiles (the Japanese release always draws 32): decodes the row into the map-metatile buffer and copies its tiles to BG1's.
References MapScreenZoomed, Sint32, syDecompressTaggedLZ(), syDMAXCopy() and syResourceGetTableEntry().
Referenced by fdMapScreenUpdateScroll().
Definition at line 626 of file field_psynergy_map_screen_image.c.
fdMapScreenDrawColumn
void fdMapScreenDrawColumn(Sint32 column, Sint32 row)
Draws one column of the map screen on BG1 as it scrolls in, 21 tiles down from a row, from the rows already decoded in the map-metatile buffer.
References Sint32 and syDMAXCopy().
Referenced by fdMapScreenUpdateScroll().
Definition at line 669 of file field_psynergy_map_screen_image.c.
fdMapScreenUpdateScroll
void fdMapScreenUpdateScroll(void)
The map screen's scroll follows the cursor. The target puts the cursor in the
middle of the screen (clamped to the image); unless the whole world shows,
the scroll moves a quarter of the way there each tick, at most 8 pixels, and
stops when nearer than a quarter pixel. Each time the scroll crosses into a
new column or row of tiles, that column (fdMapScreenDrawColumn) or row
(fdMapScreenDrawRow) is drawn; BG1 scrolls with it.
References BgScrollWork, fdMapScreenDrawColumn(), fdMapScreenDrawRow(), MapScreenCursor, MapScreenZoomed, Sint32, syDivFX(), sySquartFX() and sySquartIWRAM().
Referenced by fdMapScreenShow().
Definition at line 705 of file field_psynergy_map_screen_image.c.
fdMapScreenShow
Sint32 fdMapScreenShow(Sint32 mode)
The map screen, over the map-metatile buffer, until A or B closes it, to look
or to choose where to Teleport (MAP_SCREEN_MODE). While Start is held the
cursor glides to the party, and back when it is let go; R and L step it
between the places, and Select shows the whole world or the scrolling image.
References BgScrollWork, fdActorTableSnapshot(), fdMapScreenDraw(), fdMapScreenGetLeaderPoint(), fdMapScreenInit(), fdMapScreenRelease(), fdMapScreenStepToPlace(), fdMapScreenUpdateMarkers(), fdMapScreenUpdateScroll(), fdScriptFinishScreenTransition(), fdScriptStartScreenTransition(), fdScriptWaitTransitionTicks(), fdWorldMapLoadAreaGraphicsStub(), fdWorldMapPlacesGetTable(), fdWorldMapSetReturnForScene(), MainRoutineStateWork, MapScreenChoice, MapScreenCursorStartX, MapScreenCursorStartY, MapScreenGlideTargetX, MapScreenGlideTargetY, MapScreenScrollX, MapScreenScrollY, MapScreenZoomed, mnFieldMessageShowStub(), mnWindowSpritePrepareForRedrawStub(), mnWindowSystemInitFieldStub(), PerWork, Sint32, syGameFlagGet(), syGameFlagSet(), syInitEvent(), sySynch() and WorldMapStateWork.
Referenced by fdEngineRun().
Definition at line 788 of file field_psynergy_map_screen_image.c.
fdWorldMapZoomOutWhileLHeld
void fdWorldMapZoomOutWhileLHeld(void)
On the world map, zooms the view out to eight thirteenths while L is held,
then back, six ticks each way (FIELD_RAISED_CUE_WORLD_MAP_ZOOM).
References fdLeaderStopMoving(), fdWorldMapStartZoom(), MainRoutineStateWork, PerWork and sySynch().
Referenced by fdEngineRun().
Definition at line 1070 of file field_psynergy_map_screen_image.c.
fdWorldMapPlacesGetTable
const WORLD_MAP_PLACE *fdWorldMapPlacesGetTable(void)
Returns the flag entry table, 20-byte entries ended by a zero flag.
References WorldMapPlaces.
Referenced by fdFlagEntriesGetValue(), fdMapScreenShow(), fdMapScreenStepToPlace(), fdMapScreenUpdateMarkers(), fdWorldMapMarkPlaceVisited() and scWorldMapUpdatePlacedActors().
Definition at line 1091 of file field_psynergy_map_screen_image.c.
Variables in detail
WorldMapPlaces
extern const WORLD_MAP_PLACE WorldMapPlaces[]
The World Map's places, ended by a zero flag.
Referenced by fdWorldMapPlacesGetTable().
Definition at line 1066 of file field_psynergy_map_screen_image.c.