src/field/field_engine_ground_mask.c
The ground mask: 16-pixel sprites kept beside an actor where the ground before it rises, in a fade form nothing starts and a blank form Aqua Rock starts, which draws no visible pixel; and the effect sprites that borrow their tiles. More…
Included by field_engine.c.
Macros
| Name | Description | |
|---|---|---|
#define | METATILE_GRID_ROW_MASK 0xf0 | A screen row's map metatile, in pixels, in an OAM entry's 8-bit y, as MAPGRID_METATILE_PIXEL_MASK is for a whole pixel coordinate. |
#define | METATILE_BLANK_OVERLAY 0x01 | MAP_METATILE.attributeB's lowest bit, on the map's third layer: a metatile the blank overlay marks. |
Functions
| Name | Description | |
|---|---|---|
void | fdFadeOverlayDrawMarks (void) | Each tick of the fade overlay: on each of the two metatiles beside the actor (left and right of it), where the ground one or two metatiles south rises above the actor's floor, draws a semi-transparent 16-pixel-wide sprite of colour 1 at the height of that ground. |
void | fdEffectStartFadeOverlay (void *actor) | Starts the fade overlay on an actor (the party leader when NULL): loads its solid tiles, sets the blending and draws it each tick. |
void | fdFadeOverlaySuspend (void) | Stops drawing the fade overlay, keeping its state. |
void | fdFadeOverlayResume (void) | Draws the fade overlay again after fdFadeOverlaySuspend. |
void | fdBlankOverlayDrawMarks (void) | The blank overlay's event, which fdEffectStartBlankOverlay starts: each tick it draws a 16-pixel mark beside the actor where the map's third layer flags a metatile two rows up (left or right of the actor), and another for the row one up. |
void | fdEffectStartBlankOverlay (Sint32 actor) | Like fdEffectStartFadeOverlay with blank tiles and no blending: loads 512 bytes of blank tiles into VRAM_CACHE_ENTRY_GROUND_MASK and starts fdBlankOverlayDrawMarks on an actor (the party leader when 0). |
void | fdBlankOverlaySuspend (void) | Suspends the fdBlankOverlayDrawMarks overlay event. |
void | fdBlankOverlayResume (void) | Resumes the fdBlankOverlayDrawMarks overlay event. |
void | fdFadeOverlayFillTiles (Sint32 solid) | Fills the overlay's 512 bytes of sprite tiles (VRAM_CACHE_ENTRY_GROUND_MASK) with PIXELS_8BPP(1) when solid is set, which in these 16-colour tiles is colour 1 in every other column (no caller sets it), else clears them. |
void | fdEffectSpriteInitWithFadeOverlay (EFFECT_SPR *sprite, Sint32 pivotX, Sint32 pivotY, Uint32 attributes) | Sets up sprite through fdEffectSpriteInit with the overlay's tiles (VRAM_CACHE_ENTRY_GROUND_MASK), at priority 1 in palette 0. |
void | fdEffectSpriteDrawAtWorldXYZ (EFFECT_SPR *sprite, Sint32 x, Sint32 y, Sint32 z) | Projects the world position (x, y, z) to the screen, stores it as the effect sprite's position and draws the sprite. |
void | fdEffectSpriteInitWithFadeOverlayBlended (EFFECT_SPR *sprite, Sint32 pivotX, Sint32 pivotY, Uint32 attributes) | As fdEffectSpriteInitWithFadeOverlay, semi-transparent and at priority 0. |
Description
The ground mask: 16-pixel sprites kept beside an actor where the ground
before it rises, in a fade form nothing starts and a blank form Aqua Rock
starts, which draws no visible pixel; and the effect sprites that borrow
their tiles. Part of field_engine.c.
Macros in detail
METATILE_GRID_ROW_MASK
#define METATILE_GRID_ROW_MASK 0xf0
A screen row's map metatile, in pixels, in an OAM entry's 8-bit y, as
MAPGRID_METATILE_PIXEL_MASK is for a whole pixel coordinate.
Referenced by fdBlankOverlayDrawMarks() and fdFadeOverlayDrawMarks().
Definition at line 8 of file field_engine_ground_mask.c.
METATILE_BLANK_OVERLAY
#define METATILE_BLANK_OVERLAY 0x01
MAP_METATILE.attributeB's lowest bit, on the map's third layer: a metatile
the blank overlay marks. The marks' tiles are colour 0, transparent (GBATEK
"Color Palette RAM", Transparent Colors), so the player sees nothing of them.
Referenced by fdBlankOverlayDrawMarks().
Definition at line 12 of file field_engine_ground_mask.c.
Functions in detail
fdFadeOverlayDrawMarks
void fdFadeOverlayDrawMarks(void)
Each tick of the fade overlay: on each of the two metatiles beside the actor (left and right of it), where the ground one or two metatiles south rises above the actor's floor, draws a semi-transparent 16-pixel-wide sprite of colour 1 at the height of that ground.
References fdMapGridGetTerrainHeightStub(), fdMapStateView(), Sint32, syOAMAddSpriteAtDepthClamped() and VramCacheEntries.
Referenced by fdEffectStartFadeOverlay(), fdFadeOverlayResume() and fdFadeOverlaySuspend().
Definition at line 18 of file field_engine_ground_mask.c.
fdEffectStartFadeOverlay
void fdEffectStartFadeOverlay(void *actor)
Starts the fade overlay on an actor (the party leader when NULL): loads its
solid tiles, sets the blending and draws it each tick. Unused: nothing calls
it, nor the stub call engine_stubs.s exports for it.
References fdActorLookup(), fdFadeOverlayDrawMarks(), MainRoutineStateWork, syHeapSlotAllocate(), syHeapSlotAllocateEWRAM(), syHeapSlotRelease(), sySetEvent() and syVRAMCacheLoad().
Definition at line 102 of file field_engine_ground_mask.c.
fdFadeOverlaySuspend
void fdFadeOverlaySuspend(void)
Stops drawing the fade overlay, keeping its state.
References fdFadeOverlayDrawMarks() and sySuspendEvent().
Definition at line 128 of file field_engine_ground_mask.c.
fdFadeOverlayResume
void fdFadeOverlayResume(void)
Draws the fade overlay again after fdFadeOverlaySuspend.
References fdFadeOverlayDrawMarks() and syResumeEvent().
Definition at line 134 of file field_engine_ground_mask.c.
fdBlankOverlayDrawMarks
void fdBlankOverlayDrawMarks(void)
The blank overlay's event, which fdEffectStartBlankOverlay starts: each tick
it draws a 16-pixel mark beside the actor where the map's third layer flags a
metatile two rows up (left or right of the actor), and another for the row
one up.
References fdMapStateView(), Sint32, syOAMAddSpriteAtDepthClamped() and VramCacheEntries.
Referenced by fdBlankOverlayResume(), fdBlankOverlaySuspend() and fdEffectStartBlankOverlay().
Definition at line 143 of file field_engine_ground_mask.c.
fdEffectStartBlankOverlay
void fdEffectStartBlankOverlay(Sint32 actor)
Like fdEffectStartFadeOverlay with blank tiles and no blending: loads 512
bytes of blank tiles into VRAM_CACHE_ENTRY_GROUND_MASK and starts
fdBlankOverlayDrawMarks on an actor (the party leader when 0). Aqua Rock's
rooms start it; its marks are all colour 0, so nothing shows.
References fdActorLookup(), fdBlankOverlayDrawMarks(), MainRoutineStateWork, Sint32, syHeapSlotAllocate(), syHeapSlotAllocateEWRAM(), syHeapSlotRelease(), sySetEvent() and syVRAMCacheLoad().
Referenced by scAlhafranCaveSetUpJail(), scInit(), scKandoreanTempleStartChestbeaterRoom(), scKandoreanTempleStartCurrentRoom(), scKandoreanTempleStartFogRoom(), scKandoreanTempleStartLiftRoom(), scKandoreanTempleStartMimicRoom(), scKandoreanTempleStartStreamRoom(), scKandoreanTempleStartVentRoom(), scKibomboInitVillage(), scPrepareMap(), scProxInitCaveHomes(), scProxInitHouses(), scShrineOfTheSeaGodInitCrossroads(), scYampiDesertSetUpEntrance(), scYampiDesertSetUpKingScorpion(), scYampiDesertSetUpPsynergyStone() and scYampiDesertSetUpPuddles().
Definition at line 202 of file field_engine_ground_mask.c.
fdBlankOverlaySuspend
void fdBlankOverlaySuspend(void)
Suspends the fdBlankOverlayDrawMarks overlay event.
References fdBlankOverlayDrawMarks() and sySuspendEvent().
Definition at line 218 of file field_engine_ground_mask.c.
fdBlankOverlayResume
void fdBlankOverlayResume(void)
Resumes the fdBlankOverlayDrawMarks overlay event.
References fdBlankOverlayDrawMarks() and syResumeEvent().
Definition at line 224 of file field_engine_ground_mask.c.
fdFadeOverlayFillTiles
void fdFadeOverlayFillTiles(Sint32 solid)
Fills the overlay's 512 bytes of sprite tiles (VRAM_CACHE_ENTRY_GROUND_MASK)
with PIXELS_8BPP(1) when solid is set, which in these 16-colour tiles is
colour 1 in every other column (no caller sets it), else clears them.
References Sint32, syHeapSlotAllocate(), syHeapSlotRelease() and syVRAMCacheLoad().
Referenced by scAlhafranCaveSetUpJail() and scInit().
Definition at line 232 of file field_engine_ground_mask.c.
fdEffectSpriteInitWithFadeOverlay
void fdEffectSpriteInitWithFadeOverlay(EFFECT_SPR *sprite, Sint32 pivotX, Sint32 pivotY, Uint32 attributes)
Sets up sprite through fdEffectSpriteInit with the overlay's tiles
(VRAM_CACHE_ENTRY_GROUND_MASK), at priority 1 in palette 0.
References fdEffectSpriteInit(), Sint32 and VramCacheEntries.
Referenced by scAlhafranCaveSetUpJail() and scInit().
Definition at line 250 of file field_engine_ground_mask.c.
fdEffectSpriteDrawAtWorldXYZ
void fdEffectSpriteDrawAtWorldXYZ(EFFECT_SPR *sprite, Sint32 x, Sint32 y, Sint32 z)
Projects the world position (x, y, z) to the screen, stores it as the effect sprite's position and draws the sprite.
References fdCameraWorldToScreen(), fdEffectSpriteDraw() and Sint32.
Referenced by scAlhafranCaveDrawCrateSprite(), scAlhafraRoomsDrawFirstGuestSprite(), scAlhafraRoomsDrawSecondGuestSprite() and scJupiterLighthouseDrawGlow().
Definition at line 269 of file field_engine_ground_mask.c.
fdEffectSpriteInitWithFadeOverlayBlended
void fdEffectSpriteInitWithFadeOverlayBlended(EFFECT_SPR *sprite, Sint32 pivotX, Sint32 pivotY, Uint32 attributes)
As fdEffectSpriteInitWithFadeOverlay, semi-transparent and at priority 0.
References fdEffectSpriteInit(), Sint32 and VramCacheEntries.
Referenced by scInit().
Definition at line 284 of file field_engine_ground_mask.c.