Alchemy
Loading...
Searching...
No Matches

battle_display.h

Go to the documentation of this file.
1#ifndef ALCHEMY_BATTLE_DISPLAY_H
2#define ALCHEMY_BATTLE_DISPLAY_H
3
4/// @file
5/// The battle camera and the presentation's transition, background and affine
6/// work.
7
8#include "battle_session.h"
10
11#include "types.h"
12#include "static_assert.h"
13#include "edition.h"
14#include "farcall.h"
15
16/// The battle camera: its eye, the focus it turns about, and its pitch, yaw
17/// and distance. It lives in the HEAP_SLOT_CAMERA work slot.
19 /// The eye, 16.16 fixed-point pixels: written each frame distance behind
20 /// the focus along the turned view.
21 s32 eye[3];
22 s32 pos[3]; ///< the focus, 16.16 fixed-point pixels
23 s32 unk18; ///< cleared beside followPos; not read by name in TBS
24 s32 *followPos; ///< when set, the focus followed instead of pos
25 s32 distance; ///< eye to focus, 16.16 fixed-point pixels
26 u8 unk24[16]; ///< not named by TBS code
27 u16 pitch; ///< 1/65536 turns
28 u16 yaw; ///< 1/65536 turns
29 u8 unk38[20]; ///< not named by TBS code
30};
31
32STATIC_ASSERT(sizeof(struct BattleCamera) == 0x4c);
33STATIC_ASSERT(offsetof(struct BattleCamera, pos) == 0x0c);
34STATIC_ASSERT(offsetof(struct BattleCamera, followPos) == 0x1c);
35STATIC_ASSERT(offsetof(struct BattleCamera, pitch) == 0x34);
36STATIC_ASSERT(offsetof(struct BattleCamera, yaw) == 0x36);
37
38extern struct BattleCamera *gCameraWork;
39
40/// The battle background's work slot as the camera reads it: the yaw the
41/// camera eases toward and the frames left to ease it.
43 s32 targetYaw; ///< 1/65536 turns
44 s32 frames; ///< frames left to ease the yaw, a sixteenth a frame
45 u8 unk08[8]; ///< BattleBackgroundView's mode and secondMode
46 s32 active; ///< BattleBackgroundView's busy, at the same offset
47 /// 0 lets the camera update set the background's range each frame; 1 for
48 /// a critical hit's zoom and once a round's view is set.
50 s32 unk18; ///< cleared when the battle starts; not read by name in TBS
51 s32 unk1c; ///< cleared when the battle starts; not read by name in TBS
52};
53
54/// The effect updates its command while the presentation keeps animation state.
57 /// Each target's animation entries' param, saved before the effect.
59};
60
63STATIC_ASSERT(sizeof(struct BattlePresentationWork) == 0x54);
64STATIC_ASSERT(offsetof(struct BattlePresentationWork, effect.actors) == 0x24);
65
66/// The battle background's work slot as the background code reads it: its
67/// display mode (2 draws it as an affine perspective plane).
69 u8 unk00[8]; ///< BattlePresentationTransition's targetYaw and frames
70 s32 mode; ///< 2 draws the affine plane; 1 sets BG1's scroll too
71 s32 secondMode; ///< 1 also sets BG1's scroll; one effect sets it
72 s32 busy; ///< while set, BattleCamera_SetRange leaves BG1's scroll
73};
74
75/// The battle background's affine parameters and reference point, copied
76/// whole to the BG2PA registers.
80};
81
82/// The battle background's scanline work in heap slot 10: two pages of
83/// per-line BG2CNT values, swapped each frame, and the affine parameters.
85 u32 page; ///< the page of lines shown; the other one is built
86 u8 unk04[12]; ///< not named by TBS code
88 u16 lines[2][160];
89};
90
91STATIC_ASSERT(sizeof(struct BattleBackgroundView) == 0x14);
93STATIC_ASSERT(sizeof(struct BattleAffineHdma) == 0x2a0);
94STATIC_ASSERT(offsetof(struct BattleAffineHdma, affine) == 0x10);
95STATIC_ASSERT(offsetof(struct BattleAffineHdma, lines) == 0x20);
96
97struct BattlePlan;
99
100#endif
struct BattleCamera * gCameraWork
BattleEffectArgument, the command an effect's caller, dispatcher and handlers share,...
A battle's objects and sprites, each unit's command and action record, and the spoils.
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
Public interfaces to the engine's code banks.
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 background's scanline work in heap slot 10: two pages of per-line BG2CNT values,...
u8 unk04[12]
not named by TBS code
u32 page
the page of lines shown; the other one is built
u16 lines[2][160]
struct BattleAffine affine
The battle background's affine parameters and reference point, copied whole to the BG2PA registers.
The battle background's work slot as the background code reads it: its display mode (2 draws it as an...
s32 mode
2 draws the affine plane; 1 sets BG1's scroll too
s32 busy
while set, BattleCamera_SetRange leaves BG1's scroll
u8 unk00[8]
BattlePresentationTransition's targetYaw and frames.
s32 secondMode
1 also sets BG1's scroll; one effect sets it
The battle camera: its eye, the focus it turns about, and its pitch, yaw and distance.
u16 pitch
1/65536 turns
s32 distance
eye to focus, 16.16 fixed-point pixels
u16 yaw
1/65536 turns
s32 * followPos
when set, the focus followed instead of pos
s32 pos[3]
the focus, 16.16 fixed-point pixels
s32 eye[3]
The eye, 16.16 fixed-point pixels: written each frame distance behind the focus along the turned view...
u8 unk38[20]
not named by TBS code
u8 unk24[16]
not named by TBS code
s32 unk18
cleared beside followPos; not read by name in TBS
The command shared by an effect's caller, dispatcher and handlers.
One action, as BattleCommand_BuildPlan lays it out for BattleTargetExec to apply target by target.
Definition battle_type.h:26
The battle background's work slot as the camera reads it: the yaw the camera eases toward and the fra...
s32 unk18
cleared when the battle starts; not read by name in TBS
u8 unk08[8]
BattleBackgroundView's mode and secondMode.
s32 frames
frames left to ease the yaw, a sixteenth a frame
s32 flag
0 lets the camera update set the background's range each frame; 1 for a critical hit's zoom and once ...
s32 unk1c
cleared when the battle starts; not read by name in TBS
s32 active
BattleBackgroundView's busy, at the same offset.
The effect updates its command while the presentation keeps animation state.
struct BattleEffectArgument effect
u8 savedAnimationParameters[8][4]
Each target's animation entries' param, saved before the effect.
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11