Skip to Content
The Alchemy Project

include/field/canvas_sprite.h

The canvas sprite of a field Psynergy: a 64 by 64 sprite whose pixels an effect draws into a 4 KB canvas. More…

Included by field_psynergy_internal.h.

Structures

NameDescription
structCANVAS_SPR_STATEA field Psynergy's canvas sprite: its effect sprite, the tick it is on and how long it has drawn, and where, how large, at what angle and depth it is drawn.

Macros

NameDescription
#defineCANVAS_WIDTH 64The canvas: 64x64 pixels of 8 bits, in 8x8 tiles.
#defineCANVAS_SPRITE_BYTES 4096
#defineCANVAS_SPRITE_16_COLORS 1How the sprite is drawn.
#defineCANVAS_SPRITE_256_COLORS 2rebuilt each tick, in 256 colours
#defineCANVAS_SPRITE_KEPT 3drawn as the effect left it
#defineCANVAS_PALETTE 14The OBJ palette a 16-colour canvas is drawn in.
#defineCANVAS_UPLOAD_AND_CLEAR 1What fdBattleEffectUploadCanvas does with the canvas in the next tick.
#defineCANVAS_UPLOAD 2
#defineCANVAS_UPLOAD_AND_DARKEN_ONE_LEVEL 3
#defineCANVAS_UPLOAD_AND_DARKEN_TWO_LEVELS 4
#defineCANVAS_UPLOAD_AND_DARKEN_FOUR_LEVELS 5
#defineCANVAS_UPLOAD_TO_BG 11

Functions

NameDescription
voidfdBattleEffectUploadCanvas (void)The canvas's tick callback: counts the tick and carries out the command the effect left for it, copying the canvas into the sprite's tiles (or to the start of BG VRAM), and clearing or fading it after the copy.
voidfdBattleEffectDrawCanvasSprite (void)The canvas sprite's tick callback: places the sprite at the state's position (whole pixels), scale and angle, and draws it.
voidfdBattleEffectStartCanvasSprite (void)Starts the canvas sprite of the field Psynergy scenes: its state, a cleared 64x64 canvas copied into the sprite's tiles, and a map from each canvas pixel (row by row) to its place in the tiles.
voidfdBattleEffectEndCanvasSprite (void)Ends the canvas sprite: stops its draw and upload callbacks, waits a tick and frees its sprite state, canvas and pixel map.

Description

The canvas sprite of a field Psynergy: a 64 by 64 sprite whose pixels an effect draws into a 4 KB canvas. fdBattleEffectStartCanvasSprite starts it, fdBattleEffectDrawCanvasSprite draws the sprite each tick, fdBattleEffectUploadCanvas copies the canvas into its tiles on command, and fdBattleEffectEndCanvasSprite ends it.

Macros in detail

CANVAS_WIDTH

#define CANVAS_WIDTH 64

The canvas: 64x64 pixels of 8 bits, in 8x8 tiles.

Referenced by fdBattleEffectStartCanvasSprite() and fdCyclonePlotArc().

Definition at line 15 of file canvas_sprite.h.

CANVAS_SPRITE_BYTES

#define CANVAS_SPRITE_BYTES 4096

Referenced by fdBattleEffectPlotCanvasPixel(), fdBattleEffectStartCanvasSprite() and fdBattleEffectUploadCanvas().

Definition at line 16 of file canvas_sprite.h.

CANVAS_SPRITE_16_COLORS

#define CANVAS_SPRITE_16_COLORS 1

How the sprite is drawn.

rebuilt each tick, in OBJ palette 14

Referenced by fdBattleEffectDrawCanvasSprite() and fdBattleEffectStartCanvasSprite().

Definition at line 19 of file canvas_sprite.h.

CANVAS_SPRITE_256_COLORS

#define CANVAS_SPRITE_256_COLORS 2

rebuilt each tick, in 256 colours

Referenced by fdBattleEffectDrawCanvasSprite(), fdPsynergyArrow(), fdPsynergyBurst() and fdPsynergyPound().

Definition at line 20 of file canvas_sprite.h.

CANVAS_SPRITE_KEPT

#define CANVAS_SPRITE_KEPT 3

drawn as the effect left it

Referenced by fdBattleEffectDrawCanvasSprite() and fdPsynergyCyclone().

Definition at line 21 of file canvas_sprite.h.

CANVAS_PALETTE

#define CANVAS_PALETTE 14

The OBJ palette a 16-colour canvas is drawn in. The effects that draw in 256 colours keep their own colours in it and the next, colours 224 to 255.

Referenced by fdBattleEffectDrawCanvasSprite(), fdCyclonePlotArc(), fdPsynergyArrow(), fdPsynergyCyclone(), fdPsynergyUpdateBurst() and fdPsynergyUpdatePound().

Definition at line 25 of file canvas_sprite.h.

CANVAS_UPLOAD_AND_CLEAR

#define CANVAS_UPLOAD_AND_CLEAR 1

What fdBattleEffectUploadCanvas does with the canvas in the next tick.

Referenced by fdBattleEffectUploadCanvas().

Definition at line 28 of file canvas_sprite.h.

CANVAS_UPLOAD

#define CANVAS_UPLOAD 2

Referenced by fdBattleEffectUploadCanvas(), fdPsynergyBurst() and fdPsynergyPound().

Definition at line 29 of file canvas_sprite.h.

CANVAS_UPLOAD_AND_DARKEN_ONE_LEVEL

#define CANVAS_UPLOAD_AND_DARKEN_ONE_LEVEL 3

Referenced by fdBattleEffectUploadCanvas(), fdPsynergyCyclone() and fdPsynergyUpdatePound().

Definition at line 30 of file canvas_sprite.h.

CANVAS_UPLOAD_AND_DARKEN_TWO_LEVELS

#define CANVAS_UPLOAD_AND_DARKEN_TWO_LEVELS 4

Referenced by fdBattleEffectUploadCanvas().

Definition at line 31 of file canvas_sprite.h.

CANVAS_UPLOAD_AND_DARKEN_FOUR_LEVELS

#define CANVAS_UPLOAD_AND_DARKEN_FOUR_LEVELS 5

Referenced by fdBattleEffectUploadCanvas(), fdPsynergyUpdateArrow() and fdPsynergyUpdateBurst().

Definition at line 32 of file canvas_sprite.h.

CANVAS_UPLOAD_TO_BG

#define CANVAS_UPLOAD_TO_BG 11

Referenced by fdBattleEffectUploadCanvas() and fdPsynergyRing().

Definition at line 33 of file canvas_sprite.h.