src/field/field_psynergy_tile_copies.c
Included by field_psynergy.c.
Macros
| Name | Description | |
|---|---|---|
#define | MAD_PLANT_LEAP_TICKS 20 | The ticks of a Mad Plant's leap at the leader. |
#define | CYCLONE_ARC_PIXELS 30 | The pixels of one of the Cyclone's arcs, and the angle from one to the next, about two degrees. |
#define | CYCLONE_ARC_PIXEL_STEP 368 |
Functions
| Name | Description | |
|---|---|---|
void | fdPsynergyGatherNearbyMetatiles (void) | Finds what Cyclone reaches: of the 21 metatiles round the caster (FieldPsynergyNearbyMetatileOffsets) on its layer, those of a CYCLONE_METATILE_KIND within reach are listed, as metatiles, in the field state's points, which end with -1, -1. |
Sint32 | fdMapGridGetMetatileBehavior (Sint32 x, Sint32 z, Sint32 layer) | Read here as a word, though the definition returns a Uint8. |
void | fdPsynergyRunTouchedScripts (void) | Runs the place's Psynergy script once for each kind of metatile Cyclone touched (FIELD_STATE.psynergyMetatiles), lowest metatile behaviour first. |
MAP_METATILE * | fdMapGridGetMetatileAt (Sint32 x, Sint32 z, Sint32 layer) | Returns the map metatile at position x, z in the given layer, read from the world map's blocks or the metatile buffer by the script state's mode. |
void | fdTileCopiesCopyTouchedMetatiles (Sint32 srcX, Sint32 srcZ, Sint32 width, Sint32 height, Sint32 windowX, Sint16 windowZ, Sint32 layerIndex) | Clears what Cyclone blew away: each metatile of FIELD_STATE.psynergyMetatiles that falls in the width by height window at (windowX, windowZ) of layerIndex (counted from the layer's scroll and the leader's height) takes the metatile picture from the same place of the window at (srcX, srcZ), is opened on layer 2, and is recorded (up to 64) in TouchCopiesWork to be made again. |
void | fdTileCopiesRestore (void) | Makes again each copy fdTileCopiesCopyTouchedMetatiles recorded: copies the metatile picture back and opens the metatile on layer 2. |
void | fdCycloneCopyTouchedMetatiles (Sint32 x, Sint32 z, Sint16 layerIndex, Sint16 width, Sint16 height, Sint32 toX, Sint32 toZ) | Clears the weeds the Cyclone blew away: for each metatile it touched (the field state's list from fdPsynergyGatherNearbyMetatiles) inside the width by height rectangle at (x, z) of the layer, copies the matching metatile tiles from the rectangle at (toX, toZ) over it, opens it on layer 2 and records the copy in TouchCopiesWork, up to 64. |
void | fdMadPlantLeapAtLeader (Sint32 sprite, Sint32 x, Sint32 z) | A Mad Plant (sprite) springs out of the bushes cleared at the metatile (x, z): it grows, turns to the leader, hops twice and leaps at the leader in an arc before the battle. |
void | fdCyclonePlotArc (Sint32 radius, Sint32 angle, Uint16 *offsets, Uint8 *pixels) | Plots an arc of CYCLONE_ARC_PIXELS pixels at radius (at most 31) from the middle of the canvas, from angle on, shading through the canvas palette's colours 1 to 15; offsets maps each point to its byte. |
void | fdParticleBurstStart (void) | Starts Cyclone's 96 leaves, scattered round the caster and spinning, to blow toward the first metatile of FIELD_STATE.psynergyMetatiles (fdParticleBurstUpdate moves them). |
Macros in detail
MAD_PLANT_LEAP_TICKS
#define MAD_PLANT_LEAP_TICKS 20
The ticks of a Mad Plant's leap at the leader.
Referenced by fdMadPlantLeapAtLeader().
Definition at line 223 of file field_psynergy_tile_copies.c.
CYCLONE_ARC_PIXELS
#define CYCLONE_ARC_PIXELS 30
The pixels of one of the Cyclone's arcs, and the angle from one to the next, about two degrees.
Referenced by fdCyclonePlotArc().
Definition at line 226 of file field_psynergy_tile_copies.c.
CYCLONE_ARC_PIXEL_STEP
#define CYCLONE_ARC_PIXEL_STEP 368
Referenced by fdCyclonePlotArc().
Definition at line 227 of file field_psynergy_tile_copies.c.
Functions in detail
fdPsynergyGatherNearbyMetatiles
void fdPsynergyGatherNearbyMetatiles(void)
Finds what Cyclone reaches: of the 21 metatiles round the caster
(FieldPsynergyNearbyMetatileOffsets) on its layer, those of a
CYCLONE_METATILE_KIND within reach are listed, as metatiles, in the field
state's points, which end with -1, -1. A metatile to blow away
(CYCLONE_METATILE_BURST) also sets CYCLONE_STATE.kind; the last carry and
lift metatiles are kept as the pixels of their centres, in cycloneCarryX, Z
and cycloneLiftX, Z.
References fdMapGridGetCycloneMetatileKind(), fdMeasurePsynergyHeight(), FieldPsynergyNearbyMetatileOffsets and Sint32.
Referenced by fdPsynergyCyclone().
Definition at line 10 of file field_psynergy_tile_copies.c.
fdPsynergyRunTouchedScripts
void fdPsynergyRunTouchedScripts(void)
Runs the place's Psynergy script once for each kind of metatile Cyclone
touched (FIELD_STATE.psynergyMetatiles), lowest metatile behaviour first.
References fdFindPsynergyCue(), fdMapGridGetMetatileBehavior(), fdRunPsynergyScript() and Sint32.
Referenced by fdPsynergyCyclone().
Definition at line 90 of file field_psynergy_tile_copies.c.
fdTileCopiesCopyTouchedMetatiles
void fdTileCopiesCopyTouchedMetatiles(Sint32 srcX, Sint32 srcZ, Sint32 width, Sint32 height, Sint32 windowX, Sint16 windowZ, Sint32 layerIndex)
Clears what Cyclone blew away: each metatile of FIELD_STATE.psynergyMetatiles
that falls in the width by height window at (windowX, windowZ) of layerIndex
(counted from the layer's scroll and the leader's height) takes the metatile
picture from the same place of the window at (srcX, srcZ), is opened on layer
2, and is recorded (up to 64) in TouchCopiesWork to be made again.
References fdActorGetById(), fdMapGridCopyDrawnPicturesRectStub(), fdMapGridGetMetatileAt(), fdPartyGetLeaderActor() and Sint32.
Referenced by scContigoCopyTouchedMetatiles(), scFieldTileCopiesCopyTouchedMetatiles(), scSettlementsCutLadderBush(), scTaopoSwampCopyTouchedMetatiles() and scYallamUncoverCaveHole().
Definition at line 153 of file field_psynergy_tile_copies.c.
fdTileCopiesRestore
void fdTileCopiesRestore(void)
Makes again each copy fdTileCopiesCopyTouchedMetatiles recorded: copies the
metatile picture back and opens the metatile on layer 2.
References fdMapGridCopyDrawnPicturesRectStub(), fdMapGridGetMetatileAt() and Sint32.
Referenced by fdEngineRun().
Definition at line 204 of file field_psynergy_tile_copies.c.
fdCycloneCopyTouchedMetatiles
void fdCycloneCopyTouchedMetatiles(Sint32 x, Sint32 z, Sint16 layerIndex, Sint16 width, Sint16 height, Sint32 toX, Sint32 toZ)
Clears the weeds the Cyclone blew away: for each metatile it touched (the
field state's list from fdPsynergyGatherNearbyMetatiles) inside the width by
height rectangle at (x, z) of the layer, copies the matching metatile tiles
from the rectangle at (toX, toZ) over it, opens it on layer 2 and records the
copy in TouchCopiesWork, up to 64. Gaia Rock calls it after a Cyclone.
References fdActorGetById(), fdMapGridCopyDrawnPicturesRectStub(), fdMapGridGetMetatileAt(), fdPartyGetLeaderActor() and Sint32.
Referenced by scFieldCycloneCopyTouchedMetatiles().
Definition at line 234 of file field_psynergy_tile_copies.c.
fdMadPlantLeapAtLeader
void fdMadPlantLeapAtLeader(Sint32 sprite, Sint32 x, Sint32 z)
A Mad Plant (sprite) springs out of the bushes cleared at the metatile (x, z): it grows, turns to the leader, hops twice and leaps at the leader in an arc before the battle. The Gabomba Catacombs, Taopo Swamp and Gaia Rock each hide one.
References fdActorCreateStub(), fdActorGetById(), fdActorSelectAnimationStub(), fdActorSetSpriteFlagsStub(), fdActorStartRepeatedMotion(), fdActorTurnPairToFaceEachOther(), fdEffectSetAttached(), fdPartyGetLeaderActor(), fdScriptWait(), Sint32, sySin(), sySoundPlayStub() and sySynch().
Referenced by scFieldMadPlantLeapAtLeader(), scGabombaCatacombsMadPlantLeaps(), scGaiaRockInsideMadPlantLeaps() and scTaopoSwampLeapAtLeader().
Definition at line 300 of file field_psynergy_tile_copies.c.
fdCyclonePlotArc
void fdCyclonePlotArc(Sint32 radius, Sint32 angle, Uint16 *offsets, Uint8 *pixels)
Plots an arc of CYCLONE_ARC_PIXELS pixels at radius (at most 31) from the
middle of the canvas, from angle on, shading through the canvas palette's
colours 1 to 15; offsets maps each point to its byte. The Cyclone draws its
swirl with it.
References Sint32, syCos() and sySin().
Referenced by fdPsynergyCyclone().
Definition at line 362 of file field_psynergy_tile_copies.c.
fdParticleBurstStart
void fdParticleBurstStart(void)
Starts Cyclone's 96 leaves, scattered round the caster and spinning, to blow
toward the first metatile of FIELD_STATE.psynergyMetatiles
(fdParticleBurstUpdate moves them).
References fdEffectSpriteInit(), fdParticleBurstUpdate(), Sint32, syAtan(), syDecompressTaggedLZ(), syRandom(), syResourceGetTableEntry(), sySetEvent(), sySoundPlayStub(), syVectorAddPolarOffset(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().
Referenced by fdPsynergyCyclone().
Definition at line 385 of file field_psynergy_tile_copies.c.