Skip to Content
The Alchemy Project

src/field/field_psynergy_parch.c

Parch, then two drawing helpers of the Ring's: a canvas pixel on a circle, and its 16 by 16-tile picture copied to BG0 clipped to the screen. More…

Included by field_psynergy.c.

Structures

NameDescription
structPARCH_PUFFA puff of Parch's steam: its place, its sway and rise, and its age.
structPARCH_STATEParch's state (heap slot HEAP_SLOT_BATTLE_EFFECT): the glow disc over the target and the 64 puffs of steam that rise as it dries.

Macros

NameDescription
#definePARCH_PUFF_COUNT 64The puffs of steam Parch keeps, a power of two: the next wraps by a mask.
#definePARCH_DISC_TILE_OFFSET 128The disc's tiles, this many tiles after the window sprites' glyph tiles.
#definePARCH_GLOW_COLORS 32The disc's colours, the last 32 of the sprite palette, which glow as the Ring's do (GLOW_RED and the rest); the white flash of drying water raises them all.
#defineCLIPPED_PICTURE_TILES 16The picture fdBgMapDrawClipped16x16 draws, 16 tiles square.

Enumerations

NameDescription
enumPARCH_RESULT { PARCH_NOTHING, PARCH_WATER, PARCH_DRIES }What Parch finds before the caster.
enumPARCH_PHASE { PARCH_SWELLS, PARCH_HOLDS, PARCH_EMPTY_SHRINKS, PARCH_STEAMS … }The stages of Parch's disc, which differ by what it finds (PARCH_RESULT).

Functions

NameDescription
voidfdPsynergyParchOnTarget (void)Parch cast on a target: runs fdPsynergyParch.
voidfdBattleEffectFadeToSavedPalettes (Sint32 ticks)Fades the palettes back to the saved ones over the given ticks.
voidfdPsynergyParch (void)Parch ("Evaporate standing water."): a glowing disc spreads 32 pixels before the caster and white puffs rise from it.
voidfdBattleEffectPlotCanvasPixel (Sint32 x, Sint32 y, Sint32 color)Plots a pixel of colour color at (x, y) on the 128-pixel-wide canvas pair: x from 64 lands on the second canvas.
voidfdCanvasPlotPolarPixel (Sint32 unused, FIXED radius, Sint32 angle, Sint32 color)Plots one pixel of the 128x64 canvas on a circle around its bottom middle (63, 63): a radius (16.16) and an angle, the cosine leftward and the sine upward.
voidfdBgMapDrawClipped16x16 (Sint32 x, Sint32 y)Copies the Ring's 16x16-tile picture (RingPictureTiles) to the top left of BG0's map, leaving out the tiles that would fall off the 30x20-tile screen once BG0 is scrolled to show the picture at (x, y), in pixels.

Variables

NameDescription
extern const Uint16RingPictureTiles []The screen entries of the Ring's 16x16-tile picture (fdBgMapDrawClipped16x16), row by row: tile numbers with their flip bits.

Description

Parch, then two drawing helpers of the Ring's: a canvas pixel on a circle, and its 16 by 16-tile picture copied to BG0 clipped to the screen. Part of field_psynergy.c.

Macros in detail

PARCH_PUFF_COUNT

#define PARCH_PUFF_COUNT 64

The puffs of steam Parch keeps, a power of two: the next wraps by a mask.

Referenced by fdPsynergyParch().

Definition at line 24 of file field_psynergy_parch.c.

PARCH_DISC_TILE_OFFSET

#define PARCH_DISC_TILE_OFFSET 128

The disc's tiles, this many tiles after the window sprites' glyph tiles.

Referenced by fdPsynergyParch().

Definition at line 26 of file field_psynergy_parch.c.

PARCH_GLOW_COLORS

#define PARCH_GLOW_COLORS 32

The disc's colours, the last 32 of the sprite palette, which glow as the Ring's do (GLOW_RED and the rest); the white flash of drying water raises them all.

Referenced by fdPsynergyParch().

Definition at line 30 of file field_psynergy_parch.c.

CLIPPED_PICTURE_TILES

#define CLIPPED_PICTURE_TILES 16

