src/field/field_view.c
The screen shake, and two parts of the world map's view: its still image drawn from its tile maps, and its ground tilted away from the camera, worked out a screen line at a time. More…
Included by field.c.
Macros
| Name | Description | |
|---|---|---|
#define | MAPGRID_SHAKE_SETTLE_TICKS 300 | The longest fdMapGridWaitForShakeToSettle waits, five seconds. |
#define | MAPGRID_SHAKE_SETTLE_MAX_AMPLITUDE (toFIXED(1) / 256 - 1) | The largest shake that counts as settled, just under 1/256 pixel. |
#define | WORLD_MAP_TILE_MAP_BYTES (64 * 64) | One of the world map's two tile maps of one-byte tiles, BG3's and then BG2's, as fdWorldMapStartStillImage copies them into DecodeBuffer. |
Typedefs
| Name | Description | |
|---|---|---|
typedef const WORLD_MAP_AFFINE_PAIR *(* | TILE_MAP_ROW_DRAWER )( const WORLD_MAP_AFFINE_PAIR *lines, Uint8 *pixels, const Uint8 *tiles, const Uint8 *map); | The ARM function copied to RAM reads the BG2 affine row from each 32-byte pair and writes 240 by 160 pixels as 256-colour tiles; it returns the address past the last pair, where its row cursor stops. |
Functions
| Name | Description | |
|---|---|---|
void | fdMapGridSetScreenShake (FIXED shakeX, FIXED shakeY, FIXED shakeDecay) | Changes the shake without restarting an axis whose argument is negative. |
void | fdMapGridWaitForShakeToSettle (void) | Waits until both shake amplitudes have settled, at most MAPGRID_SHAKE_SETTLE_TICKS for a shake whose decay never settles. |
void | fdTileMapDrawRowsFromRam (const WORLD_MAP_AFFINE_PAIR *lines, Uint8 *pixels) | Draws the current affine page into the world map's still-image pixels. |
void | fdWorldMapBuildScanlineTable (FIXED pitchSlope, Sint32 *pos, WORLD_MAP_SCANLINE *scanline) | Works out each screen line of the world map's tilted ground: how much the ground is scaled on that line and how far along it the line lies from the followed point, for a camera pitched by pitchSlope. |
Description
The screen shake, and two parts of the world map's view: its still image
drawn from its tile maps, and its ground tilted away from the camera, worked
out a screen line at a time. Part of field.c.
Macros in detail
MAPGRID_SHAKE_SETTLE_TICKS
#define MAPGRID_SHAKE_SETTLE_TICKS 300
The longest fdMapGridWaitForShakeToSettle waits, five seconds.
Referenced by fdMapGridWaitForShakeToSettle().
Definition at line 8 of file field_view.c.
MAPGRID_SHAKE_SETTLE_MAX_AMPLITUDE
#define MAPGRID_SHAKE_SETTLE_MAX_AMPLITUDE (toFIXED(1) / 256 - 1)
The largest shake that counts as settled, just under 1/256 pixel.
Referenced by fdMapGridWaitForShakeToSettle().
Definition at line 10 of file field_view.c.
WORLD_MAP_TILE_MAP_BYTES
#define WORLD_MAP_TILE_MAP_BYTES (64 * 64)
One of the world map's two tile maps of one-byte tiles, BG3's and then BG2's,
as fdWorldMapStartStillImage copies them into DecodeBuffer.
Referenced by fdTileMapDrawRowsFromRam().
Definition at line 13 of file field_view.c.
Typedefs in detail
TILE_MAP_ROW_DRAWER
typedef const WORLD_MAP_AFFINE_PAIR *(*TILE_MAP_ROW_DRAWER)( const WORLD_MAP_AFFINE_PAIR *lines, Uint8 *pixels, const Uint8 *tiles, const Uint8 *map);
The ARM function copied to RAM reads the BG2 affine row from each 32-byte pair and writes 240 by 160 pixels as 256-colour tiles; it returns the address past the last pair, where its row cursor stops.
Referenced by fdTileMapDrawRowsFromRam().
Definition at line 62 of file field_view.c.
Functions in detail
fdMapGridSetScreenShake
void fdMapGridSetScreenShake(FIXED shakeX, FIXED shakeY, FIXED shakeDecay)
Changes the shake without restarting an axis whose argument is negative. Amplitudes are 16.16 pixels and decay is a 16.16 multiplier per tick.
Referenced by fdMapGridSetShakeFX(), scInit() and scSolSanctumElementalStarRoomBagVenusStar().
Definition at line 17 of file field_view.c.
fdMapGridWaitForShakeToSettle
void fdMapGridWaitForShakeToSettle(void)
Waits until both shake amplitudes have settled, at most
MAPGRID_SHAKE_SETTLE_TICKS for a shake whose decay never settles.
References Sint32 and sySynch().
Referenced by scAltmillerCaveReleaseWallBurst(), scBabiLighthouseLandWithParticles(), scColosseumEntranceShowClearedTrial(), scGomaCavePillarPushStumpOver(), scGondowanCaveLeapStump(), scInit(), scLeapStump(), scMercuryLighthouseAeriePartyArrives(), scMercuryLighthouseExitWhenChannelsOpen(), scMercuryLighthousePlyOpensWaterfallPassage(), scMercuryLighthouseRestoreNorthJetTiles(), scMercuryLighthouseStartNorthJet(), scMogallForestKillerApeAttacks(), scSolSanctumElementalStarRoomBagJupiterStar(), scSolSanctumElementalStarRoomBagMercuryStar(), scSolSanctumElementalStarRoomBagVenusStar(), scSolSanctumEruptionPlayHostageScript(), scSolSanctumEruptionPlayWiseOneRescue(), scTreeRoomsLandFromFall(), scTunnelRuinsSinkNorthwestPillar(), scTunnelRuinsSinkSoutheastPillar(), scValeEruptionReturnFromMtAleph(), scValePrologueFirstRockFalls(), scValePrologueFourthRockFalls(), scValePrologueSecondRockFalls(), scValePrologueShowBoulderSweepingDownriver(), scValePrologueThirdRockFalls(), scValeRoofMended(), scValeUnusedRoofMended(), scVaultCaveRunRumble(), scVenusLighthouseLandWithRadialDust(), scVenusLighthouseStepOnEastWallSwitch(), scVenusLighthouseStepOnWallSwitch() and scVenusLighthouseStepOnWestWallSwitch().
Definition at line 40 of file field_view.c.
fdTileMapDrawRowsFromRam
void fdTileMapDrawRowsFromRam(const WORLD_MAP_AFFINE_PAIR *lines, Uint8 *pixels)
Draws the current affine page into the world map's still-image pixels.
fdWorldMapStartStillImage supplies 160 pairs and a 240 by 160 byte output.
References BgTileBuffer, DecodeBuffer, fdTileMapDrawRows, fdTileMapDrawRowsCodeSize, HeapSlots, pixels and syHeapSlotRelease().
Referenced by fdWorldMapStartStillImage().
Definition at line 70 of file field_view.c.
fdWorldMapBuildScanlineTable
void fdWorldMapBuildScanlineTable(FIXED pitchSlope, Sint32 *pos, WORLD_MAP_SCANLINE *scanline)
Works out each screen line of the world map's tilted ground: how much the ground is scaled on that line and how far along it the line lies from the followed point, for a camera pitched by pitchSlope. The lines above the horizon, sky, get zeros.
References line, ProjectionWork, Sint32, syCalcPoint(), syDivFX(), syMulFX() and sySquartIWRAM().
Referenced by fdWorldMapInitPerspective() and fdWorldMapUpdateView().
Definition at line 90 of file field_view.c.