Alchemy
Loading...
Searching...
No Matches

kolima_forest_bridge_falling_effect.h

Go to the documentation of this file.
1#include "battle.h"
2#include "debug.h"
3#include "field.h"
4#include "game.h"
5#include "graphics.h"
6#include "menu.h"
7#include "minigame.h"
8#include "sound.h"
9#include "system.h"
10#include "global_cells.h"
11#include "types.h"
12#include "field_event.h"
13#include "songs.h"
14
15// Kolima and its forest bridge: the sparkling dust that falls over the party
16// when Tret's curse strikes ("Watch out! It's happening again!").
17
18/// The point the curse dust falls around.
20 s32 x; ///< 16.16 fixed-point pixels
21 s32 y; ///< 16.16 fixed-point pixels
22 s32 z; ///< 16.16 fixed-point pixels
23};
24/// The first map work slot, seen for the curse dust's origin.
27};
28
29s32 gFallingEffectOffset __attribute__((section(".bss")));
30s32 gFallingEffectWidth __attribute__((section(".bss")));
31u32 gFallingEffectState __attribute__((section(".bss")));
32
33/// A scene callback: every eighth frame a speck (object 285, its script
34/// gFallingEffectScript) starts 160 pixels up at a random point near the map
35/// work's origin, with SE_246 every 64 frames. gFallingEffectState shapes the
36/// fall: 0 within 128 pixels of the origin; 1 and 2 over a band that widens
37/// (by 50 a frame, to 15000 and 30000) as it moves towards the origin; 3
38/// drifting on until it is far past, then back to 0.
40 struct FieldActor *object = NULL;
41 struct SceneEffectOrigin *origin;
42 struct AnimationObject *sprite;
43 s32 x, z;
44
45 switch (gFallingEffectState) {
46 case 1:
47 if (gFallingEffectWidth < 15000)
49 if (gFallingEffectOffset > 0x3c0000)
50 gFallingEffectOffset -= 0x4000;
51 break;
52 case 2:
53 if (gFallingEffectWidth < 30000)
55 if (gFallingEffectOffset > 0x180000)
56 gFallingEffectOffset -= 0x4000;
57 break;
58 case 3:
59 if (gFallingEffectOffset < -0x800000) {
61 } else {
63 gFallingEffectOffset -= 0x4000;
64 }
65 break;
66 }
67 if ((gFrameCount & 7) == 0 &&
68 (object = Engine_ObjectCreate(285, 0, 0, 0)) != 0) {
69 origin = ((struct SceneEffectWork *)gMapWork[0])->origin;
70 if ((gFrameCount & 63) == 0)
72 if (gFallingEffectState != 0)
73 x = origin->x +
74 (((u32)Engine_RandomNext() * gFallingEffectWidth >> 16) << 8) +
76 else
77 x = origin->x + (Engine_RandomNext() << 8) - 0x800000;
78 z = origin->z + (Engine_RandomNext() << 8) - 0x800000;
79 object->motionFlags = 0;
80 object->y.fixed = 0xa00000;
81 sprite = object->sprite;
82 object->scaleX = 0xe666;
83 object->scaleY = 0xe666;
84 object->x.fixed = x;
85 object->z.fixed = z;
86 sprite->flags = 0;
87 object->priorityFlags &= ~1;
88 sprite->image.priority = 1;
89 Object_SetMode(object, 1);
91 }
92}
struct FieldActor * Engine_ObjectCreate(s32, s32, s32, s32)
The engine calls the debug menus import, and their palette swatch tiles.
The scene script layer: the engine services a scene's events call, declared once (Engine_EventBegin,...
void Object_SetMode(struct FieldActor *object, s32 animation)
void Engine_ObjectSetScript(struct FieldActor *object, const s32 *script)
s32 Engine_RandomNext()
volatile u32 gFrameCount
Frames WaitFrames has finished.
The work slots of gWorkSlot, read through their own names.
void * gMapWork[]
The screen blend's globals and the graphics routines.
s32 gFallingEffectScript[]
Definition kolima.c:1714
The reel game's title lettering.
Song and sound effect ids, indices into gSound_SongTable.
#define SE_246
Definition songs.h:241
void Engine_AudioPlayCue()
#define NULL
Definition bilibin.h:6
void Kolima_UpdateCurseDust(void)
A scene callback: every eighth frame a speck (object 285, its script gFallingEffectScript) starts 160...
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
Definition animspr.h:108
struct AnimationSpritePart image
Definition animspr.h:109
u8 flags
bits: 1 outlined in ObjectSystemWork's edge and fill colours | 0 shadow drawn (set when created)
Definition animspr.h:128
u16 priority
2 when created
Definition animspr.h:100
A field actor: a person or thing on the field with a position, motion toward a target,...
Definition field_obj.h:30
The point the curse dust falls around.
s32 y
16.16 fixed-point pixels
s32 z
16.16 fixed-point pixels
s32 x
16.16 fixed-point pixels
The first map work slot, seen for the curse dust's origin.
struct SceneEffectOrigin * origin
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15