11#define DJINN_BEAMS_MOTE_CELLS 0x2710
12#define DJINN_BEAMS_DJINNI_CELLS 0x65c0
85 for (i = 0; i != 512; i++) {
123 s32 angle = frame << 11;
124 s32 x = (-
Trig_Sin(angle) * 20 >> 16) + djinnX + offsetX - 20;
130 y = y - frame * 2 + 64;
154 for (i = 0; i != 8; i++) {
157 if (frame > i * 8 + start && mote->
y > 8 << 16) {
161 screenPosition.
x += offsetX;
164 screenPosition.
x -= sway;
166 screenPosition.
x += sway;
172 screenPosition.
x - 12, screenPosition.
y - 12, 24, 24);
188 if (frame >= start + 72) {
193 if (frame == start + 72)
196 if (frame == start + 88)
200 screenPosition.
x += offsetX;
201 if (frame < start + 104) {
205 if (frame > start + 88)
206 width = 6 - (frame - start - 88) / 3;
212 if (frame < start + 100) {
224 for (k = 0; k != screenPosition.
y; k++) {
225 draw[0](canvas, work->sheet + 5, screenPosition.
x - width, k, width,
227 draw[1](canvas, work->sheet + 5, screenPosition.
x, k, width, 1);
241#undef DJINN_BEAMS_MOTE_CELLS
242#undef DJINN_BEAMS_DJINNI_CELLS
@ SPRITE_COLOR_GRB
red and green swapped
struct BattleCamera * gCameraWork
BattleEffectDrawRectangle DrawRectangle
#define EFFECT_FOR_EACH_TARGET(i, effect)
Loops i over the effect's targets, effect->actors[0] to effect->actors[effect->count - 1]: the loops ...
void BattleFx_ProcessPendingGraphicsTransfer(void)
Copies the canvas to VRAM once the effect has finished drawing a frame (transferPending): the 128x128...
void BattleFx_BeginCanvasLayer(s32 bgControl)
Opens the canvas layer: starts the background palette fade, makes BG2 the canvas, alpha-blended over ...
void BattleFx_EndCanvasLayer(void)
Closes the canvas layer: plays the closing sound, restores BG1's scroll and the projection centre,...
void BattleFx_RunDew(struct BattleEffectArgument *effect)
With a Mercury Djinni: the same beams of light as Revive.
void BattleFx_RunDjinnBeams(struct BattleEffectArgument *effect, s32 mode)
When effect->prelude is 1, a Djinni appears, sways and then rises out of sight.
void BattleFx_RunRevive(struct BattleEffectArgument *effect)
With a Venus Djinni: beams of light, where motes drift down over each target and a column of light fa...
#define DJINN_BEAMS_DJINNI_CELLS
the Djinni (40x40)
#define DJINN_BEAMS_MOTE_CELLS
the motes (CrescentMoonSheet, 24x24)
void ObjectGroup_UpdateMembers(s32 actorId, s32 palette, s32 animation, s32 timerSlot, s32 timerFrames)
Updates every animation group of one battler's object.
What every part of the battle effect object shares: its includes, macros and frame-loop helpers.
#define EFFECT_RELEASE_BLITTERS()
Frees the two blitters, the alternate first.
#define EFFECT_PRESENT_FRAME(work)
Ends a frame of a canvas effect: marks the canvas ready for the transfer callback,...
@ CANVAS_COPY_AND_FADE
copy, keeping 50% or 75% (transferValue) of each pixel in the canvas for the next frame
#define EFFECT_GET_WORK_AND_CANVAS(cursor, work, canvas)
The work block and canvas occupy adjacent slots, starting at HEAP_SLOT_BATTLE_EFFECT.
#define EFFECT_SHOW_DAMAGE(hitSound)
Lets the battle show the damage: resumes its paused playback, which plays hitSound (an SE_ id; 0 keep...
#define EFFECT_START_TRANSFER(work, mode, value)
Sets the transfer, then starts copying the canvas to VRAM once a frame.
#define EFFECT_LOAD_BLITTER(slot, flags, mode)
Builds a blitter for the 128x128 canvas (1 << 7 pixels each way) in work slot slot: BattleFx_BuildBli...
#define EFFECT_VIEW_FROM_CAMERA(camera)
Starts a frame's 3D projection from the battle camera: resets the transform, then looks from camera->...
u8 gDjinnBeams_HeadHeights[]
u8 gDjinnBeams_HeadWidths[]
u8 gDjinnBeams_MotePictures[]
The picture of each step of a mote's eight-step cycle.
u16 gDjinnBeams_HeadOffsets[]
struct BattleObj * GetBattleObjectSlotFar(s32 objectId)
Far call to BattleObjGet.
void AudioCommand_PlayFar(s32 id)
@ HEAP_SLOT_BLITTER_ALTERNATE
#define Q_8_8(n)
The BG2/BG3 affine matrix entries are signed 8.8 fixed point: texels stepped per screen pixel.
static s32 Iwram_CopyWords(volatile void *destination, const volatile void *source, s32 size)
#define SET_VECTOR(v, x, y, z)
Sets the x, y and z of a three-part vector: a position about to be projected, a per-frame step,...
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
void BattleFx_FetchRectangleBlitters(s32 flip, BlitterPair out)
Builds the two usual routines that draw onto the 128x128 canvas, both clipped on both axes.
void EffectPosition_ProjectScaledBattler(s32 id, struct EffectPosition *position)
The screen position of a battler, scaled for the battle view, 16 pixels higher.
s32 EffectPosition_ProjectPoint(const void *point, struct EffectPosition *position)
Projects a point in the current transform onto the screen, 16 pixels higher, and returns the projecti...
void BattleFx_RunDjinniEntrance(struct BattleEffectArgument *effect, s32 mode, s32 side, s32 anchor, s32 *outX, s32 *outY)
Djinni entrance: sparks swirl around a point that travels from the user to the goal and gather into t...
char ResourceId_CrescentMoonSheet
char ResourceId_VenusDjinnSheet
char ResourceId_EarthWallSheet
char ResourceId_MercuryDjinnSheet
s32 Resource_DecodeType01(const void *source, void *destination)
Decodes a type-01 resource and returns its unpacked byte count.
s32 Scheduler_RemoveCallback(SchedulerCallback callback)
Unschedules the task running callback: clears its routine and gives it order 0x7fff,...
The battle camera: its eye, the focus it turns about, and its pitch, yaw and distance.
The command shared by an effect's caller, dispatcher and handlers.
s32 side
1 when the targets are the party, 0 for enemies
s16 actors[8]
the targets' unit ids, count of them
s32 count
targets in actors, at least 1
s32 prelude
1 plays a prelude: in some effects a Djinni appears
The running battle effect's work: its canvas image, 64 particles, the display registers it stages and...
s32 frame
frame counter some effects keep, from 0
struct BattleEffectArgument * effect
the command being run
struct MotionObject * object
NULL once released.
A point projected onto the screen, with its depth.
A moving point of an effect: its position, its velocity and a value each effect uses its own way (a s...
s32 variant
each effect's own: a size, a countdown, -1 for idle
s32 y
16.16 fixed-point pixels
An effect object that moves and draws one sprite: its position, scale, velocity and target,...
s32 z
16.16 fixed-point pixels
s32 x
16.16 fixed-point pixels
void * Resource_GetTableEntry(s32 index)
Returns the ROM address of resource index from the resource directory.
#define EFFECT_CLIP_BOUNDS
Clips overflow on all four sides.
#define PARTICLES
The map cell buffer (gMapCellBuffer), which the effects borrow, has two views here: Ram_MapCellBuffer...
DrawRectangle BlitterPair[2]
A blitter pair: [0] built in HEAP_SLOT_BLITTER and [1] in HEAP_SLOT_BLITTER_ALTERNATE (BattleFx_Fetch...