Alchemy
Loading...
Searching...
No Matches

facing.c

Go to the documentation of this file.
1#include "unit/field/facing.h"
2#include "types.h"
3#include "objcmd.h"
4
5/// Facing tables: for each animation kind, the frame to draw for each sector
6/// of the facing angle. Sprite_ComposeAnimationFrame adds the low three bits
7/// to the animation's base frame, and bit 7 (0x80) mirrors the sprite.
8/// Kinds 1, 2 and 22 have eight sectors, 3 and 5 sixteen, 4 and 6 sixty-four;
9/// kinds 8 and 88 have eight sectors centred on the eight compass directions.
10/// Kind 20 uses kind 2's table. Kind 1's table has 16 entries, but a 16-bit
11/// angle shifted down 13 reads only the first eight.
12// clang-format off
14 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00,
15 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80,
16};
17
19 0x80, 0x80, 0x00, 0x00, 0x01, 0x01, 0x81, 0x81,
20};
21
23 0x00, 0x00, 0x80, 0x80, 0x01, 0x01, 0x81, 0x81,
24};
25
27 0x01, 0x01, 0x00, 0x00, 0x80, 0x80, 0x81, 0x81,
28 0x81, 0x81, 0x82, 0x82, 0x02, 0x02, 0x02, 0x01,
29};
30
32 0x01, 0x00, 0x00, 0x03, 0x03, 0x80, 0x80, 0x81,
33 0x81, 0x82, 0x82, 0x04, 0x04, 0x02, 0x02, 0x01,
34};
35
37 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04, 0x03,
38};
39
41 0x01, 0x00, 0x03, 0x85, 0x86, 0x87, 0x04, 0x02,
42};
43
45 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
46 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
47 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
48 0x80, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
49 0x81, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x83,
50 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
51 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
52 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01,
53};
54
56 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
57 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
58 0x04, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
59 0x80, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
60 0x81, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x83,
61 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x05,
62 0x05, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
63 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01,
64};
65
66/// The order in which the 64 pixels of a sprite's tile in OBJ VRAM dissolve;
67/// read by Map_RenderAnimatedTileFrame (objects.c).
69 4, 63, 12, 10, 44, 5, 1, 60, 46, 41, 3, 23, 29, 55, 51, 15,
70 50, 25, 26, 57, 19, 49, 16, 61, 8, 58, 37, 17, 27, 31, 59, 53,
71 11, 56, 33, 7, 30, 35, 36, 32, 42, 62, 21, 13, 2, 22, 45, 14,
72 6, 48, 52, 9, 43, 28, 0, 40, 24, 34, 20, 47, 54, 39, 38, 18,
73};
74
75/// Two bytes after the dissolve order; no code in The Broken Seal names them.
77
78/// The fixed camera's view matrix (Q16): identity with a -0.8 shear of y by x.
79/// ObjectSystem_UpdateCameraFixed applies it while battle commands are chosen.
81 0x10000, 0, 0,
82 -0xcccc, 0x10000, 0,
83 0, 0, 0x10000,
84 0, 0, 0,
85};
86
87/// One period of a triangle wave, which bobs a floating object up and down.
88/// Object_UpdateAllThumb reads it at half the object's phase, scaled by its
89/// gravity.
91 1, 2, 3, 4, 5, 6, 7, 8,
92 7, 6, 5, 4, 3, 2, 1, 0,
93 -1, -2, -3, -4, -5, -6, -7, -8,
94 -7, -6, -5, -4, -3, -2, -1, 0,
95};
96
97/// The idle script an object returns to when its own one ends: a lone SC_END,
98/// which reloads it. Script_End (SC_END) points an object here.
100 SC_END,
101};
102
103/// Halfwords that follow the main script; no code in The Broken Seal names
104/// them.
106 0x1000, -0x2000, 0x3000, -0x4000, 0x6000, -0x8000, 0x4000, 0x0,
107};
108
109/// The heading for each state of the direction pad (bits 4-7 of the keys);
110/// 0xffff means no direction is held, or only an opposite pair. Read by
111/// FieldObject_UpdatePlayerControl, Object_MoveOnWorldMap and
112/// Object_MoveByKeys.
114 0xffff, 0x0000, 0x8000, 0xffff, 0xc000, 0xe000, 0xa000, 0xc000,
115 0x4000, 0x2000, 0x6000, 0x4000, 0xffff, 0x0000, 0x8000, 0xffff,
116};
117
118/// Two scripts for the world map's footprint and dust effects: wait 120 or 30
119/// frames, then release the object. FieldObject_UpdatePlayerControl starts
120/// the first and Object_MoveOnWorldMap the second (three words in).
122 SC_WAIT(120), SC_FREE,
123 SC_WAIT(30), SC_FREE,
124};
125
126/// The world map camera's turn rate for each state of the direction pad, read
127/// by Object_MoveOnWorldMap.
129 0, -512, 512, 0,
130 0, -384, 384, 0,
131 0, -384, 384, 0,
132 0, 0, 0, 0,
133};
134// clang-format on
const u16 gMap_TileDissolveTail
Two bytes after the dissolve order; no code in The Broken Seal names them.
Definition facing.c:76
const s32 gWorldMap_KeyYaws[16]
The world map camera's turn rate for each state of the direction pad, read by Object_MoveOnWorldMap.
Definition facing.c:128
const u8 gAnimationFacing_Kind88[8]
Definition facing.c:40
const u8 gAnimationFacing_Kind3[16]
Definition facing.c:26
const u8 gAnimationFacing_Kind2[8]
Definition facing.c:22
const u8 gAnimationFacing_Kind1[16]
Facing tables: for each animation kind, the frame to draw for each sector of the facing angle.
Definition facing.c:13
const s32 gScript_MainScript[1]
The idle script an object returns to when its own one ends: a lone SC_END, which reloads it.
Definition facing.c:99
const u8 gMap_TileDissolveOrder[64]
The order in which the 64 pixels of a sprite's tile in OBJ VRAM dissolve; read by Map_RenderAnimatedT...
Definition facing.c:68
const s32 gScriptObject_CycleTable[32]
One period of a triangle wave, which bobs a floating object up and down.
Definition facing.c:90
const u8 gAnimationFacing_Kind6[64]
Definition facing.c:55
const u8 gAnimationFacing_Kind22[8]
Definition facing.c:18
const s32 gWorldMap_FootprintActions[6]
Two scripts for the world map's footprint and dust effects: wait 120 or 30 frames,...
Definition facing.c:121
const u8 gAnimationFacing_Kind5[16]
Definition facing.c:31
const s32 gCamera_FixedViewMatrix[12]
The fixed camera's view matrix (Q16): identity with a -0.8 shear of y by x.
Definition facing.c:80
const u16 gWorldMap_KeyHeadings[16]
The heading for each state of the direction pad (bits 4-7 of the keys); 0xffff means no direction is ...
Definition facing.c:113
const u8 gAnimationFacing_Kind4[64]
Definition facing.c:44
const s16 gScript_MainScriptTail[8]
Halfwords that follow the main script; no code in The Broken Seal names them.
Definition facing.c:105
const u8 gAnimationFacing_Kind8[8]
Definition facing.c:36
Field object scripts: one s32 command word, then its operands, as gScriptObject_CommandTable runs the...
#define SC_FREE
Release.
Definition objcmd.h:43
#define SC_WAIT(n)
Wait n frames.
Definition objcmd.h:16
#define SC_END
Return to the main script.
Definition objcmd.h:32
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
signed short s16
Definition types.h:12
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11