The picture fdBgMapDrawClipped16x16 draws, 16 tiles square.

Referenced by fdBgMapDrawClipped16x16().

Definition at line 452 of file field_psynergy_parch.c.

Enumerations in detail

PARCH_RESULT

enum PARCH_RESULT

What Parch finds before the caster.

EnumeratorValueDescription
PARCH_NOTHING0no water: the disc swells and shrinks
PARCH_WATER1water with no Parch script: steam rises from it
PARCH_DRIES2a puddle, or water with a Parch script: it dries up in a white flash

Definition at line 33 of file field_psynergy_parch.c.

PARCH_PHASE

enum PARCH_PHASE

The stages of Parch's disc, which differ by what it finds (PARCH_RESULT). Every result starts with PARCH_SWELLS.

EnumeratorValueDescription
PARCH_SWELLS0The disc grows, to three quarters (a quarter on nothing).
PARCH_HOLDS1On nothing: the disc holds for 30 ticks, then
PARCH_EMPTY_SHRINKS2shrinks away.
PARCH_STEAMS1On water: steam rises two puffs a tick, then one, and the disc shrinks away. Water that dries flashes white 40 ticks into the steam, and the cast ends with the thinner steam.
PARCH_STEAM_THINS2
PARCH_STEAM_SHRINKS3

Definition at line 43 of file field_psynergy_parch.c.

Functions in detail

fdPsynergyParchOnTarget

void fdPsynergyParchOnTarget(void)

Parch cast on a target: runs fdPsynergyParch.

References fdPsynergyParch().

Referenced by fdPsynergyDispatch().

Definition at line 6 of file field_psynergy_parch.c.

fdPsynergyParch

void fdPsynergyParch(void)

Parch ("Evaporate standing water."): a glowing disc spreads 32 pixels before the caster and white puffs rise from it. On a puddle (SPRITE_PUDDLE), or on water with a Parch script, the water there dries up and the script runs.

References fdActorGetById(), fdActorSetHorizontalPosWithTerrain(), fdBattleEffectFadeToSavedPalettes(), fdCameraWorldToScreen(), fdEffectSpriteDraw(), fdEffectSpriteInit(), fdFindPsynergyCue(), fdMapGridGetMetatileBehavior(), fdMapGridIsWaterMetatile(), fdMapGridSetMetatileBehavior(), fdMeasurePsynergyHeight(), fdPaletteFadeSetTarget(), fdPaletteFadeStartInterpolation(), fdPsynergyCheckOverlap(), fdPsynergyFadeFromCastColor(), fdPsynergyFadeToCastColor(), fdPsynergyGetCanvasPriority(), fdRunPsynergyScript(), result, Sint32, syDecompressTaggedLZ(), syDMAXCopy(), syHeapSlotAllocate(), syHeapSlotRelease(), syRandom(), syResourceGetTableEntry(), sySin(), sySoundPlayStub(), sySynch(), syVectorAddPolarOffset(), syVRAMCacheFindFreeEntry(), syVRAMCacheFreeEntry() and syVRAMCacheLoad().

Referenced by fdPsynergyParchOnTarget() and fdPsynergyRun().

Definition at line 78 of file field_psynergy_parch.c.

fdCanvasPlotPolarPixel

void fdCanvasPlotPolarPixel(Sint32 unused, FIXED radius, Sint32 angle, Sint32 color)

Plots one pixel of the 128x64 canvas on a circle around its bottom middle (63, 63): a radius (16.16) and an angle, the cosine leftward and the sine upward.

References fdBattleEffectPlotCanvasPixel(), Sint32, syCos() and sySin().

Referenced by fdPsynergyRing().

Definition at line 438 of file field_psynergy_parch.c.

fdBgMapDrawClipped16x16

void fdBgMapDrawClipped16x16(Sint32 x, Sint32 y)

Copies the Ring's 16x16-tile picture (RingPictureTiles) to the top left of BG0's map, leaving out the tiles that would fall off the 30x20-tile screen once BG0 is scrolled to show the picture at (x, y), in pixels.

References RingPictureTiles and Sint32.

Referenced by fdPsynergyUpdateRing().

Definition at line 457 of file field_psynergy_parch.c.