Alchemy
Loading...
Searching...
No Matches

mercury_lighthouse_sparks.h

Go to the documentation of this file.
1#include "types.h"
2#include "field_obj.h"
3#include "field_effect.h"
4
5// Mercury Lighthouse and its entrance: the trail of sparks the leader leaves
6// while passing between floors.
7
8// The leader's update hook while passing: each frame a small spark rises from a
9// point that sweeps across the leader's chest, in palette 7 or 5 by turns.
10//
11// UB: update hooks return void. In tbs-en mercury_lighthouse_entrance, plain
12// void differs in 21 bytes (extent 136 to 132 bytes). Keep the
13// unused native result in matching builds.
14#ifdef UBFIX
15static void MercuryLighthouse_TrailSparks(union FieldObject *fieldObject) {
16#else
17static s32 MercuryLighthouse_TrailSparks(union FieldObject *fieldObject) {
18#endif
19 struct FieldActor *actor = (struct FieldActor *)fieldObject;
20 struct EffectOptions options;
21 s32 velocityY;
22
23 options.palette = 7;
24 if ((gFrameCount & 1) == 0) {
25 options.palette = 5;
26 }
27 options.startScaleX = 0xcccc;
28 options.startScaleY = 0xcccc;
29 options.priority = 0;
30 velocityY = -((((u32)Engine_RandomNext() * 8) >> 16) * 0x3333);
31 Effect_Spawn(actor->x.fixed + ((8 - (gFrameCount & 15)) << 16),
32 actor->y.fixed + 0x1a0000, actor->z.fixed, 0, velocityY, 0,
35 &options);
36#ifdef UBFIX
37 return;
38#else
39 return 0;
40#endif
41}
Field effects, their scripts and the flags that spawn them.
@ EFFECT_USE_PALETTE
options.palette, as its group child value
@ EFFECT_USE_START_SCALE
options.startScaleX and startScaleY
@ EFFECT_USE_PRIORITY
options.priority, as the sprite's priority
s32 Engine_RandomNext()
Field objects and actors, and the scene transition styles.
volatile u32 gFrameCount
Frames WaitFrames has finished.
static s32 MercuryLighthouse_TrailSparks(union FieldObject *fieldObject)
The options of a spawned field effect, each used when its EFFECT_USE_ flag (or EFFECT_SCALE_TO_TARGET...
s32 palette
passed to ObjectGroup_SetChildValue
s32 startScaleY
16.16 fixed point, 0x10000 full size
s32 priority
the sprite's priority
s32 startScaleX
16.16 fixed point, 0x10000 full size
A field actor: a person or thing on the field with a position, motion toward a target,...
Definition field_obj.h:30
union FieldCoordinate x
16.16 fixed-point pixels
Definition field_obj.h:35
union FieldCoordinate y
16.16 fixed-point pixels
Definition field_obj.h:36
union FieldCoordinate z
16.16 fixed-point pixels
Definition field_obj.h:37
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.