Alchemy
Loading...
Searching...
No Matches

world_map_linked_effects.h

Go to the documentation of this file.
1#include "resource.h"
2#include "types.h"
3#include "animspr.h"
4#include "field_effect.h"
5#include "vram_block.h"
6#include "b5_context.h"
7#include "fx_scene.h"
8
9// Vale and the world map: the particles that rise around a glowing actor.
10
11/// Attaches two rising particles to the actor, sharing the effect's cached
12/// tiles.
14 struct FieldActor *pair[2];
15 struct FieldActor *child;
16 struct AnimationObject *sprite;
17 struct BattleFxScene *work = gEffectWork;
18 s32 i;
19
20 for (i = 0; i < 2; ++i) {
21 child = Engine_ObjectCreate(26, parent->x.fixed, parent->y.fixed,
22 parent->z.fixed);
23 pair[i] = child;
24 if (child != NULL) {
25 child->terrainHeight = parent->terrainHeight;
26 sprite = child->sprite;
27 child->motionFlags = 0;
28 child->timer = 0;
29 child->linkedObject = parent;
30 if (sprite != NULL) {
32 sprite->flags = 0;
34 sprite->slot = work->tileSlot;
35 sprite->retainCacheEntry = 1;
36 sprite->image.tile =
37 (gVramBlockCache[sprite->slot].offset >> 5) & 0x3ff;
38 sprite->image.fullColor = 0;
39 sprite->image.shape = 1;
40 sprite->image.size = 2;
41 sprite->entries[0]->frame = 0;
42 }
43 }
44 }
45 {
46 struct FieldActor *effect = pair[0];
47 struct AnimationObject *effectSprite = effect->sprite;
48
49 effect->update = Effect_AnimateVerticalNegative;
50 effectSprite->image.priority = 1;
51 }
52 {
53 struct FieldActor *effect = pair[1];
54 struct AnimationObject *effectSprite = effect->sprite;
55
56 effectSprite->image.priority = 1;
57 effect->update = Effect_AnimateVerticalPositive;
58 effect->priorityFlags = 2;
59 }
60}
s32 AnimationObjects_SelectAnimation(struct AnimationObject *sprite, s32 animation)
Starts animation flags & 0x7f on every layer of a sprite (bit 7 keeps each layer's place and timer),...
Definition animation.c:317
Animated sprites: their layers, frames and colour modes, and the resource slots they draw from.
B5Context, the object context a battle routine reads; most of its fields are still unnamed.
struct FieldActor * Engine_ObjectCreate(s32, s32, s32, s32)
Field effects, their scripts and the flags that spawn them.
BattleFxScene, the work of a battle or field Psynergy effect scene, and its arc objects.
void * gEffectWork
Slot 56: points to a scene-specific structure.
#define NULL
Definition bilibin.h:6
void WorldMap_CreateLinkedEffects(struct FieldActor *parent)
Attaches two rising particles to the actor, sharing the effect's cached tiles.
u8 frame
frame shown, frameBase plus the facing offset; 255 none
Definition animspr.h:53
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
u8 slot
VRAM cache entry holding its tiles.
Definition animspr.h:112
struct AnimationEntry * entries[4]
its layers; empty ones null
Definition animspr.h:130
u8 retainCacheEntry
Keeps the VRAM cache entry when it is released or off screen.
Definition animspr.h:114
u16 fullColor
256 colours; set for both parts when created
Definition animspr.h:94
u16 tile
first sprite tile in VRAM
Definition animspr.h:99
u16 priority
2 when created
Definition animspr.h:100
The work of a Psynergy effect scene: its caster and target, where it takes place, the map state it re...
Definition fx_scene.h:31
u16 tileSlot
resource entry holding the spark tiles
Definition fx_scene.h:64
void * child
the target's object, or NULL
Definition fx_scene.h:37
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
u8 priorityFlags
ActorPriorityFlag bits, read by the scrolling camera.
Definition field_obj.h:51
s32 terrainHeight
16.16 fixed-point pixels
Definition field_obj.h:38
union FieldCoordinate z
16.16 fixed-point pixels
Definition field_obj.h:37
void(*) update(union FieldObject *object)
Called each frame before the object's script, while the object is live.
Definition field_obj.h:116
u16 offset
bytes from the start of OBJ VRAM
Definition vram_tab.h:25
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
s32 fixed
16.16 fixed-point pixels
Declares nothing of its own: it only includes the window, battle command, resource and VRAM table hea...
s32 Resource_ResetEntry(u32 no)
Frees cache entry no: its blocks go back and the entry is marked free (offset 0xffff).
Definition vram_cache.c:106
struct VramBlockCacheEntry gVramBlockCache[]