Alchemy
Loading...
Searching...
No Matches

select.h

Go to the documentation of this file.
1#ifndef ALCHEMY_SELECT_H
2#define ALCHEMY_SELECT_H
3
4/// @file
5/// The selection screen's sprites and nodes.
6
7#include "types.h"
8#include "static_assert.h"
9#include "window.h"
10#include "affine.h"
11
12/// A selection screen sprite: a list link and its OAM attributes.
17 u8 mode : 2;
20 u8 shape : 2;
21 u16 x : 9;
23 u16 size : 2;
24 u16 tile : 10;
27};
28
29/// An icon of the selection screen: its list links, the entry it shows, its
30/// place and its slide toward a target, its zoom and its sprite.
32 struct SelectionNode *prev; ///< the icon before it in its row
33 struct SelectionNode *next; ///< the icon after it in its row
34 u16 base; ///< the entry's id, as listed in SelectionScreen.bases
35 u16 kind; ///< the entry's kind, as listed in SelectionScreen.kinds; 0 free
36 u16 slot; ///< VRAM cache slot of its picture
37 u16 tile; ///< first sprite tile of its picture
38 s16 x; ///< screen pixels
39 s16 y; ///< screen pixels
40 s16 dx; ///< pixels a frame
41 s16 dy; ///< pixels a frame
42 s16 targetX; ///< screen pixels
43 s16 targetY; ///< screen pixels
44 s16 homeX; ///< screen pixels, where it stood when chosen
45 s16 homeY; ///< screen pixels, where it stood when chosen
46 u16 message; ///< its name, shown in the screen's window
47 s16 scale; ///< 8.8 fixed point, 0x100 full size
48 s16 scaleStep; ///< 8.8 fixed point a frame
49 s16 scaleEnd; ///< 8.8 fixed point, 0x100 full size
51};
52
53/// The selection screen (heap block 18): the row of icons the player picks
54/// from, with arrows at each end and a pointing hand over the chosen target.
56 /// The icons; 14 is the pointing hand, whose picture is loaded at setup.
58 struct AffineTransform transform; ///< a zooming icon's scale
59 struct SelectionNode *head; ///< the first icon of the row
60 struct SelectionNode *path; ///< the icons chosen so far
61 struct UiWindow *window; ///< the window naming the chosen entry
62 /// The listed entries, up to 16 (Resource_PushPendingPair).
63 ///@{
67 ///@}
68 u16 baseX; ///< screen pixels
69 u16 baseY; ///< screen pixels
70 u16 unk39a; ///< cleared with the list; not read by name in TBS
71 u16 top; ///< the first listed entry shown
72 /// The entry under the hand, from top; bit 7 asks the next list to start
73 /// again from its first entry.
75 u16 verticalScroll; ///< pixels added to the icons' y; 32 at setup
76 u16 status; ///< 1 shown, 33 while scrolling; counts up each frame drawn
77 u16 pathTop[5]; ///< top, kept for each icon chosen on the path
78 u16 pathCursor[5]; ///< cursorIndex, kept for each icon chosen on the path
79 /// 999 from setup on. While 0, kind 6 icons sit at the top of the screen and
80 /// the window opens there; no TBS code clears it by name.
82 u8 unk3ba[42]; ///< not named by TBS code
83};
84
85STATIC_ASSERT(sizeof(struct SelectionSprite) == 0x0c);
86STATIC_ASSERT(sizeof(struct SelectionNode) == 0x34);
87STATIC_ASSERT(offsetof(struct SelectionNode, message) == 0x20);
88STATIC_ASSERT(offsetof(struct SelectionNode, sprite) == 0x28);
89STATIC_ASSERT(offsetof(struct SelectionScreen, head) == 0x348);
90STATIC_ASSERT(offsetof(struct SelectionScreen, kinds) == 0x354);
91STATIC_ASSERT(offsetof(struct SelectionScreen, cursorIndex) == 0x39e);
92STATIC_ASSERT(offsetof(struct SelectionScreen, locked) == 0x3b8);
93STATIC_ASSERT(sizeof(struct SelectionScreen) == 0x3e4);
94
95#endif
Sprite rotation and scale, and the affine matrices handed out each frame.
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
A sprite's rotation and scale: scales in 8.8 fixed point (0x100 is full size), the angle in 1/65536 t...
Definition affine.h:13
An icon of the selection screen: its list links, the entry it shows, its place and its slide toward a...
Definition select.h:31
s16 dy
pixels a frame
Definition select.h:41
s16 dx
pixels a frame
Definition select.h:40
u16 tile
first sprite tile of its picture
Definition select.h:37
s16 scaleEnd
8.8 fixed point, 0x100 full size
Definition select.h:49
s16 scale
8.8 fixed point, 0x100 full size
Definition select.h:47
struct SelectionNode * next
the icon after it in its row
Definition select.h:33
s16 scaleStep
8.8 fixed point a frame
Definition select.h:48
s16 targetX
screen pixels
Definition select.h:42
u16 message
its name, shown in the screen's window
Definition select.h:46
struct SelectionNode * prev
the icon before it in its row
Definition select.h:32
s16 homeX
screen pixels, where it stood when chosen
Definition select.h:44
u16 kind
the entry's kind, as listed in SelectionScreen.kinds; 0 free
Definition select.h:35
u16 base
the entry's id, as listed in SelectionScreen.bases
Definition select.h:34
struct SelectionSprite sprite
Definition select.h:50
s16 targetY
screen pixels
Definition select.h:43
s16 homeY
screen pixels, where it stood when chosen
Definition select.h:45
s16 x
screen pixels
Definition select.h:38
u16 slot
VRAM cache slot of its picture.
Definition select.h:36
s16 y
screen pixels
Definition select.h:39
The selection screen (heap block 18): the row of icons the player picks from, with arrows at each end...
Definition select.h:55
u16 pathTop[5]
top, kept for each icon chosen on the path
Definition select.h:77
struct UiWindow * window
the window naming the chosen entry
Definition select.h:61
u16 verticalScroll
pixels added to the icons' y; 32 at setup
Definition select.h:75
struct AffineTransform transform
a zooming icon's scale
Definition select.h:58
u16 status
1 shown, 33 while scrolling; counts up each frame drawn
Definition select.h:76
u16 top
the first listed entry shown
Definition select.h:71
u16 pathCursor[5]
cursorIndex, kept for each icon chosen on the path
Definition select.h:78
u16 locked
999 from setup on.
Definition select.h:81
u8 unk3ba[42]
not named by TBS code
Definition select.h:82
struct SelectionNode * path
the icons chosen so far
Definition select.h:60
u16 baseY
screen pixels
Definition select.h:69
u16 bases[16]
Definition select.h:65
u16 cursorIndex
The entry under the hand, from top; bit 7 asks the next list to start again from its first entry.
Definition select.h:74
u16 kinds[16]
The listed entries, up to 16 (Resource_PushPendingPair).
Definition select.h:64
struct SelectionNode records[16]
The icons; 14 is the pointing hand, whose picture is loaded at setup.
Definition select.h:57
struct SelectionNode * head
the first icon of the row
Definition select.h:59
u16 unk39a
cleared with the list; not read by name in TBS
Definition select.h:70
u16 baseX
screen pixels
Definition select.h:68
A selection screen sprite: a list link and its OAM attributes.
Definition select.h:13
struct SelectionSprite * next
Definition select.h:14
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
Definition uiwindow.h:11
The integer types, TRUE, UNUSED and the fixed-address macros.
signed short s16
Definition types.h:12
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11
The window renderer's work.