Alchemy
Loading...
Searching...
No Matches

perspective.h

Go to the documentation of this file.
1#ifndef ALCHEMY_PERSPECTIVE_H
2#define ALCHEMY_PERSPECTIVE_H
3
4/// @file
5/// The world map's perspective view work.
6
7#include "types.h"
8#include "static_assert.h"
9
10/// The world map's perspective view: the followed position, screen shake,
11/// view position, window, pitch and yaw, tile ids and zoom. Heap slot 8.
13 s32 *origin; ///< the followed point, as in MapScrollWork
14 s32 shakeX, shakeY, shakeDecay; ///< the screen shake, as in MapScrollWork
15 u8 *script; ///< NULL at load
16 u16 fade; ///< MapScrollWork's flags: REG_DISPCNT bits, 0x1f00 at load
17 u8 fadeStep; ///< MapScrollWork's wideTiles, 0x80 at load
18 u8 unk017[0xe4 - 0x17]; ///< as MapScrollWork: tile animations, blend script
19 s32 viewX; ///< 16.16 fixed-point pixels
20 s32 viewY; ///< 16.16 fixed-point pixels
21 s32 scaleX; ///< 0x200000 at load
22 s32 scaleY; ///< 0x400000 at load
23 s32 limitX; ///< 0x1fe00000 at load
24 s32 limitY; ///< 0x1fe00000 at load
25 /// Set by WorldMap_BeginStillView while BG1 shows the drawn map; the tile
26 /// animations are then neither suspended nor resumed.
28 u8 unk0fd[3]; ///< not named by TBS code
29 /// Screen rows, 0 and 159 at load and 200 and 255 from
30 /// WorldMap_BeginStillView; each frame copies them to shownTop and
31 /// shownBottom and picks BG mode 2 or 0 from them.
32 ///@{
35 ///@}
36 u16 shownTop; ///< windowTop as the frame update last applied it
37 u16 shownBottom; ///< windowBottom as the frame update last applied it
38 u16 windowPending; ///< cleared by the frame update; not set by name
39 u8 unk10a[6]; ///< not named by TBS code
40 /// The world map's tile offsets (ResourceId_PerspectiveDataA), each tile
41 /// LZ-compressed.
42 void *tiles;
43 u8 unk114[4]; ///< not named by TBS code
44 u16 pitch; ///< 1/65536 turns
45 u16 yaw; ///< 1/65536 turns
46 u32 *resources; ///< a row of gWorldMap_GraphicsResources, by terrain
47 u8 unk120[0x18]; ///< not named by TBS code
48 u16 tileIds[256]; ///< the world map tile in each of 16 by 16 cells
49 /// The tile each quarter of each layer's block buffer shows, so an unchanged
50 /// quarter is not decoded again.
52 s32 farPlane; ///< 0x1fe0000 at load
53 s32 distance; ///< farPlane scaled by the zoom
54 s32 previousZoom; ///< the zoom a transition starts from
55 s32 zoom; ///< 16.16 fixed point, 0x10000 full size
56 u16 zoomTransitionFrames; ///< a zoom transition's length; 0 when none
57 s16 zoomTransitionStep; ///< frames of the transition done
58};
59
60STATIC_ASSERT(sizeof(struct PerspectiveWork) == 0x35c);
61STATIC_ASSERT(offsetof(struct PerspectiveWork, viewX) == 0xe4);
62STATIC_ASSERT(offsetof(struct PerspectiveWork, pitch) == 0x118);
63STATIC_ASSERT(offsetof(struct PerspectiveWork, animationActive) == 0xfc);
64STATIC_ASSERT(offsetof(struct PerspectiveWork, resources) == 0x11c);
65STATIC_ASSERT(offsetof(struct PerspectiveWork, tileIds) == 0x138);
66STATIC_ASSERT(offsetof(struct PerspectiveWork, quarterTiles) == 0x338);
67STATIC_ASSERT(offsetof(struct PerspectiveWork, farPlane) == 0x348);
68STATIC_ASSERT(offsetof(struct PerspectiveWork, zoom) == 0x354);
69STATIC_ASSERT(offsetof(struct PerspectiveWork, previousZoom) == 0x350);
70STATIC_ASSERT(offsetof(struct PerspectiveWork, zoomTransitionFrames) == 0x358);
71STATIC_ASSERT(offsetof(struct PerspectiveWork, zoomTransitionStep) == 0x35a);
72
73#endif
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 world map's perspective view: the followed position, screen shake, view position,...
Definition perspective.h:12
s32 scaleX
0x200000 at load
Definition perspective.h:21
u16 quarterTiles[8]
The tile each quarter of each layer's block buffer shows, so an unchanged quarter is not decoded agai...
Definition perspective.h:51
s32 farPlane
0x1fe0000 at load
Definition perspective.h:52
u16 windowPending
cleared by the frame update; not set by name
Definition perspective.h:38
u32 * resources
a row of gWorldMap_GraphicsResources, by terrain
Definition perspective.h:46
s8 animationActive
Set by WorldMap_BeginStillView while BG1 shows the drawn map; the tile animations are then neither su...
Definition perspective.h:27
s32 limitY
0x1fe00000 at load
Definition perspective.h:24
s32 zoom
16.16 fixed point, 0x10000 full size
Definition perspective.h:55
s32 limitX
0x1fe00000 at load
Definition perspective.h:23
s32 previousZoom
the zoom a transition starts from
Definition perspective.h:54
u8 * script
NULL at load.
Definition perspective.h:15
u16 shownTop
windowTop as the frame update last applied it
Definition perspective.h:36
u8 unk114[4]
not named by TBS code
Definition perspective.h:43
u8 unk10a[6]
not named by TBS code
Definition perspective.h:39
s32 viewY
16.16 fixed-point pixels
Definition perspective.h:20
u16 tileIds[256]
the world map tile in each of 16 by 16 cells
Definition perspective.h:48
u8 fadeStep
MapScrollWork's wideTiles, 0x80 at load.
Definition perspective.h:17
u16 windowTop
Screen rows, 0 and 159 at load and 200 and 255 from WorldMap_BeginStillView; each frame copies them t...
Definition perspective.h:33
s32 scaleY
0x400000 at load
Definition perspective.h:22
u8 unk120[0x18]
not named by TBS code
Definition perspective.h:47
u16 shownBottom
windowBottom as the frame update last applied it
Definition perspective.h:37
u8 unk017[0xe4 - 0x17]
as MapScrollWork: tile animations, blend script
Definition perspective.h:18
void * tiles
The world map's tile offsets (ResourceId_PerspectiveDataA), each tile LZ-compressed.
Definition perspective.h:42
u16 pitch
1/65536 turns
Definition perspective.h:44
s16 zoomTransitionStep
frames of the transition done
Definition perspective.h:57
u16 fade
MapScrollWork's flags: REG_DISPCNT bits, 0x1f00 at load.
Definition perspective.h:16
s32 * origin
the followed point, as in MapScrollWork
Definition perspective.h:13
s32 shakeDecay
the screen shake, as in MapScrollWork
Definition perspective.h:14
u16 zoomTransitionFrames
a zoom transition's length; 0 when none
Definition perspective.h:56
u8 unk0fd[3]
not named by TBS code
Definition perspective.h:28
s32 viewX
16.16 fixed-point pixels
Definition perspective.h:19
u16 yaw
1/65536 turns
Definition perspective.h:45
s32 distance
farPlane scaled by the zoom
Definition perspective.h:53
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
signed char s8
Definition types.h:10
signed short s16
Definition types.h:12
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11