|
9 | 9 |
|
10 | 10 | #include "xScene.h" |
11 | 11 |
|
12 | | -enum state_enum |
13 | | -{ |
14 | | - STATE_INVALID = -1, |
15 | | - BEGIN_STATE = 0, |
16 | | - STATE_START = 1, |
17 | | - STATE_NEXT = 2, |
18 | | - STATE_WAIT = 3, |
19 | | - STATE_STOP = 4, |
20 | | - END_STATE = 5, |
21 | | - MAX_STATE = 5, |
22 | | -}; |
23 | | - |
24 | | -enum query_enum |
25 | | -{ |
26 | | - Q_SKIP, |
27 | | - Q_YESNO |
28 | | -}; |
29 | | - |
30 | 12 | struct ztalkbox : xBase |
31 | 13 | { |
32 | 14 | struct asset_type : xDynAsset |
@@ -145,155 +127,169 @@ struct ztalkbox : xBase |
145 | 127 | void hide(); |
146 | 128 | }; |
147 | 129 |
|
148 | | -struct state_type |
| 130 | +namespace |
149 | 131 | { |
150 | | - state_enum type; |
151 | | -}; |
| 132 | + enum state_enum |
| 133 | + { |
| 134 | + STATE_INVALID = -1, |
| 135 | + BEGIN_STATE = 0, |
| 136 | + STATE_START = 1, |
| 137 | + STATE_NEXT = 2, |
| 138 | + STATE_WAIT = 3, |
| 139 | + STATE_STOP = 4, |
| 140 | + END_STATE = 5, |
| 141 | + MAX_STATE = 5, |
| 142 | + }; |
152 | 143 |
|
153 | | -struct jot; |
| 144 | + enum query_enum |
| 145 | + { |
| 146 | + Q_SKIP, |
| 147 | + Q_YESNO |
| 148 | + }; |
154 | 149 |
|
155 | | -struct callback |
156 | | -{ |
157 | | - void (*render)(jot&, xtextbox&, F32, F32); |
158 | | - void (*layout_update)(jot&, xtextbox&, xtextbox&); |
159 | | - void (*render_update)(jot&, xtextbox&, xtextbox&); |
160 | | -}; |
| 150 | + struct state_type |
| 151 | + { |
| 152 | + state_enum type; |
161 | 153 |
|
162 | | -struct split_tag |
163 | | -{ |
164 | | - substr tag; |
165 | | - substr name; |
166 | | - substr action; |
167 | | - substr value; |
168 | | -}; |
| 154 | + void start(); |
| 155 | + void stop(); |
| 156 | + }; |
169 | 157 |
|
170 | | -struct tag_type |
171 | | -{ |
172 | | - substr name; |
173 | | - void (*parse_tag)(jot&, xtextbox&, xtextbox&, split_tag&); |
174 | | - void (*reset_tag)(jot&, xtextbox&, xtextbox&, split_tag&); |
175 | | - void* context; |
176 | | -}; |
| 158 | + struct jot; |
| 159 | + struct callback |
| 160 | + { |
| 161 | + void (*render)(jot&, xtextbox&, F32, F32); |
| 162 | + void (*layout_update)(jot&, xtextbox&, xtextbox&); |
| 163 | + void (*render_update)(jot&, xtextbox&, xtextbox&); |
| 164 | + }; |
177 | 165 |
|
178 | | -struct jot |
179 | | -{ |
180 | | - substr s; |
| 166 | + struct split_tag |
| 167 | + { |
| 168 | + substr tag; |
| 169 | + substr name; |
| 170 | + substr action; |
| 171 | + substr value; |
| 172 | + }; |
181 | 173 |
|
182 | | - struct |
| 174 | + struct tag_type |
183 | 175 | { |
184 | | - // Offset: 0x8 |
185 | | - bool invisible : 1; // bit 24 |
186 | | - bool ethereal : 1; // bit 25 |
187 | | - bool merge : 1; // bit 26 |
188 | | - bool word_break : 1; // bit 27 |
189 | | - bool word_end : 1; // bit 28 |
190 | | - bool line_break : 1; // bit 29 |
191 | | - bool stop : 1; // bit 30 |
192 | | - bool tab : 1; // bit 31 |
193 | | - |
194 | | - // Offset: 0x9 |
195 | | - bool insert : 1; // bit 24 |
196 | | - bool dynamic : 1; // bit 25 |
197 | | - bool page_break : 1; // bit 26 |
198 | | - bool stateful : 1; // bit 27 |
199 | | - U16 dummy : 4; // bits 28-31 |
200 | | - } flag; |
201 | | - // Offset: 0xC |
202 | | - U16 context_size; |
203 | | - |
204 | | - // Offset: 0x10 |
205 | | - void* context; |
206 | | - basic_rect<F32> bounds; |
207 | | - basic_rect<F32> render_bounds; |
208 | | - callback* cb; |
209 | | - tag_type* tag; |
210 | | - |
211 | | - void intersect_flags(const jot& other); |
212 | | - void reset_flags(); |
213 | | -}; |
| 176 | + substr name; |
| 177 | + void (*parse_tag)(jot&, xtextbox&, xtextbox&, split_tag&); |
| 178 | + void (*reset_tag)(jot&, xtextbox&, xtextbox&, split_tag&); |
| 179 | + void* context; |
| 180 | + }; |
214 | 181 |
|
215 | | -struct jot_line |
216 | | -{ |
217 | | - basic_rect<F32> bounds; |
218 | | - F32 baseline; |
219 | | - U32 first; |
220 | | - U32 last; |
221 | | - U8 page_break; |
222 | | -}; |
| 182 | + struct jot |
| 183 | + { |
| 184 | + substr s; |
223 | 185 |
|
224 | | -struct layout |
225 | | -{ |
226 | | - xtextbox tb; // offset 0x0, size 0x68 |
227 | | - jot _jots[512]; // offset 0x68, size 0x7000 |
228 | | - U32 _jots_size; // offset 0x7068, size 0x4 |
229 | | - jot_line _lines[128]; // offset 0x706C, size 0x1000 |
230 | | - U32 _lines_size; // offset 0x806C, size 0x4 |
231 | | - U8 context_buffer[1024]; // offset 0x8070, size 0x400 |
232 | | - U32 context_buffer_size; // offset 0x8470, size 0x4 |
233 | | - U16 dynamics[64]; // offset 0x8474, size 0x80 |
234 | | - U32 dynamics_size; // offset 0x84F4, size 0x4 |
235 | | -}; |
| 186 | + struct |
| 187 | + { |
| 188 | + // Offset: 0x8 |
| 189 | + bool invisible : 1; // bit 24 |
| 190 | + bool ethereal : 1; // bit 25 |
| 191 | + bool merge : 1; // bit 26 |
| 192 | + bool word_break : 1; // bit 27 |
| 193 | + bool word_end : 1; // bit 28 |
| 194 | + bool line_break : 1; // bit 29 |
| 195 | + bool stop : 1; // bit 30 |
| 196 | + bool tab : 1; // bit 31 |
| 197 | + |
| 198 | + // Offset: 0x9 |
| 199 | + bool insert : 1; // bit 24 |
| 200 | + bool dynamic : 1; // bit 25 |
| 201 | + bool page_break : 1; // bit 26 |
| 202 | + bool stateful : 1; // bit 27 |
| 203 | + U16 dummy : 4; // bits 28-31 |
| 204 | + } flag; |
| 205 | + // Offset: 0xC |
| 206 | + U16 context_size; |
| 207 | + |
| 208 | + // Offset: 0x10 |
| 209 | + void* context; |
| 210 | + basic_rect<F32> bounds; |
| 211 | + basic_rect<F32> render_bounds; |
| 212 | + callback* cb; |
| 213 | + tag_type* tag; |
| 214 | + |
| 215 | + void intersect_flags(const jot& other); |
| 216 | + void reset_flags(); |
| 217 | + }; |
236 | 218 |
|
237 | | -struct wait_context |
238 | | -{ |
239 | | - struct |
| 219 | + struct jot_line |
240 | 220 | { |
241 | | - U8 time : 1; // offset 0x0, size 0x1 |
242 | | - U8 prompt : 1; // offset 0x0, size 0x1 |
243 | | - U8 sound : 1; // offset 0x0, size 0x1 |
244 | | - U8 event : 1; // offset 0x0, size 0x1 |
245 | | - U16 pad : 12; // offset 0x0, size 0x2 |
246 | | - } type; // offset 0x0, size 0x2 |
247 | | - U8 need; // offset 0x2, size 0x1 |
248 | | - F32 delay; // offset 0x4, size 0x4 |
249 | | - U32 event_mask; // offset 0x8, size 0x4 |
250 | | - query_enum query; // offset 0xC, size 0x4 |
251 | | -}; |
| 221 | + basic_rect<F32> bounds; |
| 222 | + F32 baseline; |
| 223 | + U32 first; |
| 224 | + U32 last; |
| 225 | + U8 page_break; |
| 226 | + }; |
252 | 227 |
|
253 | | -struct sound_queue |
254 | | -{ |
255 | | - U32 _playing[5]; |
256 | | - S32 head; |
257 | | - S32 tail; |
258 | | -}; |
| 228 | + struct layout |
| 229 | + { |
| 230 | + xtextbox tb; |
| 231 | + jot _jots[512]; // 0x68 |
| 232 | + U32 _jots_size; // 0x7068 |
| 233 | + jot_line _lines[128]; // 0x706C |
| 234 | + U32 _lines_size; // 0x806C |
| 235 | + U8 context_buffer[1024]; // 0x8070 |
| 236 | + U32 context_buffer_size; // 0x8470 |
| 237 | + U16 dynamics[64]; // 0x8474 |
| 238 | + U32 dynamics_size; // 0x84F4 |
| 239 | + }; |
259 | 240 |
|
260 | | -struct trigger_pair |
261 | | -{ |
262 | | - ztalkbox* origin; |
263 | | - U32 event; |
264 | | -}; |
| 241 | + struct wait_context |
| 242 | + { |
| 243 | + struct |
| 244 | + { |
| 245 | + U8 time : 1; |
| 246 | + U8 prompt : 1; |
| 247 | + U8 sound : 1; |
| 248 | + U8 event : 1; |
| 249 | + U16 pad : 12; |
| 250 | + } type; |
| 251 | + U8 need; |
| 252 | + F32 delay; |
| 253 | + U32 event_mask; |
| 254 | + query_enum query; |
| 255 | + }; |
265 | 256 |
|
266 | | -struct shared_type |
267 | | -{ |
268 | | - S32 flags; // offset 0x0, size 0x4 |
269 | | - U32 permit; // offset 0x4, size 0x4 |
270 | | - ztalkbox* active; // offset 0x8, size 0x4 |
271 | | - state_type* state; // offset 0xC, size 0x4 |
272 | | - state_type* states[5]; // offset 0x10, size 0x14 |
273 | | - layout lt; // offset 0x24, size 0x84F8 |
274 | | - S32 begin_jot; // offset 0x851C, size 0x4 |
275 | | - S32 end_jot; // offset 0x8520, size 0x4 |
276 | | - S32 page_end_jot; // offset 0x8524, size 0x4 |
277 | | - wait_context wait; // offset 0x8528, size 0x10 |
278 | | - wait_context auto_wait; // offset 0x8538, size 0x10 |
279 | | - U32 wait_event_mask; // offset 0x8548, size 0x4 |
280 | | - F32 prompt_delay; // offset 0x854C, size 0x4 |
281 | | - F32 quit_delay; // offset 0x8550, size 0x4 |
282 | | - U8 prompt_ready; // offset 0x8554, size 0x1 |
283 | | - U8 quit_ready; // offset 0x8555, size 0x1 |
284 | | - U8 stream_locked[2]; // offset 0x8556, size 0x2 |
285 | | - S32 next_stream; // offset 0x8558, size 0x4 |
286 | | - // The below builds perfectly fine, unsure if its 100% correct though |
287 | | - sound_queue<4> sounds; // offset 0x855C, size 0x1C |
288 | | - U8 allow_quit; // offset 0x8578, size 0x1 |
289 | | - U8 quitting; // offset 0x8579, size 0x1 |
290 | | - U8 delay_events; // offset 0x857A, size 0x1 |
291 | | - callback* cb; // offset 0x857C, size 0x4 |
292 | | - // The below builds perfectly fine, unsure if its 100% correct though |
293 | | - fixed_queue<trigger_pair, 32> triggered; // offset 0x8580, size 0x110 |
294 | | - F32 volume; // offset 0x8690, size 0x4 |
295 | | - zNPCCommon* speak_npc; // offset 0x8694, size 0x4 |
296 | | - U32 speak_player; // offset 0x8698, size 0x4 |
297 | | -}; |
| 257 | + struct trigger_pair |
| 258 | + { |
| 259 | + ztalkbox* origin; |
| 260 | + U32 event; |
| 261 | + }; |
| 262 | + |
| 263 | + struct shared_type |
| 264 | + { |
| 265 | + S32 flags; |
| 266 | + U32 permit; |
| 267 | + ztalkbox* active; // 0x8 |
| 268 | + state_type* state; // 0xC |
| 269 | + state_type* states[5]; // 0x10, size 0x14 |
| 270 | + layout lt; // 0x24 |
| 271 | + S32 begin_jot; // 0x851C |
| 272 | + S32 end_jot; // 0x8520 |
| 273 | + S32 page_end_jot; // 0x8524 |
| 274 | + wait_context wait; // 0x8528 |
| 275 | + wait_context auto_wait; // 0x8538 |
| 276 | + U32 wait_event_mask; // 0x8548 |
| 277 | + F32 prompt_delay; // 0x854C |
| 278 | + F32 quit_delay; |
| 279 | + U8 prompt_ready; // 0x8554, size 0x1 |
| 280 | + U8 quit_ready; |
| 281 | + U8 stream_locked[2]; // 0x8556 |
| 282 | + S32 next_stream; // 0x8558 |
| 283 | + sound_queue<4> sounds; // 0x855C |
| 284 | + U8 allow_quit; // 0x8578 |
| 285 | + U8 quitting; // 0x8579 |
| 286 | + U8 delay_events; // 0x857A |
| 287 | + callback* cb; // 0x857C |
| 288 | + fixed_queue<trigger_pair, 32> triggered; // 0x8580 |
| 289 | + F32 volume; // 0x8690 |
| 290 | + zNPCCommon* speak_npc; // 0x8694 |
| 291 | + U32 speak_player; // 0x8698 |
| 292 | + }; |
| 293 | +} |
298 | 294 |
|
299 | 295 | #endif |
0 commit comments