Alchemy
Loading...
Searching...
No Matches

battle_event.h

Go to the documentation of this file.
1#ifndef ALCHEMY_BATTLE_EVENT_H
2#define ALCHEMY_BATTLE_EVENT_H
3
4/// @file
5/// The battle event queue: the events BattleEvPush queues and the playback
6/// phases that play them.
7
8#include "edition.h"
9#include "static_assert.h"
10
12
13/// BattleEventState.phase: how far BattleEvent_Playback has got through the
14/// plan's targets. Its message phases (PLAY_MESSAGE and the like) are
15/// private to playback.c.
17 BATTLE_PLAYBACK_IDLE = 0, ///< paused until the effect resumes it
18 BATTLE_PLAYBACK_RESOLVE_TARGET = 1, ///< resolves the next target's events
19 BATTLE_PLAYBACK_DISPATCH = 2, ///< plays the queued events in order
20 BATTLE_PLAYBACK_READY = 4 ///< every target has been played
21};
22
23/// The battle event queue: up to 64 events, each an opcode (enum
24/// BattleEventOpcode) and one operand, in the order they play.
28 s32 targetIndex; ///< the plan's next target to resolve
29 s32 count; ///< events queued
30};
31
32STATIC_ASSERT(sizeof(struct BattleEventQueue) == 0x148);
33STATIC_ASSERT(offsetof(struct BattleEventQueue, operands) == 0x040);
34STATIC_ASSERT(offsetof(struct BattleEventQueue, targetIndex) == 0x140);
35STATIC_ASSERT(offsetof(struct BattleEventQueue, count) == 0x144);
36
37/// The battle events BattleEvPush queues, each with one operand, for
38/// BattleEvent_Playback (or BattleEv_DispatchQueued) to play in order. The
39/// names, numbers and messages build what the player reads: the arguments
40/// first, then the message that shows them.
42 BATTLE_EVENT_UNIT_NAME = 0, ///< a unit's name for the next message
43 BATTLE_EVENT_NUMBER = 1, ///< a number for the next message
44 BATTLE_EVENT_ITEM_NAME = 2, ///< an item's name for the next message
45 BATTLE_EVENT_ABILITY_NAME = 3, ///< an ability's name for the next message
46 BATTLE_EVENT_MESSAGE = 4, ///< a message, waiting for the player
47 BATTLE_EVENT_MESSAGE_NO_WAIT = 5, ///< a message, going straight on
48 BATTLE_EVENT_MARK = 6, ///< sets gBattleDisplayWork->marked
49 BATTLE_EVENT_CLEAR_ARGUMENTS = 7, ///< forgets the names and numbers pushed
50 BATTLE_EVENT_HIT = 8, ///< the unit flinches and flashes
51 BATTLE_EVENT_DEFEAT = 9, ///< the unit falls; an enemy fades out
52 BATTLE_EVENT_DRAW_STATUS = 10, ///< redraws the party's status
53 BATTLE_EVENT_REFRESH_UNIT = 11, ///< the unit's status icons, colour, pose
54 BATTLE_EVENT_REMOVE_UNIT = 12, ///< an enemy leaves the battle
55 BATTLE_EVENT_DJINN_BONUS = 13, ///< later defeats give the Djinn bonus
56 BATTLE_EVENT_SOUND = 14 ///< plays a sound
57};
58
59#endif
BattlePlaybackPhase
BattleEventState.phase: how far BattleEvent_Playback has got through the plan's targets.
@ BATTLE_PLAYBACK_RESOLVE_TARGET
resolves the next target's events
@ BATTLE_PLAYBACK_READY
every target has been played
@ BATTLE_PLAYBACK_IDLE
paused until the effect resumes it
@ BATTLE_PLAYBACK_DISPATCH
plays the queued events in order
BattleEventOpcode
The battle events BattleEvPush queues, each with one operand, for BattleEvent_Playback (or BattleEv_D...
@ BATTLE_EVENT_DEFEAT
the unit falls; an enemy fades out
@ BATTLE_EVENT_UNIT_NAME
a unit's name for the next message
@ BATTLE_EVENT_MARK
sets gBattleDisplayWork->marked
@ BATTLE_EVENT_DRAW_STATUS
redraws the party's status
@ BATTLE_EVENT_DJINN_BONUS
later defeats give the Djinn bonus
@ BATTLE_EVENT_HIT
the unit flinches and flashes
@ BATTLE_EVENT_CLEAR_ARGUMENTS
forgets the names and numbers pushed
@ BATTLE_EVENT_ABILITY_NAME
an ability's name for the next message
@ BATTLE_EVENT_REFRESH_UNIT
the unit's status icons, colour, pose
@ BATTLE_EVENT_REMOVE_UNIT
an enemy leaves the battle
@ BATTLE_EVENT_MESSAGE
a message, waiting for the player
@ BATTLE_EVENT_MESSAGE_NO_WAIT
a message, going straight on
@ BATTLE_EVENT_ITEM_NAME
an item's name for the next message
@ BATTLE_EVENT_NUMBER
a number for the next message
@ BATTLE_EVENT_SOUND
plays a sound
@ BATTLE_EVENT_CAPACITY
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
STATIC_ASSERT, a compile-time check that emits nothing.
#define STATIC_ASSERT(condition)
C89 permits repeated extern declarations of the same array.
#define offsetof(type, member)
Definition stddef.h:19
The battle event queue: up to 64 events, each an opcode (enum BattleEventOpcode) and one operand,...
s32 targetIndex
the plan's next target to resolve
u32 operands[BATTLE_EVENT_CAPACITY]
s32 count
events queued
u8 opcodes[BATTLE_EVENT_CAPACITY]
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
unsigned char u8
Definition types.h:11