src/battle/battle_element_glow.c
A unit's elemental glow: the star field and the other glows. More…
Included by battle.c.
Structures
| Name | Description | |
|---|---|---|
struct | SPARK | One of the star field's sparks, drawn inward to the centre. |
struct | SPARK_STATE | The star field's state, for the 45 ticks of a cast's glow. |
Macros
| Name | Description | |
|---|---|---|
#define | STAR_FIELD_SPARKS 16 | The star field's sparks and rings, and the ticks in which a spent spark starts again. |
#define | STAR_FIELD_RINGS 3 | |
#define | STAR_FIELD_SPAWN_TICKS 25 | |
#define | STAR_FIELD_SIZE 128 | The canvas's width and height in pixels. |
#define | STAR_FIELD_CENTER (STAR_FIELD_SIZE / 2) | |
#define | STAR_FIELD_RING_SIZE 32 | |
#define | STAR_FIELD_TICKS 45 | The ticks a cast's glow lasts. |
#define | STAR_FIELD_COLORS 64 | The blue ring sprite sheet's colours, before its pictures; an element's palette replaces them. |
#define | STAR_FIELD_PIXEL_SHIFT 10 | The sparks and rings move in 1/1024 canvas pixels: STAR_FIELD_PIXEL to a pixel. |
#define | STAR_FIELD_PIXEL (1 << STAR_FIELD_PIXEL_SHIFT) | |
#define | STAR_FIELD_UPDATE_FUNC | The two events as the event runner takes them: without UBFIX they are declared returning a value, and are cast to EVENT_FUNC. |
#define | STAR_FIELD_UPLOAD_FUNC |
Functions
| Name | Description | |
|---|---|---|
UNREAD_RESULT | btElementGlowUpdateStarField (void) | Draws the star field's next tick: each spark falls towards the centre and shrinks as its life runs out, and the three rings move outward. |
Uint32 | btElementGlowUploadStarField (void) | |
Sint32 | btElementGlowInitStarField (Sint32 element) | Starts a star field of the element: sixteen sparks on random rings and three rings 120 degrees apart. |
Sint32 | btElementGlowEnd (Sint32 unused) | Ends a star field and turns BG2 off. |
Sint32 | btGraphicsScaleRGB555Clamped (Uint16 *src, Uint16 *dest, FIXED scale, Sint32 count) | Copies count colours from source to destination, each channel scaled by scale (16.16, at most 1), and returns 0. |
void | btElementGlowPlay (Sint32 unitId, Sint32 element, Sint32 mode, Sint32 variant) | Plays a glow of the element about a unit, and returns when it is over: the star field, the streaks, the pillar or the burst. |
void | btBackgroundRestorePalette (void) | Copies the background's saved palette back undarkened, as the star field of btElementGlowPlay leaves it dark. |
void | btIRQRemoveVCountHandler (void) | Removes the VCount interrupt's handler, as btTransitionRun installs one; nothing calls it. |
Description
A unit's elemental glow: the star field and the other glows. Part of
battle.c.
Macros in detail
STAR_FIELD_SPARKS
#define STAR_FIELD_SPARKS 16
The star field's sparks and rings, and the ticks in which a spent spark starts again.
Referenced by btElementGlowInitStarField() and btElementGlowUpdateStarField().
Definition at line 17 of file battle_element_glow.c.
STAR_FIELD_RINGS
#define STAR_FIELD_RINGS 3
Referenced by btElementGlowInitStarField() and btElementGlowUpdateStarField().
Definition at line 18 of file battle_element_glow.c.
STAR_FIELD_SPAWN_TICKS
#define STAR_FIELD_SPAWN_TICKS 25
Referenced by btElementGlowUpdateStarField().
Definition at line 19 of file battle_element_glow.c.
STAR_FIELD_SIZE
#define STAR_FIELD_SIZE 128
The canvas's width and height in pixels.
Referenced by btElementGlowInitStarField().
Definition at line 21 of file battle_element_glow.c.
STAR_FIELD_CENTER
#define STAR_FIELD_CENTER (STAR_FIELD_SIZE / 2)
Referenced by btElementGlowPlay() and btElementGlowUpdateStarField().
Definition at line 22 of file battle_element_glow.c.
STAR_FIELD_RING_SIZE
#define STAR_FIELD_RING_SIZE 32
Referenced by btElementGlowUpdateStarField().
Definition at line 23 of file battle_element_glow.c.
STAR_FIELD_TICKS
#define STAR_FIELD_TICKS 45
The ticks a cast's glow lasts.
Referenced by btElementGlowPlay().
Definition at line 25 of file battle_element_glow.c.
STAR_FIELD_COLORS
#define STAR_FIELD_COLORS 64
The blue ring sprite sheet's colours, before its pictures; an element's palette replaces them.
Referenced by btElementGlowInitStarField().
Definition at line 28 of file battle_element_glow.c.
STAR_FIELD_PIXEL_SHIFT
#define STAR_FIELD_PIXEL_SHIFT 10
The sparks and rings move in 1/1024 canvas pixels: STAR_FIELD_PIXEL to a
pixel.
Referenced by btElementGlowUpdateStarField().
Definition at line 31 of file battle_element_glow.c.
STAR_FIELD_PIXEL
#define STAR_FIELD_PIXEL (1 << STAR_FIELD_PIXEL_SHIFT)
Referenced by btElementGlowInitStarField() and btElementGlowUpdateStarField().
Definition at line 32 of file battle_element_glow.c.
STAR_FIELD_UPDATE_FUNC
#define STAR_FIELD_UPDATE_FUNC
The two events as the event runner takes them: without UBFIX they are
declared returning a value, and are cast to EVENT_FUNC.
Referenced by btElementGlowEnd() and btElementGlowInitStarField().
Definition at line 217 of file battle_element_glow.c.
STAR_FIELD_UPLOAD_FUNC
#define STAR_FIELD_UPLOAD_FUNC
Referenced by btElementGlowEnd() and btElementGlowInitStarField().
Definition at line 221 of file battle_element_glow.c.
Functions in detail
btElementGlowUpdateStarField
UNREAD_RESULT btElementGlowUpdateStarField(void)
Draws the star field's next tick: each spark falls towards the centre and shrinks as its life runs out, and the three rings move outward.
References ElementGlowRingPictures, ElementGlowSparkPictures, ElementGlowSparkSizes, HeapSlots, Sint32, state, syCos(), syDivFX(), syMulFX(), syRandom(), sySin() and sySquartFX().
Definition at line 56 of file battle_element_glow.c.
btElementGlowUploadStarField
Uint32 btElementGlowUploadStarField(void)
References HeapSlots, state and syColorBufferScaleThreeQuarters().
Definition at line 198 of file battle_element_glow.c.
btElementGlowInitStarField
Sint32 btElementGlowInitStarField(Sint32 element)
Starts a star field of the element: sixteen sparks on random rings and three rings 120 degrees apart. Returns the upload event's index.
References btEffectBuildBlitterStub(), HeapSlots, Sint32, state, syCos(), syDecompressTaggedLZ(), syDMAXCopy(), syHeapSlotAllocate(), syHeapSlotAllocateEWRAM(), syMulFX(), syRandom(), syResourceGetTableEntry(), sySetEvent(), sySin(), syWordsClear() and syWordsCopy().
Referenced by btElementGlowPlay().
Definition at line 228 of file battle_element_glow.c.
btElementGlowEnd
Sint32 btElementGlowEnd(Sint32 unused)
Ends a star field and turns BG2 off.
References Sint32, syCloseEvent(), syHeapSlotRelease() and syWordsClear().
Referenced by btElementGlowPlay().
Definition at line 333 of file battle_element_glow.c.
btGraphicsScaleRGB555Clamped
Sint32 btGraphicsScaleRGB555Clamped(Uint16 *src, Uint16 *dest, FIXED scale, Sint32 count)
Copies count colours from source to destination, each channel scaled by scale (16.16, at most 1), and returns 0.
References Sint32.
Referenced by btBackgroundLoad(), btBackgroundSetPaletteLevel(), btElementGlowPlay() and btStagingRunItem().
Definition at line 348 of file battle_element_glow.c.
btElementGlowPlay
void btElementGlowPlay(Sint32 unitId, Sint32 element, Sint32 mode, Sint32 variant)
Plays a glow of the element about a unit, and returns when it is over: the star field, the streaks, the pillar or the burst.
References btBackgroundSetMode(), btEffectEndElementStreaksStub(), btEffectRunElementBurstStub(), btEffectRunElementPillarStub(), btEffectStartElementStreaksStub(), btElementGlowEnd(), btElementGlowInitStarField(), btGraphicsScaleRGB555Clamped(), btMotionProjectScaledPos(), fdScreenPointCoordinates(), HeapSlots, Sint32, state, syIOWriteQueueStore16(), sySynch() and syWordsClear().
Referenced by btActionRunBuild(), btProcessTurnEnd(), btStagingRunFullScreen(), btStagingRunPsynergyCast() and btUnitProcessActionEnd().
Definition at line 383 of file battle_element_glow.c.
btBackgroundRestorePalette
void btBackgroundRestorePalette(void)
Copies the background's saved palette back undarkened, as the star field of
btElementGlowPlay leaves it dark.
References btBackgroundSetPaletteLevel().
Referenced by btStagingRunFullScreen() and btStagingRunPsynergyCast().
Definition at line 509 of file battle_element_glow.c.
btIRQRemoveVCountHandler
void btIRQRemoveVCountHandler(void)
Removes the VCount interrupt's handler, as btTransitionRun installs one;
nothing calls it.
References syIntFunction().
Definition at line 516 of file battle_element_glow.c.