Alchemy
Loading...
Searching...
No Matches

weather.c

Go to the documentation of this file.
1/// @file
2/// Ground particles, motes, sparkles and lightning on the field.
3/// Part of psynergy_effects.c, compiled only through it.
4
6
7/// Scheduler callback: animates the ground particles. Each plays a 16-frame
8/// animation (gFieldFx_GroundParticleFrames, 5 halfwords a frame: x and y
9/// offsets, tile, shape and size) on a random spot of ground within 128 pixels
10/// of the leader, then starts again elsewhere. They freeze while flag 0x166 is
11/// set.
13 struct MapScrollWork *view = gMapWork[0];
14 struct GroundParticleWork *work = gMapWork[21];
15 s32 *camera = &view->viewX;
16 s32 cameraX = camera[0];
17 s32 cameraZ = camera[1];
18 struct GroundParticle *particle = work->particles;
19 u32 i;
20
21 for (i = 0; i < FIELD_WEATHER_PARTICLE_COUNT; i++, particle++) {
22 s16 *frame;
23 s32 x;
24 s32 y;
25
26 if (--particle->timer == 0xffff)
27 continue;
28 // BUG: freezing a timer of 16 indexes past the 16-frame table. Which
29 // frame should be held is not established, so keep the original timing.
30 if (GameFlag_TestFar(0x166))
31 particle->timer++;
32 frame = &gFieldFx_GroundParticleFrames[5 * particle->timer];
33 x = (particle->posX - cameraX) / 0x10000 + *frame++;
34 y = (particle->posZ - particle->posY - cameraZ) / 0x10000 + *frame++;
35 if ((x >= -16 && x <= 239) && y >= -32 && y <= 159) {
36 particle->priority = 1;
37 particle->x = x;
38 particle->y = y;
39 particle->tile = work->tileBase + *(u16 *)frame;
40 frame++;
41 particle->shape = *(u8 *)frame;
42 particle->size = *(u8 *)(frame + 1);
43 Runtime_PushSlotEntry(particle, 240);
44 }
45 if (particle->timer == 0) {
46 s32 *leader = view->origin;
47
48 x = leader[0] + (Random16() << 8) - 0x800000;
49 y = leader[2] + (Random16() << 8) - 0x800000;
50 particle->posX = x;
51 particle->posZ = y;
52 particle->posY = Map_GetTerrainHeightFar(0, x >> 16, y >> 16) << 16;
53 particle->timer = 16;
54 }
55 }
56}
57
58/// Scheduler callback for the storm: every 150 to 550 frames lightning flashes
59/// the palette three times (5 frames apart) with a thunderclap, louder with
60/// loud set. Flag 0x166 holds the next flash back.
62 struct FieldBlendWork *work = gFieldBlendWork[0];
64 s16 *timer = &work->timer;
65
66 if (*timer < 0)
67 return;
68 if (GameFlag_TestFar(0x166))
69 work->timer = 128;
70 switch ((*timer)--) {
71 case 0:
72 if (work->enabled != 0) {
73 u32 intervalDraw = Random16();
74 u32 intervalJitter = Random16();
75 work->timer =
76 ((intervalDraw * 400) >> 16) - ((intervalJitter * 100) >> 16) + 150;
77 if (work->loud != 0)
79 else
81 }
82 // fall through
83 case 5:
84 case 10:
85 // Flash: jump to the lit palette and fade back over 12 frames.
87 Dma_Set(work->delta, target->delta, (DMA_ENABLE | DMA_32BIT) << 16 | 0x2a0,
88 REG_DMA3);
89 target->duration = 12;
90 target->step = 0;
91 break;
92 case 1:
93 case 6:
94 case 11:
96 target->duration = 1;
97 target->step = 0;
98 break;
99 }
100}
101
102/// Starts the ground particles (FieldFx_UpdateGroundParticles) with sound 170:
103/// loads their tiles and puts 32 of them under the leader with staggered
104/// timers, drawn semi-transparent.
106 struct GroundParticleWork *work;
107 s32 *leader;
108 struct GroundParticle *particle;
109 u32 *words;
110 u32 i;
111
112 /* FAKEMATCH(temporary): words holds the fill's zero, the decode buffer and
113 * each cell cursor, all in r6; as Dma_Fill32(0, work, ...), 4 of 93
114 * instructions differ in tbs-en. */
115 work = Runtime_AllocateBlock(29, sizeof(struct GroundParticleWork));
116 leader = ((struct MapScrollWork *)gMapWork[0])->origin;
118 words = 0;
119 particle = work->particles;
120 Dma_Fill32((u32)words, work, sizeof(struct GroundParticleWork));
121 words = Runtime_AllocateBlock(14, 0x400);
124 work->tileBase = VramCache_Load(work->entry, 0x300, words);
126 for (i = 0; i < FIELD_WEATHER_PARTICLE_COUNT; i++) {
127 s32 x;
128 s32 z;
129
130 // Semi-transparent, 16 by 16, priority 1, palette 13.
131 words = (u32 *)particle;
132 *words++ = 0;
133 *words++ = 0x40000400;
134 *words = 0xd400;
135 x = leader[0];
136 z = leader[2];
137 particle->posX = x;
138 particle->posZ = z;
139 particle->posY = Map_GetTerrainHeightFar(0, x >> 16, z >> 16) << 16;
140 particle->timer = (i & 15) + 1;
141 particle++;
142 }
145 Io_Write16(0, &REG_BLDY);
147}
148
149/// A particle's first word, seen as a value or a link.
150union DustWord {
152 void *link;
153};
154
155/// Scheduler callback: the floating motes. Each mote appears on the ground
156/// within 128 pixels of the leader (at most 8 new ones a frame), rises a pixel
157/// a frame, ever faster for its last 90 frames, jittering sideways and
158/// changing tiles as it ages, and lasts 120 frames or until it leaves the
159/// screen. They freeze while flag 0x166 is set.
161 struct GroundParticleWork *work = WORK_SLOT(29);
162 struct MapScrollWork *map = WORK_SLOT(8);
163 u32 spawned = 0;
164 u32 i;
165 struct GroundParticle *mote = work->particles;
166
167 for (i = 0; i < FIELD_WEATHER_PARTICLE_COUNT; i++, mote++) {
168 s32 x;
169 s32 y;
170
171 if (--mote->timer != 0xffff) {
172 s32 *camera = &map->viewX;
173 s32 cameraX = camera[0];
174 s32 cameraZ = camera[1];
175 u16 age = mote->timer;
176 u32 firstJitterDraw;
177 u32 secondJitterDraw;
178
179 if (GameFlag_TestFar(0x166)) {
180 mote->timer++;
181 mote->delay--;
182 }
183 firstJitterDraw = Random16();
184 secondJitterDraw = Random16();
185 x = ((mote->posX - cameraX) >> 16) +
186 (((firstJitterDraw & 1) + (secondJitterDraw & 1)) >> 1) - 1;
187 y = ((mote->posZ - mote->posY - cameraZ) >> 16) - age;
188 if ((u32)(x + 16) <= 255 && y >= -32 && y <= 159) {
189 if (mote->timer < 60) {
190 mote->tile = work->tileBase + 16;
191 mote->delay += 3;
192 } else if (mote->timer < 90) {
193 mote->tile = work->tileBase + 8;
194 mote->delay++;
195 } else {
196 mote->tile = work->tileBase;
197 }
198 if ((gFrameCount >> 3) & 1)
199 mote->tile += 4;
200 mote->x = x;
201 mote->y = y - (mote->delay >> 2);
202 mote->shape = 0;
203 mote->size = 1;
204 Runtime_PushSlotEntry(mote, 240);
205 } else {
206 mote->timer = 0;
207 }
208 }
209 if (spawned < 8 && mote->timer == 0) {
210 s32 *leader = map->origin;
211
212 x = leader[0] + (Random16() << 8) - 0x800000;
213 y = leader[2] + (Random16() << 8) - 0x800000;
214 mote->posZ = y;
215 mote->posX = x;
216 mote->posY = Map_GetTerrainHeightFar(0, x >> 16, y >> 16) << 16;
217 mote->timer = 120;
218 mote->delay = 0;
219 spawned++;
220 }
221 }
222}
223
224/// Starts the floating motes (FieldMotes_Update): loads their tiles and puts
225/// 32 of them under the leader with staggered timers, drawn semi-transparent.
227 struct GroundParticleWork *work;
228 struct GroundParticle *mote;
229 u8 *tiles;
230 u32 i;
231 u32 size;
232
233 size = 0x410;
234 work = Runtime_AllocateBlock(29, size);
235 mote = work->particles;
236 /* FAKEMATCH(temporary): size reused for the cleared word keeps the zero in
237 * r1, the register size was passed in; as Dma_Fill32(0, work, ...), 4 of
238 * 83 instructions differ in tbs-en. */
239 size = 0;
240 Dma_Fill32(size, work, sizeof(*work));
241 tiles = Runtime_AllocateBlock(14, 0x400);
244 work->tileBase = VramCache_Load(work->entry, 0x300, tiles);
246 for (i = 0; i < FIELD_WEATHER_PARTICLE_COUNT; i++) {
247 s32 *pos = ((struct MapScrollWork *)gMapWork[0])->origin;
248 /* FAKEMATCH(temporary): one integer cursor for the attribute stores and
249 * the height's x keeps the stores in r1; as an s32 * cursor and an x of
250 * its own, 16 of 83 instructions differ in tbs-en. */
251 u32 p = (u32)mote;
252 s32 z;
253 *(s32 *)p = 0;
254 p += sizeof(s32);
255 *(s32 *)p = 0x40000400;
256 p += sizeof(s32);
257 *(s32 *)p = 0xd400;
258 p = pos[0];
259 z = pos[2];
260 mote->posX = (s32)p;
261 mote->posZ = z;
262 mote->posY = Map_GetTerrainHeightFar(0, (s32)p >> 16, z >> 16) << 16;
263 mote->timer = (i & 15) + 1;
264 mote++;
265 }
268 Io_Write16(0, &REG_BLDY);
270}
271
272/// Scheduler callback: the sparkles. Now and then (1 frame in 256) a sparkle
273/// appears on the ground within 128 pixels of the leader, and up to three more
274/// follow on the same spot, each 4 frames shorter. Each plays
275/// gFieldFx_SparkleFrames, flipping every other frame. No new bursts start
276/// while the work's stopped is set; flag 0x166 freezes them.
278 struct GroundParticleWork *work;
279 u32 spawned;
280 u32 i;
281 struct MapScrollWork *map;
282 s32 *camera;
283 s32 spawnX;
284 s32 spawnZ;
285 struct GroundParticle *sparkle;
286 const u16 *frame;
287 s32 *leader;
288 s32 cameraX;
289 s32 cameraZ;
290 s32 sx;
291 s32 sy;
292 s32 delay;
293 s32 x;
294 u32 a;
295 u32 b;
296 u32 frames;
297
298 work = WORK_SLOT(29);
299 spawned = 0;
300 map = WORK_SLOT(8);
301 camera = &map->viewX;
302 spawnX = 0;
303 spawnZ = 0;
304 i = 0;
305 sparkle = work->particles;
306 delay = 0;
307 sx = 0;
308 sy = 0;
309 do {
310 if (sparkle->timer != 0) {
311 cameraX = camera[0];
312 cameraZ = camera[1];
313 if (GameFlag_TestFar(0x166) != 0)
314 sparkle->timer++;
315 frame = (const u16 *)&gFieldFx_SparkleFrames[sparkle->timer >> 1];
316 a = Random16();
317 b = Random16();
318 x = ((sparkle->posX - cameraX) >> 16) + (((a & 1) + (b & 1)) >> 1);
319 sx = x - 1;
320 sy = (sparkle->posZ - sparkle->posY - cameraZ) / 0x10000 +
321 *(const s16 *)frame;
322 frame++;
323 if ((u32)(x + 15) <= 255 && sy >= -32 && sy <= 159) {
324 sparkle->tile = work->tileBase + *frame;
325 sparkle->x = sx;
326 sparkle->shape = 0;
327 sparkle->size = 1;
328#ifdef UBFIX
329 frames = gFrameCount;
330#else
331 // UB: this drops volatile and reads a u32 as unsigned long.
332 /* FAKEMATCH(volatile): the unsigned long alias combines the size
333 * and flip stores; as gFrameCount or a u32 alias, 3 of 235
334 * instructions differ in tbs-en. UBFIX reads the declared type. */
335 frames = *(unsigned long *)&gFrameCount;
336#endif
337 sparkle->y = sy;
338 sparkle->affineIndex = ((frames >> 1) & 1) << 3;
339 Runtime_PushSlotEntry(sparkle, 240);
340 }
341 sparkle->timer--;
342 }
343 if (spawned <= 3 && sparkle->timer == 0 && work->stopped == 0) {
344 if (delay != 0) {
345 // The rest of a burst, on the first sparkle's spot.
346 sparkle->posX = spawnX;
347 sparkle->posZ = spawnZ;
348 sparkle->posY = Map_GetTerrainHeightFar(0, sx >> 16, sy >> 16) << 16;
349 sparkle->timer = 62 - delay;
350 sparkle->delay = 0;
351 spawned++;
352 delay += 4;
353 } else if ((Random16() & 255) == 0) {
354 // A burst starts at a random spot.
355 leader = map->origin;
356 spawnX = leader[0] + (Random16() << 8) - 0x800000;
357 spawnZ = leader[2] + (Random16() << 8) - 0x800000;
358 sparkle->posX = spawnX;
359 sparkle->posZ = spawnZ;
360 sparkle->posY = Map_GetTerrainHeightFar(0, sx >> 16, sy >> 16) << 16;
361 sparkle->timer = 30;
362 sparkle->delay = delay;
363 spawned++;
364 delay = 4;
365 }
366 }
367 i++;
368 sparkle++;
369 } while (i < FIELD_WEATHER_PARTICLE_COUNT);
370}
371
372/// Starts the sparkles (FieldEffect_UpdateSparkles): loads their tiles and
373/// clears the 32 sparkles.
375 u32 size = 0x410;
376 struct GroundParticleWork *work = Runtime_AllocateBlock(29, size);
377 struct GroundParticle *sparkle = work->particles;
378 u8 *tiles;
379 u32 i;
380 s32 clear;
381
382 /* FAKEMATCH(temporary): size reused for the fill word keeps the zero in r1,
383 * the register size was passed in; as Dma_Fill32(0, work, ...), 4 of 74
384 * instructions differ in tbs-en. */
385 size = 0;
386 Dma_Fill32(size, work, sizeof(*work));
387 tiles = Runtime_AllocateBlock(14, 0x400);
390 work->tileBase = VramCache_Load(work->entry, 0x200, tiles);
392 i = 0;
393 clear = 0;
394 do {
395 struct MapScrollWork *view = gMapWork[0];
396 s32 *leader;
397 /* FAKEMATCH(temporary): one integer cursor for the stores and the x keeps
398 * the leader in r2; as a u32 * cursor and an x of its own, 14 of 74
399 * instructions differ in tbs-en. */
400 u32 attr;
401 s32 z;
402
403 attr = (u32)sparkle;
404 *(u32 *)attr = clear;
405 attr += sizeof(union DustWord);
406 leader = view->origin;
407 *(u32 *)attr = 0x40000400;
408 attr += sizeof(union DustWord);
409 *(u32 *)attr = 0xd400;
410 attr = leader[0];
411 z = leader[2];
412 sparkle->posX = clear;
413 sparkle->posZ = clear;
414 sparkle->posY = Map_GetTerrainHeightFar(0, (s32)attr >> 16, z >> 16) << 16;
415 sparkle->timer = (i & 15) + 1;
416 i++;
417 sparkle++;
418 } while (i < FIELD_WEATHER_PARTICLE_COUNT);
420}
421
422/// Starts the storm's lightning (FieldFx_UpdateLightning): builds the dark
423/// (0x10003) and lit (0x10005) palettes and their 12-step fade, and arms the
424/// first flash in 600 frames, repeating.
426 struct FieldBlendWork *work;
427 struct BattleEffectBuffers *buffers;
428
429 work = Runtime_AllocateBlock(30, sizeof(struct FieldBlendWork));
430 buffers = gPaletteBufferWork;
431 Dma_Fill32(0, work, sizeof(struct FieldBlendWork));
432 BattleFx_BuildBuffer(0x10003, buffers, work, 1);
433 BattleFx_BuildBuffer(0x10005, buffers, work->to, 1);
434 BattleFx_InterpolateBuffers(work->to, work->from, work->delta, 12);
435 BattleFx_BuildBuffer((s32)work, 0, buffers->target, 1);
436 work->timer = 600;
437 work->enabled = 1;
439}
440
441/// Stops the lightning: no flash for 0x7fff frames, and none after.
443 struct FieldBlendWork *state =
444 Runtime_AllocateBlock(30, sizeof(struct FieldBlendWork));
445 state->timer = 0x7FFF;
446 state->enabled = 0;
447}
448
449/// One last flash of lightning in 12 frames, then no more.
451 struct FieldBlendWork *state =
452 Runtime_AllocateBlock(30, sizeof(struct FieldBlendWork));
453 state->timer = 12;
454 state->enabled = 0;
455}
456
457/// Restarts the lightning: the next flash in 128 frames, repeating.
459 struct FieldBlendWork *state =
460 Runtime_AllocateBlock(30, sizeof(struct FieldBlendWork));
461 state->timer = 128;
462 state->enabled = 1;
463}
464
465/// Flashes the palette once, 120 frames from now, from palette from to palette
466/// to (BattleFx_BuildBuffer modes), with the storm's flash callback.
468 struct FieldBlendWork *work;
469 struct BattleEffectBuffers *buffers;
470 s16 *target;
471
472 work = Runtime_AllocateBlock(30, sizeof(struct FieldBlendWork));
473 buffers = gPaletteBufferWork;
474 Dma_Fill32(0, work, sizeof(struct FieldBlendWork));
475 BattleFx_BuildBuffer(from, buffers, work, 1);
476 target = work->to;
477 BattleFx_BuildBuffer(to, buffers, target, 1);
478 BattleFx_InterpolateBuffers(target, work->from, work->delta, 12);
479 BattleFx_BuildBuffer((s32)work, 0, buffers->target, 1);
480 work->timer = 120;
481 work->enabled = 0;
483}
const u8 gFieldFx_GroundParticleTiles[]
struct BattleEffectBuffers * gPaletteBufferWork
void BattleFx_InterpolateBuffers(s16 *source, s16 *target, s16 *step, s32 frames)
Sets each of the 1344 colour channels of step to the amount to add each frame for source to reach tar...
Definition color.c:17
void BattleFx_ApplyColorToTargetBuffer(s32 mode, s32 half)
Sets the colours the buffer moves toward (see BattleFx_BuildBuffer); does nothing without a colour bu...
Definition color.c:398
void BattleFx_BuildBuffer(u32 mode, u16 *src, u16 *dst, s32 half)
Builds colours for the colour buffer from the palette src into dst, which holds each colour as B,...
Definition color.c:108
static __inline__ void Dma_Set(const volatile void *source, volatile void *destination, u32 control, volatile u32 *channel)
Starts a DMA transfer: stores the source, destination and control words into channel's registers with...
Definition dma.h:62
#define Dma_Fill32(value, destination, size)
Fills size bytes at destination with the word value by DMA3.
Definition dma.h:30
s32 Map_GetTerrainHeightFar(s32 layer, s32 x, s32 y)
s32 GameFlag_TestFar(s32 flag)
void AudioCommand_PlayFar(s32 id)
const u8 gFieldFx_SparkleTiles[]
const u8 gFieldFx_MoteTiles[]
volatile u32 gFrameCount
Frames WaitFrames has finished.
const struct SparkleFrame gFieldFx_SparkleFrames[32]
{dy, tile}
Definition fxdata.c:403
const s16 gFieldFx_GroundParticleFrames[80]
{dx, dy, tile, shape, size} for each of 16 frames.
Definition fxdata.c:383
void * gFieldBlendWork[]
From slot 24.
void * gMapWork[]
void * Runtime_AllocateBlock(s32 kind, s32 size)
As Runtime_AllocateHeapBlock, but tries EWRAM first, for blocks that need room more than speed: the b...
Definition heap.c:80
#define WORK_SLOT(n)
Reads slots through their own addresses; adjacent slots are reached by offsets.
Definition heap_state.h:14
#define REG_BLDY
Definition io_reg.h:146
#define DMA_32BIT
Definition io_reg.h:210
#define BLDCNT_TGT2_ALL
Definition io_reg.h:140
#define REG_DMA3
Definition io_reg.h:153
#define BLEND_ALPHA(top, bottom)
A REG_BLDALPHA value: top and bottom are the two targets' weights, out of 16.
Definition io_reg.h:145
#define REG_BLDALPHA
Definition io_reg.h:142
#define REG_BLDCNT
Definition io_reg.h:119
#define DMA_ENABLE
Definition io_reg.h:217
#define Io_Write16(v, reg)
Writes a value to a 16-bit register or memory location.
Definition iowrite.h:14
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
Definition math.c:10
void Runtime_ReleaseHeapBlock(s32 slot)
#define FIELD_WEATHER_PARTICLE_COUNT
What every part of psynergy_effects.c shares: its includes and the macros and types more than one par...
void Runtime_PushSlotEntry(void *slotEntry, s32 slot)
Links a sprite entry into depth slot slot (clamped to 0..255) for this frame.
Definition render.c:79
void BattleFx_SetQueuedSoundAndPlay(s32 soundId)
Plays SE_298, then soundId (SE_289 for -1), and remembers soundId for BattleFx_PlayQueuedSound in the...
Definition requests.c:90
s32 Resource_DecodeByteLz(const void *source, void *destination)
Decodes a byte-oriented LZ resource and returns its unpacked byte count.
Definition decompress.c:37
s32 Scheduler_AddOrUpdateCallback(SchedulerCallback callback, s32 order)
Schedules callback with order, or gives a task already running it the new order, and re-sorts the tab...
Definition scheduler.c:102
#define SE_170
Definition songs.h:165
#define SE_172
Definition songs.h:167
#define SE_171
Definition songs.h:166
The colour buffer (heap block 32) that fades the BG and OBJ palettes: the source palette,...
Definition palbuf.h:40
u16 target[0x540]
the colours current moves toward, as current
Definition palbuf.h:47
The storm's lightning work: the colours it flashes between and their difference, the countdown to the...
Definition fxblend.h:13
s16 loud
nonzero plays the louder thunderclap, SE_172 for SE_171
Definition fxblend.h:25
s16 from[0x540]
The storm's dark colours (PALETTE_TRANSFORM_WARM), as the colour buffer's B, G and R channels: each f...
Definition fxblend.h:16
s16 delta[0x540]
the 12-frame steps from to back to from
Definition fxblend.h:18
s16 to[0x540]
the lit colours (PALETTE_TRANSFORM_PALE), as from
Definition fxblend.h:17
s16 enabled
Nonzero arms the next flash a random 51 to 549 frames after each, with a thunderclap.
Definition fxblend.h:24
s16 timer
Frames to the next flash, which comes in three, 5 frames apart; below 0 stops the lightning.
Definition fxblend.h:21
Work slot 29 while ground particles, motes or sparkles run.
struct GroundParticle particles[FIELD_WEATHER_PARTICLE_COUNT]
s32 tileBase
Their first tile in VRAM.
s32 stopped
Prevent new sparkle bursts while set.
s32 entry
Resource entry holding the effect's tiles.
One weather particle: OAM attributes followed by its world position.
u16 timer
Frames left; zero frees the particle.
u16 x
Screen pixels.
s32 delay
Motes: height risen; sparkles: phase within a burst.
s32 posY
The ground's height there.
u16 y
The OAM entry's attributes 0 to 2: the start routines write them whole as semi-transparent,...
u16 size
From the ground particle frame; motes, sparkles: 1.
u16 tile
The work's tileBase plus the frame's tile.
s32 posZ
World position, in 16.16 pixels.
u16 affineIndex
Sparkles: 8 on alternate frames, else 0.
u16 shape
From the ground particle frame; motes, sparkles: 0.
s32 posX
World position, in 16.16 pixels.
The field map's work: the followed position, screen shake, tile animations, blend script,...
Definition map_scroll.h:27
s32 * origin
The followed point, read as x, height and z in 16.16 fixed-point pixels; Camera_FollowActor points it...
Definition map_scroll.h:30
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
signed short s16
Definition types.h:12
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11
A particle's first word, seen as a value or a link.
Definition weather.c:150
u32 value
Definition weather.c:151
void * link
Definition weather.c:152
s32 Resource_FindFreeEntry(void)
Returns the number of the first free cache entry, or VRAM_CACHE_ENTRY_COUNT when all are taken.
Definition vram_cache.c:211
s32 VramCache_Load(u32 no, u32 size, const void *src)
Gives cache entry no size bytes of sprite VRAM and copies src there.
Definition vram_cache.c:143
void FieldMotes_Update(void)
Scheduler callback: the floating motes.
Definition weather.c:160
void FieldFx_ResumeLightning(void)
Restarts the lightning: the next flash in 128 frames, repeating.
Definition weather.c:458
void FieldFx_UpdateLightning(void)
Scheduler callback for the storm: every 150 to 550 frames lightning flashes the palette three times (...
Definition weather.c:61
void FieldMotes_Start(void)
Starts the floating motes (FieldMotes_Update): loads their tiles and puts 32 of them under the leader...
Definition weather.c:226
void FieldFx_StartLightning(void)
Starts the storm's lightning (FieldFx_UpdateLightning): builds the dark (0x10003) and lit (0x10005) p...
Definition weather.c:425
void BattleFx_StartBufferBlend(s32 from, s32 to)
Flashes the palette once, 120 frames from now, from palette from to palette to (BattleFx_BuildBuffer ...
Definition weather.c:467
void FieldFx_UpdateGroundParticles(void)
Scheduler callback: animates the ground particles.
Definition weather.c:12
void FieldEffect_UpdateSparkles(void)
Scheduler callback: the sparkles.
Definition weather.c:277
void FieldFx_StopLightning(void)
Stops the lightning: no flash for 0x7fff frames, and none after.
Definition weather.c:442
void FieldEffect_InitSparkles(void)
Starts the sparkles (FieldEffect_UpdateSparkles): loads their tiles and clears the 32 sparkles.
Definition weather.c:374
void FieldFx_StartGroundParticles(void)
Starts the ground particles (FieldFx_UpdateGroundParticles) with sound 170: loads their tiles and put...
Definition weather.c:105
void FieldFx_LastLightning(void)
One last flash of lightning in 12 frames, then no more.
Definition weather.c:450