Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
msg_draw.c
Go to the documentation of this file.
1#include "common.h"
2#include "ld_addrs.h"
3#include "message_ids.h"
4#include "sprite.h"
5
6#include "charset/charset.h"
7#include "charset/postcard.png.h"
8#include "charset/letter_content_1.png.h"
9
10//TODO get a real ceil
12 return (s32)(f + 0.999f);
13}
14
19extern unsigned char ui_msg_palettes[16][32];
33
35
40extern u8* D_8015131C;
41extern Gfx* D_80151338;
42extern IMG_BIN D_80159B50[0x200];
43extern PAL_BIN D_8015C7E0[0x10];
44
45#if !VERSION_JP
47#endif
48
50extern PAL_BIN D_802F4560[80][8];
51extern s32 gMessageBoxFrameParts[2][16];
52
53#if VERSION_IQUE
54static IMG_BIN D_801544A0[120][128];
55#endif
56static MessageDrawState D_80155D20;
57static MessageDrawState* msg_drawState;
58
60 { .v = { .ob = {1, 0, 0}, .tc = {0, 0}, .cn = {255, 255, 248, 255} } },
61 { .v = { .ob = {0x20, 0, 0}, .tc = {0x400, 0}, .cn = {255, 255, 248, 255} } },
62 { .v = { .ob = {0x1, 0xFFC0, 0}, .tc = {0, 0x800}, .cn = {191, 184, 176, 255} } },
63 { .v = { .ob = {0x20, 0xFFC0, 0}, .tc = {0x400, 0x800}, .cn = {191, 184, 176, 255} } },
64};
65
67 { .v = { .ob = {0x20, 0, 0}, .tc = {0, 0}, .cn = {255, 255, 248, 255} } },
68 { .v = { .ob = {0xE1, 0, 0}, .tc = {0x100, 0}, .cn = {255, 255, 248, 255} } },
69 { .v = { .ob = {0x20, 0xFFC0, 0}, .tc = {0, 0x800}, .cn = {191, 184, 176, 255} } },
70 { .v = { .ob = {0xE1, 0xFFC0, 0}, .tc = {0x100, 0x800}, .cn = {191, 184, 176, 255} } },
71};
72
74 { .v = { .ob = {0xE1, 0, 0}, .tc = {0, 0}, .cn = {255, 255, 248, 255} } },
75 { .v = { .ob = {0x100, 0, 0}, .tc = {0x400, 0}, .cn = {255, 255, 248, 255} } },
76 { .v = { .ob = {0xE1, 0xFFC0, 0}, .tc = {0, 0x800}, .cn = {191, 184, 176, 255} } },
77 { .v = { .ob = {0x100, 0xFFC0, 0}, .tc = {0x400, 0x800}, .cn = {191, 184, 176, 255} } },
78};
79
81 { .v = { .ob = {0xFFF1, 0x001E, 0}, .tc = {0, 0}, .cn = {191, 184, 176, 255} } },
82 { .v = { .ob = {0xF, 0x001E, 0}, .tc = {0x1E0, 0}, .cn = {191, 184, 176, 255} } },
83 { .v = { .ob = {0xFFFF, 0, 0}, .tc = {0, 0x1E0}, .cn = {191, 184, 176, 255} } },
84 { .v = { .ob = {1, 0, 0}, .tc = {0x1E0, 0x1E0}, .cn = {191, 184, 176, 255} } },
85};
86
88 { .v = { .ob = {0xFFF1, 0x001E, 0}, .tc = {0, 0}, .cn = {191, 184, 176, 255} } },
89 { .v = { .ob = {0xF, 0x001E, 0}, .tc = {0x1E0, 0}, .cn = {191, 184, 176, 255} } },
90 { .v = { .ob = {0xFFFF, 0, 0}, .tc = {0, 0x1E0}, .cn = {191, 184, 176, 255} } },
91 { .v = { .ob = {1, 0, 0}, .tc = {0x1E0, 0x1E0}, .cn = {191, 184, 176, 255} } },
92};
93
112
113u8 D_8014C580[] = { 50, 80, 100, 105, 100, 0, 0, 0 };
114u8 D_8014C588[] = { 105, 100, 77, 57, 40, 27, 16, 8, 3, 0, 0, 0};
115#if VERSION_IQUE
116u32 D_8014AD24 = 2;
117#endif
118
120void appendGfx_msg_prim_rect(u8 r, u8 g, u8 b, u8 a, u16 ulX, u16 ulY, u16 lrX, u16 lrY);
121void msg_reset_gfx_state(void);
123 s32 posY);
124void msg_draw_prim_rect(u8 r, u8 g, u8 b, u8 a, u16 posX, u16 posY, u16 sizeX, u16 sizeY);
126void msg_draw_frame(s32 posX, s32 posY, s32 sizeX, s32 sizeY, s32 style, s32 palette, s32 fading, s32 bgAlpha, s32 frameAlpha);
128 s16 height, f32 scaleX, f32 scaleY, u8 opacity, s32 arg9);
130
131void drawbox_message_delegate(s32 data, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
133
134 appendGfx_message(printer, 0, 0, 0, 0, 4, 0);
135}
136
138 f32 scale = 1.0f;
139 s32 rotZ = 0;
140
141 switch (printer->windowState) {
143 scale = (f32)D_8014C580[printer->fadeInCounter] / 100.0;
144 rotZ = (4 - printer->fadeInCounter) * 3;
145 printer->fadeInCounter++;
146 if (D_8014C580[printer->fadeInCounter] == 0) {
147 printer->windowState = MSG_WINDOW_STATE_PRINTING;
148 }
149 break;
151 scale = (f32)D_8014C588[printer->fadeOutCounter] / 100.0;
152 rotZ = -printer->fadeOutCounter;
153 printer->fadeOutCounter++;
154 if (D_8014C588[printer->fadeOutCounter] == 0) {
155 printer->stateFlags |= MSG_STATE_FLAG_1;
156 }
157 break;
158 }
159
160 switch (printer->windowState) {
163 printer->windowBasePos.x = 160 - (printer->windowSize.x / 2);
164 printer->windowBasePos.y = 56;
165 draw_box(DRAW_FLAG_ROTSCALE, WINDOW_STYLE_0, printer->windowBasePos.x, 56, 0, printer->windowSize.x, printer->windowSize.y, 255, 0,
166 scale, scale, 0.0f, 0.0f, rotZ, drawbox_message_delegate, printer, nullptr, SCREEN_WIDTH,
167 SCREEN_HEIGHT, nullptr);
168 break;
169 default:
170 appendGfx_message(printer, printer->windowOffsetPos.x, printer->windowOffsetPos.y, printer->unk_46C,
171 printer->curLinePos, 4, 0);
172 break;
173 }
174}
175
176#if VERSION_JP
177#define MSG_NORMAL_WIDTH 192
178#define MSG_NORMAL_X 32
179#define MSG_NORMAL_WIN_WIDTH 256
180#define MSG_NORMAL_WIN_HEIGHT 64
181#define MSG_NORMAL_TEXT_Y 8
182#define MSG_NORMAL_ARROW_X 253
183#define MSG_NORMAL_ARROW_Y 56
184#define MSG_NORMAL_HEIGHT_CAP 64
185#define MSG_NORMAL_PAGE_HT 16
186#define MSG_INSPECT_TEXT_Y 5
187#define MSG_SIGN_TEXT_Y 13
188#define MSG_SIGN_WIDTH 240
189#define MSG_SIGN_OFFSET_X 20
190#define MSG_POPUP_TEXT_Y 8
191#define MSG_EPILOGUE_TEXT_Y 0
192#else
193#define MSG_NORMAL_WIDTH 218
194#define MSG_NORMAL_X 22
195#define MSG_NORMAL_WIN_WIDTH 296
196#define MSG_NORMAL_WIN_HEIGHT 68
197#define MSG_NORMAL_TEXT_Y 6
198#define MSG_NORMAL_ARROW_X 276
199#define MSG_NORMAL_ARROW_Y 57
200#define MSG_NORMAL_HEIGHT_CAP 68
201#define MSG_NORMAL_PAGE_HT 14
202#define MSG_INSPECT_TEXT_Y 3
203#define MSG_SIGN_TEXT_Y 11
204#define MSG_SIGN_WIDTH 280
205#define MSG_SIGN_OFFSET_X 0
206#define MSG_POPUP_TEXT_Y 4
207#define MSG_EPILOGUE_TEXT_Y -2
208#endif
209
210#if VERSION_PAL
211INCLUDE_ASM(s32, "msg_draw", appendGfx_message);
212#else
214 u16 flag, u8 alpha) {
217 s16 sp8E;
218 s16 sp96;
219 s16 sp9E;
220 s16 palette;
221 s16 spAE;
222 u16 spB6;
223 u8 spB8;
224#if VERSION_IQUE
225 u16 byte = 0;
226#endif
234 f32 bubbleX;
235 f32 bubbleY;
238 f32 temp_f8;
240 f64 temp_f0;
243 f32 temp_f2;
247 s32 temp_a2;
249 s32 i;
250 s16 temp_s3;
251 s16 temp_s4;
254 s16 temp_s5;
255 s16 temp_s6;
257 s32 animIdx;
262 s32 phi_a0;
265 s32 height;
266 s32 frameX;
267 s32 frameY;
272 u16 fading;
273 u8 phi_s0_5;
276 s8 phi_s2_4;
277 u8 phi_s3_2;
280 s16 phi_t5;
282 s16 phi_t3;
283 s32 dbPos;
289 s8 varImgHasBorder;
292 f32 z1;
293 f32 z2;
294 f32 temp1;
295 f32 temp2;
296#if VERSION_JP
298#else
300#endif
302
303 msg_drawState = &D_80155D20;
304 msg_drawState->printBuffer = printer->printBuffer;
305 msg_drawState->printModeFlags = 0;
306 if (gMainGfxPos != D_80151338) {
308 }
310 sp8E = 255;
311 if (flag & 1) {
312 sp8E = alpha;
313 }
314 msg_drawState->textStartPos[0] = 0;
315 msg_drawState->textStartPos[1] = 0;
316 msg_drawState->clipX[0] = 0;
317 msg_drawState->clipY[0] = 0;
318 msg_drawState->clipX[1] = SCREEN_WIDTH - 1;
319 msg_drawState->clipY[1] = SCREEN_HEIGHT - 1;
320 msg_drawState->msgScale.x = 1.0f;
321 msg_drawState->msgScale.y = 1.0f;
322 msg_drawState->unk_29 = 0;
323 msg_drawState->framePalette = 0;
324 msg_drawState->unk_2C = 0;
325 msg_drawState->visiblePrintedCount = 0;
326 msg_drawState->centerPos = 0;
327 msg_drawState->fontVariant = 0;
328 msg_drawState->curPosX = 0;
329 msg_drawState->nextPos[0] = 0;
330 msg_drawState->nextPos[1] = 0;
331 msg_drawState->font = 0;
332 msg_drawState->effectFlags = 0;
333 msg_drawState->nextCounter = 0;
334 msg_drawState->textColor = MSG_PAL_WHITE;
335 sp96 = 0xFF;
336 spAE = 0xFF;
337 spB6 = 0;
338 spB8 = 0;
339 sp9E = -1;
340
341 if (flag & 2) {
342 msg_drawState->font = 1;
343 }
344
345 if (flag & 4) {
347 }
348
349 sp80bool = false;
350 msg_drawState->drawBufferPos = 0;
351
352 while (!sp80bool) {
353#if VERSION_IQUE
355
356 lastbyte = byte;
357 byte = msg_drawState->printBuffer[msg_drawState->drawBufferPos];
358 byte2 = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
359
360 switch (byte)
361#else
362 switch (msg_drawState->printBuffer[msg_drawState->drawBufferPos])
363#endif
364 {
366 msg_drawState->nextPos[0] = 0;
367 msg_drawState->nextPos[1] += (s32)((msg_drawState->msgScale.y * MsgCharsets[msg_drawState->font]->newLineY)
368#if !VERSION_JP
370#endif
371 );
372 if (msg_drawState->printModeFlags & MSG_PRINT_FLAG_40) {
373 msg_drawState->printModeFlags |= MSG_PRINT_FLAG_80;
374 }
375 msg_drawState->drawBufferPos++;
376 break;
378 msg_drawState->drawBufferPos++;
379 break;
384 msg_drawState->fontVariant = msg_drawState->printBuffer[msg_drawState->drawBufferPos] - MSG_CHAR_PRINT_VARIANT0;
385 msg_drawState->drawBufferPos++;
386 break;
390 msg_drawState->nextPos[0] += msg_get_draw_char_width(msg_drawState->printBuffer[msg_drawState->drawBufferPos],
391 msg_drawState->font, msg_drawState->fontVariant, msg_drawState->msgScale.x, msg_drawState->curPosX,
392 msg_drawState->printModeFlags);
393 msg_drawState->drawBufferPos++;
394 break;
396 switch (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1]) {
397 case MSG_STYLE_RIGHT:
398#if VERSION_IQUE
399 msg_drawState->nextPos[1] += 5;
400#endif
401 case MSG_STYLE_LEFT:
402 case MSG_STYLE_CENTER:
403 case MSG_STYLE_TATTLE:
404 if (printer->windowState == MSG_WINDOW_STATE_OPENING && printer->fadeInCounter == 0) {
405 printer->openStartPos.x = printer->initOpenPos.x;
406 printer->openStartPos.y = printer->initOpenPos.y;
407 }
408 temp_s6 = printer->openStartPos.x;
409 temp_s5 = printer->openStartPos.y;
410 temp_s4 = printer->windowBasePos.x + (f32) printer->windowSize.x * 0.5;
411 temp_s3 = printer->windowBasePos.y + (f32) printer->windowSize.y * 0.5;
412 msg_drawState->textColor = MSG_PAL_STANDARD;
413 msg_drawState->printModeFlags |= MSG_PRINT_FLAG_10;
414
415 if (printer->style == MSG_STYLE_RIGHT || printer->style == MSG_STYLE_LEFT || printer->style == MSG_STYLE_CENTER) {
417 printer->windowBasePos.x = MSG_NORMAL_X;
418 printer->windowBasePos.y = 13;
419 printer->windowSize.x = MSG_NORMAL_WIN_WIDTH;
420 printer->windowSize.y = MSG_NORMAL_WIN_HEIGHT;
421 msg_drawState->textStartPos[0] = 26;
422 msg_drawState->textStartPos[1] = MSG_NORMAL_TEXT_Y;
423 printer->rewindArrowPos.x = MSG_NORMAL_ARROW_X;
424 printer->rewindArrowPos.y = MSG_NORMAL_ARROW_Y;
425 curveWidth = 32;
426 height = MSG_NORMAL_HEIGHT_CAP;
427 } else {
428 straightWidth = 218;
429
430#if VERSION_JP
431 if (printer->maxLinesPerPage == 1) {
432 msg_drawState->textStartPos[0] = 18;
433 msg_drawState->textStartPos[1] = 10;
434 curveWidth = 24;
435 } else if (printer->maxLinesPerPage == 2) {
436 msg_drawState->textStartPos[0] = 22;
437 msg_drawState->textStartPos[1] = 8;
438 curveWidth = 28;
439 } else {
440 msg_drawState->textStartPos[0] = 26;
441 msg_drawState->textStartPos[1] = 8;
442 curveWidth = 32;
443 }
444#else
445 switch (printer->maxLinesPerPage) {
446 case 1:
447 msg_drawState->textStartPos[0] = 18;
448 msg_drawState->textStartPos[1] = 10;
449 curveWidth = 24;
450 break;
451 case 2:
452 msg_drawState->textStartPos[0] = 22;
453 msg_drawState->textStartPos[1] = 6;
454 curveWidth = 28;
455 break;
456 case 3:
457 msg_drawState->textStartPos[0] = 26;
458 msg_drawState->textStartPos[1] = 8;
459 curveWidth = 32;
460 break;
461 default:
462 msg_drawState->textStartPos[0] = 26;
463 msg_drawState->textStartPos[1] = 6;
464 curveWidth = 32;
465 break;
466 }
467#endif
468
469 straightWidth = printer->msgWidth;
470 if (straightWidth > 256) {
471 straightWidth = 256;
472 }
473 if (straightWidth < 70) {
474 straightWidth = 70;
475 }
476 straightWidth -= 12;
477
478 printer->windowSize.x = straightWidth + (curveWidth * 2);
479
480 height = (printer->maxLinesPerPage * MSG_NORMAL_PAGE_HT) + 16;
481 if (height > MSG_NORMAL_HEIGHT_CAP) {
482 height = MSG_NORMAL_HEIGHT_CAP;
483 }
484 if (height < 36) {
485 height = 36;
486 }
487 printer->windowSize.y = height;
488
489 temp_a2 = printer->openStartPos.x - printer->windowSize.x / 2;
490 if (temp_a2 < 18) {
491 temp_a2 = 18;
492 }
493 if (temp_a2 + printer->windowSize.x > SCREEN_WIDTH - 18) {
494 temp_a2 = SCREEN_WIDTH - 18 - printer->windowSize.x;
495 }
496 phi_a0 = printer->openStartPos.y - 38 - printer->windowSize.y;
497 if (phi_a0 < 20) {
498 phi_a0 = 20;
499 }
500 if (phi_a0 + printer->windowSize.y > 170) {
501 phi_a0 = 170 - printer->windowSize.y;
502 }
503 printer->windowBasePos.x = temp_a2;
504 printer->windowBasePos.y = phi_a0;
505 printer->rewindArrowPos.x = (printer->windowSize.x + temp_a2) - 30;
506 printer->rewindArrowPos.y = (printer->windowSize.y + phi_a0) - 18;
507 }
508
509 if (printer->windowState == MSG_WINDOW_STATE_B || printer->windowState == MSG_WINDOW_STATE_C) {
510 msg_drawState->framePalette = 1;
511 }
512
513 if (printer->windowState == MSG_WINDOW_STATE_OPENING) {
514 windowScaleX = update_lerp(EASING_LINEAR, 0.07f, 1.0f, printer->fadeInCounter, 7);
515 windowScaleY = update_lerp(EASING_LINEAR, 0.3f, 1.0f, printer->fadeInCounter, 7);
516 temp_f28 = update_lerp(EASING_LINEAR, 96.0f, 200.0f, printer->fadeInCounter, 7);
519 temp_f2_2 = printer->windowSize.x * windowScaleX;
520 temp_f0_2 = printer->windowSize.y * windowScaleY;
521 bubbleX = (temp_f24 - temp_f2_2 * 0.5) + 0.5;
522 bubbleY = (temp_f20 - temp_f0_2 * 0.5) + 0.5;
524 printer->fadeInCounter++;
525 if (printer->fadeInCounter == 7) {
526 printer->windowState = MSG_WINDOW_STATE_PRINTING;
527 }
528 } else if (printer->windowState == MSG_WINDOW_STATE_CLOSING) {
529 printer->fadeOutCounter++;
530 windowScaleX = update_lerp(EASING_LINEAR, 1.0f, 0.6f, printer->fadeOutCounter, 5);
531 windowScaleY = update_lerp(EASING_LINEAR, 1.0f, 0.8f, printer->fadeOutCounter, 5);
532 temp_f2 = (printer->windowSize.x * windowScaleX);
533 temp_f0 = (printer->windowSize.y * windowScaleY);
536 bubbleX = (temp_f24 - temp_f2 * 0.5) + 0.5;
537 bubbleY = (temp_f20 - temp_f0 * 0.5) + 0.5;
538 temp_f22_2 = (temp_f24 + temp_f2 * 0.5) - 0.5;
539 temp_f20_3 = (temp_f20 + temp_f0 * 0.5) - 0.5;
540 temp_f28 = update_lerp(EASING_LINEAR, 255.0f, 64.0f, printer->fadeOutCounter, 5);
541 sp8E = temp_f28 * 0.35;
542 spAE = temp_f28;
543 msg_drawState->clipX[0] = bubbleX + msg_drawState->textStartPos[0];
544 msg_drawState->clipY[0] = bubbleY + msg_drawState->textStartPos[1];
545 msg_drawState->clipX[1] = temp_f22_2 - msg_drawState->textStartPos[0];
546 msg_drawState->clipY[1] = temp_f20_3 - msg_drawState->textStartPos[1];
548 if (printer->fadeOutCounter >= 5) {
549 printer->stateFlags |= MSG_STATE_FLAG_1;
550 }
551 } else {
552 bubbleX = posX + printer->windowBasePos.x;
553 bubbleY = posY + printer->windowBasePos.y;
554
555 msg_draw_speech_bubble(printer, bubbleX, bubbleY, straightWidth, curveWidth, height, 1.0f, 1.0f, 255, 1);
556 if (((u32)(printer->openStartPos.x - 20) <= 280) && (printer->openStartPos.y <= 220)) {
558 }
559 }
560
561 if (printer->windowState != MSG_WINDOW_STATE_CLOSING) {
562 msg_drawState->clipX[0] = 20;
563 msg_drawState->clipY[0] = printer->windowOffsetPos.y + printer->windowBasePos.y +
564 msg_drawState->textStartPos[1];
565 msg_drawState->clipX[1] = SCREEN_WIDTH - 20;
566 msg_drawState->clipY[1] = msg_drawState->clipY[0] + printer->windowSize.y - 16;
567 }
569 msg_drawState->drawBufferPos += 2;
570 break;
571 case MSG_STYLE_CHOICE:
572 frameFading = 0;
573 windowSizeX = printer->windowSize.x;
574 windowSizeY = printer->windowSize.y;
577 msg_drawState->framePalette = 0;
578 msg_drawState->textStartPos[0] = 12;
579 msg_drawState->textStartPos[1] = 6;
580 frameAlpha = 255;
581 if (printer->windowState == MSG_WINDOW_STATE_OPENING) {
582
583 printer->fadeInCounter++;
584 if (printer->fadeInCounter == 6) {
585 printer->windowState = MSG_WINDOW_STATE_PRINTING;
586 }
587
588 temp_f10 = ((f32) printer->fadeInCounter * (2.0 / 15.0)) + 0.2;
589
590 z1 = printer->windowBasePos.x + (windowSizeX / 2);
591 z2 = printer->windowBasePos.y + (windowSizeY / 2);
592 temp1 = z1 - (windowSizeX * temp_f10 * 0.5);
593 temp2 = z2 - (windowSizeY * temp_f10 * 0.5);
594 frameX = temp1 + 0.5;
595 frameY = temp2 + 0.5;
598
599 if (frameSizeX < 24) {
600 frameSizeX = 24;
601 }
602 if (frameSizeY < 24) {
603 frameSizeY = 24;
604 }
605
606 sp8E = (u8)(temp_f10 * 255.0) * 0.6;
607 } else if (printer->windowState == MSG_WINDOW_STATE_CLOSING) {
608 printer->fadeOutCounter++;
609 if (printer->fadeOutCounter >= 5) {
610 printer->stateFlags |= MSG_STATE_FLAG_1;
611 }
612 frameAlpha = -(printer->fadeOutCounter * 46) - 1;
613 sp8E = ((u8)frameAlpha) * 0.6;
614 frameFading = 1;
615 if (sp8E >= 32) {
616 sp8E -= 32;
617 }
618 frameX = printer->windowBasePos.x;
619 frameY = printer->windowBasePos.y;
620 } else {
621 frameX = printer->windowBasePos.x;
622 frameY = printer->windowBasePos.y;
623 msg_draw_prim_rect(255, 32, 32, 0, frameX - 1, frameY - 1, windowSizeX + 2, windowSizeY + 2);
624 }
625 msg_drawState->clipX[0] = frameX + 2;
626 msg_drawState->clipY[0] = frameY + 2;
627 msg_drawState->clipX[1] = frameX + frameSizeX - 2;
628 msg_drawState->clipY[1] = frameY + frameSizeY - 2;
630 frameAlpha);
632 spAE = frameAlpha & 0xFF;
633 msg_drawState->textColor = MSG_PAL_STANDARD;
634 msg_drawState->drawBufferPos += 2;
635 msg_drawState->printModeFlags |= MSG_PRINT_FLAG_10;
636 break;
640 case MSG_STYLE_F:
641 fading = 0;
642 msg_drawState->textStartPos[0] = 16;
643 msg_drawState->textStartPos[1] = MSG_INSPECT_TEXT_Y;
644 msg_drawState->clipX[0] = printer->windowBasePos.x + 5;
645 msg_drawState->clipY[0] = printer->windowBasePos.y + 4;
646 msg_drawState->clipX[1] = printer->windowBasePos.x + printer->windowSize.x - 8;
647 msg_drawState->clipY[1] = printer->windowBasePos.y + printer->windowSize.y - 5;
648 printer->rewindArrowPos.x = msg_drawState->clipX[1] - 17;
649 printer->rewindArrowPos.y = msg_drawState->clipY[1] - 17;
650 msg_drawState->textColor = MSG_PAL_WHITE;
651 phi_s0_5 = 0xFF;
652 msg_draw_prim_rect(255, 32, 32, 0, printer->windowBasePos.x + 3, printer->windowBasePos.y - 1,
653 printer->windowSize.x - 6, 1);
654 msg_draw_prim_rect(32, 255, 32, 0, printer->windowBasePos.x + 3,
655 printer->windowBasePos.y + printer->windowSize.y, printer->windowSize.x - 6,
656 1);
657
658 if (printer->windowState == MSG_WINDOW_STATE_OPENING) {
659 phi_s0_5 = (printer->fadeInCounter * 0x30) + 0x50;
660 sp8E = (phi_s0_5 & 0xFF) - 0x30;
661 printer->fadeInCounter++;
662 fading = 1;
663 if ((s16)printer->fadeInCounter == 4) { // TODO why is this cast needed
664 printer->windowState = MSG_WINDOW_STATE_PRINTING;
665 }
666 } else if (printer->windowState == MSG_WINDOW_STATE_CLOSING) {
667 phi_s0_5 = -0x30 - (printer->fadeOutCounter * 40);
668 sp8E = (phi_s0_5 & 0xFF) - 0x30;
669 printer->fadeOutCounter++;
670 fading = 1;
671 if (printer->fadeOutCounter == 4) {
672 printer->stateFlags |= MSG_STATE_FLAG_1;
673 }
674 }
675
676 msg_draw_frame(printer->windowBasePos.x, printer->windowBasePos.y, printer->windowSize.x, printer->windowSize.y, MSG_STYLE_INSPECT,
677 msg_drawState->framePalette, fading, phi_s0_5, phi_s0_5);
679 spAE = phi_s0_5 & 0xFF;
680 msg_drawState->drawBufferPos += 2;
681 break;
682 case MSG_STYLE_SIGN:
684 msg_drawState->textStartPos[0] = 18;
685 msg_drawState->textStartPos[1] = MSG_SIGN_TEXT_Y;
686 printer->windowBasePos.x = 20 + MSG_SIGN_OFFSET_X;
687 printer->windowBasePos.y = 28;
688 printer->windowSize.x = MSG_SIGN_WIDTH;
689 msg_drawState->framePalette = 15;
690#if VERSION_IQUE
691 msg_drawState->nextPos[1] -= 2;
692#endif
693 temp_s1_5 = 0xFF;
694 if (printer->style == MSG_STYLE_SIGN) {
696 printer->windowSize.y = 72;
697 msg_drawState->textColor = MSG_PAL_18;
699 } else {
702 msg_drawState->textColor = MSG_PAL_1C;
703 }
704 msg_drawState->clipX[0] = 20 + MSG_SIGN_OFFSET_X + 14;
705 msg_drawState->clipY[0] = 40;
706 msg_drawState->clipX[1] = 283 - MSG_SIGN_OFFSET_X;
707 msg_drawState->clipY[1] = printer->windowSize.y + 17;
708 printer->rewindArrowPos.x = msg_drawState->clipX[1] - 16;
709 printer->rewindArrowPos.y = msg_drawState->clipY[1] - 9;
710
711 if (printer->windowState == MSG_WINDOW_STATE_OPENING) {
712 temp_s1_5 = (printer->fadeInCounter << 6) + 0x50;
713 sp8E = (temp_s1_5 & 0xFF) - 0x30;
714 printer->fadeInCounter++;
715 if (printer->fadeInCounter == 3) {
716 printer->windowState = MSG_WINDOW_STATE_PRINTING;
717 }
718 } else {
719 if (printer->windowState == MSG_WINDOW_STATE_CLOSING) {
720 temp_s1_5 = -0x30 - (printer->fadeOutCounter * 0x30);
721 sp8E = (temp_s1_5 & 0xFF) - 0x30;
722 printer->fadeOutCounter++;
723 if (printer->fadeOutCounter == 3) {
724 printer->stateFlags |= MSG_STATE_FLAG_1;
725 }
726 }
727 }
728 spAE = (u8)temp_s1_5;
730 28, 10, 10, 310, 230, temp_s1_5);
732 28, 10, 10, 310, 230, temp_s1_5);
734 printer->windowSize.y + 12, 10, 10, 310, 230, temp_s1_5);
736 10, 10, 310, 230, temp_s1_5);
739 gSPTextureRectangle(gMainGfxPos++, (36 + MSG_SIGN_OFFSET_X) * 4, 28 * 4, (284 - MSG_SIGN_OFFSET_X) * 4, 44 * 4, G_TX_RENDERTILE, 0, 0,
740 0x0400, 0x0400);
743 gSPTextureRectangle(gMainGfxPos++, (20 + MSG_SIGN_OFFSET_X) * 4, 44 * 4, (36 + MSG_SIGN_OFFSET_X) * 4, (printer->windowSize.y + 12) * 4,
744 G_TX_RENDERTILE, 0, 0, 0x0400, 0x0400);
747 gSPTextureRectangle(gMainGfxPos++, (284 - MSG_SIGN_OFFSET_X) * 4, 44 * 4, (300 - MSG_SIGN_OFFSET_X) * 4, (printer->windowSize.y + 12) * 4,
748 G_TX_RENDERTILE, 0, 0, 0x0400, 0x0400);
751 gSPTextureRectangle(gMainGfxPos++, (36 + MSG_SIGN_OFFSET_X) * 4, (printer->windowSize.y + 12) * 4, (284 - MSG_SIGN_OFFSET_X) * 4,
752 (printer->windowSize.y + 28) * 4, G_TX_RENDERTILE, 0, 0, 0x0400, 0x0400);
755 gSPTextureRectangle(gMainGfxPos++, (36 + MSG_SIGN_OFFSET_X) * 4, 44 * 4, (283 - MSG_SIGN_OFFSET_X + 1) * 4, (printer->windowSize.y + 12) * 4,
756 G_TX_RENDERTILE, 0, 0, 0x0400, 0x0400);
758 msg_drawState->drawBufferPos += 2;
759 break;
761 phi_s2_4 = 0;
762 msg_drawState->textStartPos[0] = 12;
763 msg_drawState->textStartPos[1] = 5;
764 printer->windowBasePos.x = 40;
765 printer->windowBasePos.y = 28;
766 msg_drawState->clipX[0] = 45;
767 msg_drawState->clipY[0] = 32;
768 msg_drawState->clipX[1] = 272;
769 msg_drawState->clipY[1] = 81;
770 printer->rewindArrowPos.x = msg_drawState->clipX[1] - 21;
771 printer->rewindArrowPos.y = msg_drawState->clipY[1] - 20;
772 msg_drawState->framePalette = 0;
773 msg_drawState->textColor = MSG_PAL_WHITE;
774 msg_draw_prim_rect(255, 32, 32, 0, 43, 27, 234, 1);
775 msg_draw_prim_rect(32, 255, 32, 0, 43, 86, 234, 1);
776 phi_s3_2 = 0xFF;
777 if (printer->windowState == MSG_WINDOW_STATE_OPENING) {
778 phi_s3_2 = (printer->fadeInCounter * 64) + 80;
779 sp8E = (phi_s3_2 & 0xFF) - 0x30;
780 printer->fadeInCounter++;
781 if (printer->fadeInCounter == 3) {
782 printer->windowState = MSG_WINDOW_STATE_PRINTING;
783 }
784 phi_s2_4 = 1;
785 } else if (printer->windowState == MSG_WINDOW_STATE_CLOSING) {
786 phi_s3_2 = -0x30 - (printer->fadeOutCounter * 0x30);
787 sp8E = (phi_s3_2 & 0xFF) - 0x30;
788 printer->fadeOutCounter++;
789 if (printer->fadeOutCounter == 3) {
790 printer->stateFlags |= MSG_STATE_FLAG_1;
791 }
792 phi_s2_4 = 1;
793 }
794 msg_draw_frame(40, 28, 240, 58, MSG_STYLE_INSPECT, msg_drawState->framePalette, phi_s2_4, phi_s3_2, phi_s3_2);
795 draw_ci_image_with_clipping(printer->letterBackgroundImg, 150, 105, G_IM_FMT_CI, G_IM_SIZ_4b,
796 printer->letterBackgroundPal, 85, 97, 10, 10, 300, 220, phi_s3_2);
798 printer->letterContentPal, 160, 102, 10, 10, 300, 220, phi_s3_2);
800 spAE = phi_s3_2 & 0xFF;
801 msg_drawState->drawBufferPos += 2;
802 break;
803 case MSG_STYLE_POPUP:
804 case MSG_STYLE_B:
805 msg_drawState->textStartPos[0] = 16;
806 msg_drawState->textStartPos[1] = MSG_POPUP_TEXT_Y;
807 msg_drawState->clipX[0] = 0;
808 msg_drawState->clipX[1] = SCREEN_WIDTH - 1;
809 msg_drawState->clipY[0] = 0;
810 msg_drawState->clipY[1] = SCREEN_HEIGHT - 1;
811 msg_drawState->textColor = MSG_PAL_WHITE;
812 msg_drawState->printModeFlags |= MSG_PRINT_FLAG_10;
813 if (printer->windowState == MSG_WINDOW_STATE_D || printer->windowState == MSG_WINDOW_STATE_E) {
814 printer->windowBasePos.x = 0;
815 printer->windowBasePos.y = 0;
816 } else {
817 printer->windowBasePos.x = 160 - printer->windowSize.x / 2;
818 printer->windowBasePos.y = 56;
819 draw_box(0, WINDOW_STYLE_0, printer->windowBasePos.x, 56, 0, printer->windowSize.x,
820 printer->windowSize.y, 255, 0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, nullptr, 0, nullptr,
821 SCREEN_WIDTH, SCREEN_HEIGHT, nullptr);
822 }
824 msg_drawState->drawBufferPos += 2;
825 break;
827 printer->windowBasePos.x = 60;
828 printer->windowBasePos.y = 110;
829 printer->windowSize.x = 200;
830 printer->windowSize.y = 50;
831 msg_drawState->textStartPos[0] = 0;
832 msg_drawState->textStartPos[1] = MSG_EPILOGUE_TEXT_Y;
833 msg_drawState->clipX[0] = printer->windowBasePos.x;
834 msg_drawState->clipY[0] = printer->windowBasePos.y;
835 msg_drawState->clipX[1] = printer->windowBasePos.x + printer->windowSize.x;
836 msg_drawState->clipY[1] = printer->windowBasePos.y + printer->windowSize.y;
837 printer->rewindArrowPos.x = printer->windowBasePos.x + printer->windowSize.x - 10;
838 printer->rewindArrowPos.y = printer->windowBasePos.y + printer->windowSize.y - 10;
840 msg_drawState->drawBufferPos += 2;
841 break;
842 }
843 break;
845 if (printer->windowState == MSG_WINDOW_STATE_C) {
846 if (msg_drawState->nextCounter >= printer->unkArraySize) {
847 sp80bool = true;
848 }
849 } else if (printer->windowState == MSG_WINDOW_STATE_B) {
850 if (printer->curLinePos < printer->lineEndPos[printer->unkArraySize]) {
851 if (msg_drawState->nextCounter >= printer->unkArraySize) {
852 sp80bool = true;
853 }
854 } else {
855 if (printer->unkArraySize < msg_drawState->nextCounter) {
856 sp80bool = true;
857 } else if (msg_drawState->nextCounter >= printer->unkArraySize) {
858 phi_a0_4 = 36;
859 if (printer->maxLinesPerPage >= 2) {
860 phi_v0_3 = 48;
861 if (printer->maxLinesPerPage == 2) {
862 phi_v0_3 = 32;
863 }
864 if (printer->unk_4C8 < phi_v0_3) {
865 if (printer->unk_4C8 <= 0x10) {
866 phi_a0_4 = 56;
867 }
868 sp8E = 0xFF - (phi_a0_4 * printer->unk_4CC);
869 if (sp8E < 0) {
870 sp8E = 0;
871 }
872 }
873 }
874 }
875 }
876 }
877 msg_drawState->nextCounter++;
878 msg_drawState->drawBufferPos++;
879 break;
881 sp80bool = true;
882 break;
884 msg_drawState->drawBufferPos++;
885 switch (msg_drawState->printBuffer[msg_drawState->drawBufferPos]) {
887 msg_drawState->font = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
888 msg_drawState->drawBufferPos += 2;
889 msg_drawState->printModeFlags |= MSG_PRINT_FLAG_10;
890 break;
892 msg_drawState->fontVariant = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
893 msg_drawState->drawBufferPos += 2;
894 break;
896 msg_drawState->textColor = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
897 msg_drawState->printModeFlags |= MSG_PRINT_FLAG_10;
898 msg_drawState->drawBufferPos += 2;
899 break;
901 msg_drawState->curPosX = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
902 msg_drawState->drawBufferPos += 2;
903 break;
904#if !VERSION_IQUE
906 packedScaleX = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
907 msg_drawState->msgScale.x = (f32)(packedScaleX >> 4) + ((packedScaleX & 0xF) * 0.0625f);
908 packedScaleY = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 2];
909 msg_drawState->msgScale.y = (f32)(packedScaleY >> 4) + ((packedScaleY & 0xF) * 0.0625f);
910 msg_drawState->drawBufferPos += 3;
911 if (msg_drawState->msgScale.x > 1.0 || msg_drawState->msgScale.y > 1.0) {
913 } else if (msg_drawState->msgScale.x < 1.0 || msg_drawState->msgScale.y < 1.0) {
915 }
916 break;
918 msg_drawState->msgScale.x = 1.0f;
919 msg_drawState->msgScale.y = 1.0f;
920 msg_drawState->drawBufferPos++;
922 break;
923#endif
925 msg_drawState->nextPos[0] = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1] * 256 +
926 (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 2]);
927 msg_drawState->drawBufferPos += 3;
928 break;
930 msg_drawState->nextPos[1] = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
931 msg_drawState->drawBufferPos += 2;
932 break;
934 msg_drawState->nextPos[0] += msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
935 msg_drawState->drawBufferPos += 2;
936 break;
938 msg_drawState->nextPos[1] += msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
939 msg_drawState->drawBufferPos += 2;
940 break;
942 msg_drawState->nextPos[1] -= msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
943 msg_drawState->drawBufferPos += 2;
944 break;
946 msgImageData = &(*gMsgVarImages)[msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1]];
947 phi_t5 = sp8E;
948 if (sp8E < 0xFF) {
949 phi_t5 = (s32)(sp8E * 0.7);
950 }
951 imgDrawPosX = (s16)((msg_drawState->nextPos[0] + (msg_drawState->textStartPos[0] + (printer->windowBasePos.x + posX))) -
953 imgDrawPosY = (s16)((msg_drawState->nextPos[1] + (msg_drawState->textStartPos[1] + (printer->windowBasePos.y + posY))) -
955
957 msgImageData->palette, imgDrawPosX, imgDrawPosY, (s32) msg_drawState->clipX[0], (s32) msg_drawState->clipY[0],
958 msg_drawState->clipX[1] - msg_drawState->clipX[0], msg_drawState->clipY[1] - msg_drawState->clipY[0], phi_t5);
960 msg_drawState->drawBufferPos += 2;
961 break;
963 phi_s0_6 = sp8E;
964 if (sp8E < 0xFF) {
965 phi_s0_6 = (s32)(sp8E * 0.7);
966 }
967
968 if (spr_get_npc_raster_info(&sprRasterInfo, (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1] << 8) |
969 msg_drawState->printBuffer[msg_drawState->drawBufferPos + 2],
970 msg_drawState->printBuffer[msg_drawState->drawBufferPos + 3]) != 0) {
971 imgDrawPosX = (s16)((msg_drawState->nextPos[0] + (msg_drawState->textStartPos[0] + (printer->windowBasePos.x + posX))) -
973 imgDrawPosY = (s16)((msg_drawState->nextPos[1] + (msg_drawState->textStartPos[1] + (printer->windowBasePos.y + posY))) -
975
977 msg_drawState->clipX[0], msg_drawState->clipY[0], msg_drawState->clipX[1] - msg_drawState->clipX[0],
978 msg_drawState->clipY[1] - msg_drawState->clipY[0], phi_s0_6);
979 msg_drawState->printModeFlags |= MSG_PRINT_FLAG_10;
980 }
981 msg_drawState->drawBufferPos += 4;
982 break;
984 if (D_8015131C != 0) {
985 phi_t3 = sp8E;
986 if (sp8E < 0xFF) {
987 phi_t3 = (s32)(sp8E * 0.7);
988 }
989 imgDrawPosX = (s16)((msg_drawState->nextPos[0] + (msg_drawState->textStartPos[0] + (printer->windowBasePos.x + posX))) -
991 imgDrawPosY = (s16)((msg_drawState->nextPos[1] + (msg_drawState->textStartPos[1] + (printer->windowBasePos.y + posY))) -
993
995 msg_drawState->clipY[0], msg_drawState->clipX[1] - msg_drawState->clipX[0],
996 msg_drawState->clipY[1] - msg_drawState->clipY[0], phi_t3);
997 msg_drawState->printModeFlags |= MSG_PRINT_FLAG_10;
998 }
999 msg_drawState->drawBufferPos++;
1000 break;
1002 animIdx = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
1003 if (printer->animTimers[animIdx] == -1) {
1004 printer->animTimers[animIdx] = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 3];
1005 }
1006 if (printer->animTimers[animIdx] == 0) {
1007 printer->curAnimFrame[animIdx]++;
1008 }
1009
1010 dbPos = msg_drawState->drawBufferPos;
1011 while (true) {
1012 if ((msg_drawState->printBuffer[dbPos - 1] == MSG_CHAR_PRINT_FUNCTION) &&
1013 (msg_drawState->printBuffer[dbPos] == MSG_PRINT_FUNC_ANIM_DELAY) &&
1014 (msg_drawState->printBuffer[dbPos + 1] == animIdx)) {
1015 if (msg_drawState->printBuffer[dbPos + 2] != printer->curAnimFrame[animIdx]) {
1016 dbPos += 4;
1017 } else {
1018 break;
1019 }
1020 } else {
1021 if ((msg_drawState->printBuffer[dbPos] == MSG_CHAR_PRINT_FUNCTION) &&
1022 (msg_drawState->printBuffer[dbPos + 1] == MSG_PRINT_FUNC_ANIM_LOOP) &&
1023 (msg_drawState->printBuffer[dbPos + 2] == animIdx)) {
1024
1025 if (printer->animTimers[animIdx] == 0) {
1026 printer->curAnimFrame[animIdx] = msg_drawState->printBuffer[dbPos + 3];
1027 dbPos = msg_drawState->drawBufferPos;
1028 continue;
1029 } else {
1030 dbPos++;
1031 break;
1032 }
1033 } else {
1034 if (msg_drawState->printBuffer[dbPos] == MSG_CHAR_PRINT_FUNCTION &&
1035 msg_drawState->printBuffer[dbPos + 1] == MSG_PRINT_FUNC_ANIM_DONE) {
1036 if (msg_drawState->printBuffer[dbPos + 2] == animIdx) {
1037 dbPos++;
1038 break;
1039 }
1040 }
1041 }
1042 }
1043 dbPos++;
1044 }
1045 msg_drawState->drawBufferPos = dbPos;
1046
1047 switch (msg_drawState->printBuffer[msg_drawState->drawBufferPos]) {
1049 if (printer->animTimers[animIdx] == 0) {
1050 if (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 3] == 0) {
1051 printer->animTimers[animIdx] = -2;
1052 } else {
1053 printer->animTimers[animIdx] = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 3];
1054 }
1055 }
1056 msg_drawState->drawBufferPos += 4;
1057 break;
1059 msg_drawState->drawBufferPos += 3;
1060 break;
1062 msg_drawState->drawBufferPos += 2;
1063 break;
1064 }
1065 break;
1067 msg_drawState->drawBufferPos += 3;
1068 break;
1070 msg_drawState->drawBufferPos += 2;
1071 break;
1073 printer->cursorPosX[msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1]] = msg_drawState->textStartPos[0] +
1074 msg_drawState->nextPos[0] - additionalOffsetX - 6;
1075 printer->cursorPosY[msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1]] = msg_drawState->textStartPos[1] +
1076 msg_drawState->nextPos[1] - additionalOffsetY - 1;
1077 msg_drawState->drawBufferPos += 2;
1078 break;
1080 if (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1] == 0xFF) {
1081 msg_drawState->printModeFlags &= ~MSG_PRINT_FLAG_20;
1082 } else {
1083 msg_drawState->unk_2D = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
1084 msg_drawState->printModeFlags |= MSG_PRINT_FLAG_20;
1085 msg_drawState->nextPos[0] += 14;
1086 }
1087 msg_drawState->drawBufferPos += 2;
1088 break;
1090 msg_drawState->framePalette = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
1091 msg_drawState->drawBufferPos += 2;
1092 break;
1095 msg_drawState->drawBufferPos++;
1096 break;
1098 msg_drawState->savedPos[0] = msg_drawState->nextPos[0];
1099 msg_drawState->savedPos[1] = msg_drawState->nextPos[1];
1100 msg_drawState->drawBufferPos++;
1101 break;
1103 msg_drawState->nextPos[0] = msg_drawState->savedPos[0];
1104 msg_drawState->nextPos[1] = msg_drawState->savedPos[1];
1105 msg_drawState->drawBufferPos++;
1106 break;
1108 msg_drawState->savedColor = msg_drawState->textColor;
1109 msg_drawState->drawBufferPos++;
1110 break;
1112 msg_drawState->textColor = msg_drawState->savedColor;
1113 msg_drawState->drawBufferPos++;
1114 break;
1116 switch (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1]) {
1117 case MSG_FX_SHAKE:
1118 msg_drawState->effectFlags |= MSG_FX_FLAG_SHAKE;
1119 msg_drawState->drawBufferPos += 2;
1120 break;
1121 case MSG_FX_WAVE:
1122 msg_drawState->effectFlags |= MSG_FX_FLAG_WAVE;
1123 msg_drawState->drawBufferPos += 2;
1124 break;
1126 msg_drawState->effectFlags |= MSG_FX_FLAG_NOISE_OUTLINE;
1128 msg_drawState->drawBufferPos += 2;
1129 break;
1130 case MSG_FX_STATIC:
1131 msg_drawState->effectFlags |= MSG_FX_FLAG_STATIC;
1133 msg_drawState->printBuffer[msg_drawState->drawBufferPos + 2],
1134 msg_drawState->printBuffer[msg_drawState->drawBufferPos + 2],
1135 msg_drawState->printBuffer[msg_drawState->drawBufferPos + 2],
1136 0);
1138 msg_drawState->drawBufferPos += 3;
1139 break;
1140 case MSG_FX_BLUR:
1141 msg_drawState->effectFlags |= MSG_FX_FLAG_BLUR;
1142 spB8 = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 2];
1143 msg_drawState->drawBufferPos += 3;
1144 break;
1145 case MSG_FX_RAINBOW:
1146 msg_drawState->effectFlags |= MSG_FX_FLAG_RAINBOW;
1147 msg_drawState->drawBufferPos += 2;
1148 break;
1149 case MSG_FX_DITHER_FADE:
1150 msg_drawState->effectFlags |= MSG_FX_FLAG_DITHER_FADE;
1151 spB6 = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 2];
1152 msg_drawState->drawBufferPos += 3;
1153 break;
1154 case MSG_FX_GLOBAL_WAVE:
1155 msg_drawState->effectFlags |= MSG_FX_FLAG_GLOBAL_WAVE;
1156 msg_drawState->drawBufferPos += 2;
1157 break;
1159 msg_drawState->effectFlags |= MSG_FX_FLAG_GLOBAL_RAINBOW;
1160 msg_drawState->drawBufferPos += 2;
1161 break;
1162 case MSG_FX_RISE_PRINT:
1163 msg_drawState->effectFlags |= MSG_FX_FLAG_RISE_PRINT;
1164 msg_drawState->drawBufferPos += 2;
1165 break;
1166 case MSG_FX_GROW_PRINT:
1167 msg_drawState->effectFlags |= MSG_FX_FLAG_GROW_PRINT;
1168 msg_drawState->drawBufferPos += 2;
1169 break;
1170 case MSG_FX_SIZE_JITTER:
1171 msg_drawState->effectFlags |= MSG_FX_FLAG_SIZE_JITTER;
1172 msg_drawState->drawBufferPos += 2;
1173 break;
1174 case MSG_FX_SIZE_WAVE:
1175 msg_drawState->effectFlags |= MSG_FX_FLAG_SIZE_WAVE;
1176 msg_drawState->drawBufferPos += 2;
1177 break;
1178 case MSG_FX_DROP_SHADOW:
1179 msg_drawState->effectFlags |= MSG_FX_FLAG_DROP_SHADOW;
1180 msg_drawState->drawBufferPos += 2;
1181 break;
1182 }
1183 break;
1185 switch (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1]) {
1186 case MSG_FX_SHAKE:
1187 msg_drawState->effectFlags &= ~MSG_FX_FLAG_SHAKE;
1188 break;
1189 case MSG_FX_WAVE:
1190 msg_drawState->effectFlags &= ~MSG_FX_FLAG_WAVE;
1191 break;
1193 msg_drawState->effectFlags &= ~MSG_FX_FLAG_NOISE_OUTLINE;
1194 break;
1195 case MSG_FX_STATIC:
1196 msg_drawState->effectFlags &= ~MSG_FX_FLAG_STATIC;
1197 break;
1198 case MSG_FX_BLUR:
1199 msg_drawState->effectFlags &= ~MSG_FX_FLAG_BLUR;
1200 break;
1201 case MSG_FX_RAINBOW:
1202 msg_drawState->effectFlags &= ~MSG_FX_FLAG_RAINBOW;
1203 msg_drawState->printModeFlags |= MSG_PRINT_FLAG_10;
1204 break;
1205 case MSG_FX_DITHER_FADE:
1206 msg_drawState->effectFlags &= ~MSG_FX_FLAG_DITHER_FADE;
1207 break;
1208 case MSG_FX_GLOBAL_WAVE:
1209 msg_drawState->effectFlags &= ~MSG_FX_FLAG_GLOBAL_WAVE;
1210 break;
1212 msg_drawState->effectFlags &= ~MSG_FX_FLAG_GLOBAL_RAINBOW;
1213 msg_drawState->printModeFlags |= MSG_PRINT_FLAG_10;
1214 break;
1215 case MSG_FX_RISE_PRINT:
1216 msg_drawState->effectFlags &= ~MSG_FX_FLAG_RISE_PRINT;
1217 break;
1218 case MSG_FX_GROW_PRINT:
1219 msg_drawState->effectFlags &= ~MSG_FX_FLAG_GROW_PRINT;
1220 break;
1221 case MSG_FX_SIZE_JITTER:
1222 msg_drawState->effectFlags &= ~MSG_FX_FLAG_SIZE_JITTER;
1223 break;
1224 case MSG_FX_SIZE_WAVE:
1225 msg_drawState->effectFlags &= ~MSG_FX_FLAG_SIZE_WAVE;
1226 break;
1227 case MSG_FX_DROP_SHADOW:
1228 msg_drawState->effectFlags &= ~MSG_FX_FLAG_DROP_SHADOW;
1229 break;
1230 }
1231 msg_drawState->drawBufferPos += 2;
1232 break;
1234 if (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1] != 0) {
1235 msg_drawState->centerPos = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1];
1236 if (msg_drawState->centerPos == 0xFF) {
1237 msg_drawState->centerPos = printer->windowSize.x / 2;
1238 }
1240 } else {
1241 msg_drawState->nextPos[0] = 0;
1242 msg_drawState->printModeFlags &= ~(MSG_PRINT_FLAG_40 | MSG_PRINT_FLAG_80);
1243 }
1244 msg_drawState->drawBufferPos += 2;
1245 break;
1246 }
1247 break;
1248 default:
1249#if VERSION_IQUE
1250 if (lastbyte >= 0x5f && lastbyte <= 0x8f) {
1251 msg_drawState->drawBufferPos++;
1252 break;
1253 }
1254#endif
1255
1256 if (msg_drawState->printModeFlags & MSG_PRINT_FLAG_2) {
1257 sp96 = 0xFF;
1260 }
1261 msg_drawState->charScale.x = msg_drawState->msgScale.x;
1262 msg_drawState->charScale.y = msg_drawState->msgScale.y;
1263 if (msg_drawState->printModeFlags & MSG_PRINT_FLAG_80) {
1264 msg_drawState->nextPos[0] += msg_drawState->centerPos - printer->msgWidth / 2;
1265 msg_drawState->printModeFlags &= ~MSG_PRINT_FLAG_80;
1266 }
1267 if (msg_drawState->printModeFlags & MSG_PRINT_FLAG_40) {
1268 charPosX = msg_drawState->nextPos[0] + (printer->windowBasePos.x + posX);
1269 } else {
1270 charPosX = msg_drawState->nextPos[0] + (msg_drawState->textStartPos[0] + (printer->windowBasePos.x +
1271 posX));
1272 }
1273
1274 baseOffsetY = msg_drawState->nextPos[1] + (msg_drawState->textStartPos[1] + (printer->windowBasePos.y + posY));
1275 msgCharset = MsgCharsets[msg_drawState->font];
1278
1279 if ((sp8E != 0) &&
1280 (charPosX < msg_drawState->clipX[1]) &&
1281 (charPosY < msg_drawState->clipY[1]) &&
1282 (msg_drawState->clipX[0] < charPosX + (s32)(msg_drawState->msgScale.x *
1283 msgCharset->rasters[msg_drawState->fontVariant].monospaceWidth)) &&
1284 (msg_drawState->clipY[0] < charPosY + (s32)(msg_drawState->msgScale.y * msgCharset->newLineY
1285#if !VERSION_JP
1287#endif
1288 ))) {
1289 palette = msg_drawState->textColor;
1290 phi_s2_5 = sp8E;
1291 if (msg_drawState->effectFlags & MSG_FX_FLAG_BLUR) {
1292 phi_s2_5 = (f32) phi_s2_5 * 0.35;
1293 }
1294 if ((printer->windowState == MSG_WINDOW_STATE_WAITING_FOR_CHOICE) && (msg_drawState->printModeFlags & MSG_PRINT_FLAG_20)) {
1295 if (msg_drawState->unk_2D == printer->curOption) {
1297 } else {
1298 msg_drawState->effectFlags &= ~MSG_FX_FLAG_GLOBAL_RAINBOW;
1299 msg_drawState->effectFlags &= ~MSG_FX_FLAG_GLOBAL_WAVE;
1300 msg_drawState->effectFlags &= ~MSG_FX_FLAG_DROP_SHADOW;
1301 palette = msg_drawState->textColor;
1302 msg_drawState->printModeFlags |= MSG_PRINT_FLAG_10;
1303 }
1304 }
1305 if (msg_drawState->effectFlags & MSG_FX_FLAG_SHAKE) {
1306 charPosX += rand_int(10000) % 2;
1307 charPosY += rand_int(10000) % 2;
1308 }
1309 if (msg_drawState->effectFlags & MSG_FX_FLAG_WAVE) {
1310 temp_f2_3 = msg_drawState->msgScale.x - 1.0;
1311 temp_s0_7 = (printer->effectFrameCounter * (s32)(20.0 - (temp_f2_3 * 5.0))) - (msg_drawState->visiblePrintedCount *
1312 (s32)(45.0 - (temp_f2_3 * 15.0)));
1313 charPosX += cosine(temp_s0_7) * ((msg_drawState->msgScale.x - 1.0) + 1.6);
1314 charPosY += cosine((temp_s0_7 + 180.0 + 90.0)) * (msg_drawState->msgScale.y - 1.0 + 1.6);
1315 }
1316 if (msg_drawState->effectFlags & MSG_FX_FLAG_GLOBAL_WAVE) {
1317 temp_s0_8 = (gMsgGlobalWaveCounter * (s32)(20.0 - ((msg_drawState->msgScale.x - 1.0) * 5.0))) -
1318 (msg_drawState->visiblePrintedCount * 45);
1319 charPosX += cosine(temp_s0_8) * ((msg_drawState->msgScale.x - 1.0) + 1.6);
1320 charPosY += cosine((temp_s0_8 + 180.0 + 90.0)) * ((msg_drawState->msgScale.y - 1.0) + 1.6);
1321 }
1322 if (msg_drawState->effectFlags & MSG_FX_FLAG_RAINBOW) {
1323 palette = abs(msg_drawState->visiblePrintedCount - (u16)(printer->effectFrameCounter / 3)) % 10;
1324 }
1325 if (msg_drawState->effectFlags & MSG_FX_FLAG_GLOBAL_RAINBOW) {
1326 palette = abs(msg_drawState->visiblePrintedCount - (u16)(gGameStatusPtr->frameCounter / 3)) % 10;
1327 }
1328 if (msg_drawState->effectFlags & MSG_FX_FLAG_DITHER_FADE) {
1331 phi_s2_5 = spB6 * (phi_s2_5 / 255.0);
1332 }
1333 if ((msg_drawState->printModeFlags & MSG_PRINT_FLAG_2) || (phi_s2_5 != sp96)) {
1334 if ((sp96 < 0xFF) && (phi_s2_5 < 0xFF)) {
1335 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, phi_s2_5);
1336 } else if ((sp96 == 0xFF) && (phi_s2_5 < 0xFF)) {
1338 if (printer->stateFlags & MSG_STATE_FLAG_4000) {
1341 G_BL_1MA));
1342
1343 } else {
1346 G_BL_1MA));
1347
1348 }
1350 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, phi_s2_5);
1351 } else if ((sp96 < 0xFF) && (phi_s2_5 == 0xFF)) {
1355 }
1356 sp96 = phi_s2_5;
1357 }
1358 if (phi_s2_5 > 0) {
1359 if (msg_drawState->effectFlags & MSG_FX_FLAG_RISE_PRINT) {
1360 if ((msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1] != MSG_CHAR_PRINT_ENDL) &&
1361 (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 2] != MSG_CHAR_PRINT_ENDL) &&
1362 (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 3] != MSG_CHAR_PRINT_ENDL) &&
1363 (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 4] != MSG_CHAR_PRINT_ENDL)) {
1364 if ((msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1] == MSG_CHAR_PRINT_END) &&
1365 (printer->windowState == MSG_WINDOW_STATE_PRINTING)) {
1366 msg_drawState->charScale.x = msg_drawState->msgScale.x * 1.7;
1367 msg_drawState->charScale.y = msg_drawState->msgScale.y * 1.7;
1368 temp_f8 = (msg_drawState->charScale.y / 1.7) * 6.0;
1369 charPosX -= temp_f8;
1370 charPosY -= temp_f8;
1371 } else if ((msg_drawState->printBuffer[msg_drawState->drawBufferPos + 2] == MSG_CHAR_PRINT_END) &&
1372 (printer->windowState == MSG_WINDOW_STATE_PRINTING)) {
1373 msg_drawState->charScale.x = msg_drawState->msgScale.x * 1.4;
1374 msg_drawState->charScale.y = msg_drawState->msgScale.y * 1.4;
1375 temp_f8 = (msg_drawState->charScale.y / 1.4) * 3.0;
1376 charPosX -= temp_f8;
1377 charPosY -= temp_f8;
1378 } else if ((msg_drawState->printBuffer[msg_drawState->drawBufferPos + 3] == MSG_CHAR_PRINT_END) &&
1379 (printer->windowState == MSG_WINDOW_STATE_PRINTING)) {
1380 msg_drawState->charScale.x = msg_drawState->msgScale.x * 1.2;
1381 msg_drawState->charScale.y = msg_drawState->msgScale.y * 1.2;
1382 temp_f8 = (msg_drawState->charScale.y / 1.2) * 2.0;
1383 charPosX -= temp_f8;
1384 charPosY -= temp_f8;
1385 }
1386 }
1387 } else if (msg_drawState->effectFlags & MSG_FX_FLAG_GROW_PRINT) {
1388 if ((msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1] != MSG_CHAR_PRINT_ENDL) &&
1389 (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 2] != MSG_CHAR_PRINT_ENDL) &&
1390 (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 3] != MSG_CHAR_PRINT_ENDL) &&
1391 (msg_drawState->printBuffer[msg_drawState->drawBufferPos + 4] != MSG_CHAR_PRINT_ENDL)) {
1392 if ((msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1] == MSG_CHAR_PRINT_END) &&
1393 (printer->windowState == MSG_WINDOW_STATE_PRINTING)) {
1394 msg_drawState->charScale.x = msg_drawState->msgScale.x * 0.3;
1395 msg_drawState->charScale.y = msg_drawState->msgScale.y * 0.3;
1396 charPosX += 5;
1397 charPosY += 5;
1398 } else if ((msg_drawState->printBuffer[msg_drawState->drawBufferPos + 2] == MSG_CHAR_PRINT_END) &&
1399 (printer->windowState == MSG_WINDOW_STATE_PRINTING)) {
1400 msg_drawState->charScale.x = msg_drawState->msgScale.x * 0.5;
1401 msg_drawState->charScale.y = msg_drawState->msgScale.y * 0.5;
1402 charPosX += 3;
1403 charPosY += 3;
1404 } else if ((msg_drawState->printBuffer[msg_drawState->drawBufferPos + 3] == MSG_CHAR_PRINT_END) &&
1405 (printer->windowState == MSG_WINDOW_STATE_PRINTING)) {
1406 msg_drawState->charScale.x = msg_drawState->msgScale.x * 0.75;
1407 msg_drawState->charScale.y = msg_drawState->msgScale.y * 0.75;
1408 charPosX += 2;
1409 charPosY += 2;
1410 }
1411 }
1412 } else if (msg_drawState->effectFlags & MSG_FX_FLAG_SIZE_JITTER) {
1413 temp_f8_5 = rand_int(10000) % 101;
1414 temp_f8_5 /= 100.0;
1415 temp_f8_5 = ((temp_f8_5 * 0.5) + 1.0) - 0.25;
1416
1417 if (temp_f8_5 > 1.0) {
1418 msg_drawState->charScale.x = msg_drawState->msgScale.x * temp_f8_5;
1419 msg_drawState->charScale.y = msg_drawState->msgScale.y * temp_f8_5;
1420 charPosX -= (temp_f8_5 * 8.0) - 8.5;
1421 charPosY -= (temp_f8_5 * 8.0) - 8.5;
1422 } else if (temp_f8_5 < 1.0) {
1423 msg_drawState->charScale.x = msg_drawState->msgScale.x * temp_f8_5;
1424 msg_drawState->charScale.y = msg_drawState->msgScale.y * temp_f8_5;
1425 charPosX += 8.0 - (temp_f8_5 * 16.0) * 0.5;
1426 charPosY += 8.0 - (temp_f8_5 * 16.0) * 0.5;
1427 }
1428 } else if (msg_drawState->effectFlags & MSG_FX_FLAG_SIZE_WAVE) {
1429 s32 mod360;
1430
1431 temp_a0_49 = printer->effectFrameCounter * 15;
1432 temp_a0_49 -= msg_drawState->visiblePrintedCount * 15;
1433 mod360 = temp_a0_49 % 360;
1434 temp_f8_5 = (cosine(mod360) * 0.25) + 1.0;
1435
1436 if (temp_f8_5 > 1.0) {
1437 msg_drawState->charScale.x = msg_drawState->msgScale.x * temp_f8_5;
1438 msg_drawState->charScale.y = msg_drawState->msgScale.y * temp_f8_5;
1439 charPosX -= (temp_f8_5 * 8.0) - 8.5;
1440 charPosY -= (temp_f8_5 * 8.0) - 8.5;
1441 } else if (temp_f8_5 < 1.0) {
1442 msg_drawState->charScale.x = msg_drawState->msgScale.x * temp_f8_5;
1443 msg_drawState->charScale.y = msg_drawState->msgScale.y * temp_f8_5;
1444 charPosX += 8.0 - (temp_f8_5 * 16.0) * 0.5;
1445 charPosY += 8.0 - (temp_f8_5 * 16.0) * 0.5;
1446 }
1447 }
1448
1449 if ((printer->windowState == MSG_WINDOW_STATE_B || printer->windowState == MSG_WINDOW_STATE_C) &&
1450 (printer->style == MSG_STYLE_RIGHT ||
1451 printer->style == MSG_STYLE_LEFT ||
1452 printer->style == MSG_STYLE_CENTER ||
1453 printer->style == MSG_STYLE_TATTLE))
1454 {
1455 switch (palette) {
1456 case MSG_PAL_WHITE:
1457 case MSG_PAL_RED:
1458 case MSG_PAL_10:
1459 case MSG_PAL_11:
1460 case MSG_PAL_12:
1461 case MSG_PAL_13:
1462 case MSG_PAL_14:
1463 break;
1464#if !VERSION_IQUE
1465 case MSG_PAL_STANDARD:
1466 palette = MSG_PAL_40;
1467 break;
1468#endif
1469 case MSG_PAL_20:
1470 palette = MSG_PAL_41;
1471 break;
1472 case MSG_PAL_22:
1473 palette = MSG_PAL_42;
1474 break;
1475 case MSG_PAL_23:
1476 palette = MSG_PAL_43;
1477 break;
1478 case MSG_PAL_25:
1479 palette = MSG_PAL_44;
1480 break;
1481 default:
1482 palette = MSG_PAL_40;
1483 break;
1484 }
1485 }
1486 if (palette != sp9E) {
1487 sp9E = palette;
1488 msg_drawState->printModeFlags |= MSG_PRINT_FLAG_10;
1489 }
1490 if ((msg_drawState->effectFlags & MSG_FX_FLAG_DROP_SHADOW) && (phi_s2_5 == 0xFF)) {
1494 gDPSetPrimColor(gMainGfxPos++, 0, 0, 40, 40, 40, 72);
1495#if VERSION_IQUE
1496 if (byte >= MSG_CHAR_MULTIBYTE_FIRST && byte <= MSG_CHAR_MULTIBYTE_LAST) {
1499 msg_draw_char(printer, msg_drawState, glyph_index,
1500 palette, charPosX + 2, charPosY + 2);
1501 } else {
1502 msg_draw_char(printer, msg_drawState, byte,
1503 palette, charPosX + 2, charPosY + 2);
1504 }
1505#else
1506 msg_draw_char(printer, msg_drawState,
1507 msg_drawState->printBuffer[msg_drawState->drawBufferPos],
1508 palette, charPosX + 2, charPosY + 2);
1509#endif
1511 if (phi_s2_5 < 0xFF) {
1514 } else {
1517 }
1518 }
1519
1520 if (msg_drawState->effectFlags & MSG_FX_FLAG_BLUR) {
1521 for (i = 0; i < 5; i++) {
1524 if (spB8 != 2) {
1525 phi_s0_7 += (rand_int(10000) % 3) - 1;
1526 }
1527 if (spB8 != 1) {
1528 phi_s1_8 += (rand_int(10000) % 3) - 1;
1529 }
1530#if VERSION_IQUE
1531 if (byte >= MSG_CHAR_MULTIBYTE_FIRST && byte <= MSG_CHAR_MULTIBYTE_LAST) {
1534 msg_draw_char(printer, msg_drawState, glyph_index,
1535 palette, charPosX + 2, charPosY + 2);
1536 } else {
1537 msg_draw_char(printer, msg_drawState, byte,
1538 palette, charPosX + 2, charPosY + 2);
1539 }
1540#else
1541 msg_draw_char(printer, msg_drawState,
1542 msg_drawState->printBuffer[msg_drawState->drawBufferPos], palette,
1544#endif
1545 }
1546 } else {
1547#if VERSION_IQUE
1548 if (byte >= MSG_CHAR_MULTIBYTE_FIRST && byte <= MSG_CHAR_MULTIBYTE_LAST) {
1551 msg_draw_char(printer, msg_drawState, glyph_index,
1552 palette, charPosX + 2, charPosY + 2);
1553 } else {
1554 msg_draw_char(printer, msg_drawState, byte,
1555 palette, charPosX + 2, charPosY + 2);
1556 }
1557#else
1558 msg_draw_char(printer, msg_drawState,
1559 msg_drawState->printBuffer[msg_drawState->drawBufferPos], palette, charPosX,
1560 charPosY);
1561#endif
1562 }
1563 }
1564 }
1565 if (msg_drawState->printModeFlags & MSG_PRINT_FLAG_2) {
1566 msg_drawState->printModeFlags &= ~MSG_PRINT_FLAG_2;
1567 }
1568 msg_drawState->visiblePrintedCount++;
1569 msg_drawState->nextPos[0] +=
1570#if VERSION_IQUE
1571 msg_drawState->msgScale.x * 14.0f;
1572#else
1573 msg_get_draw_char_width(msg_drawState->printBuffer[msg_drawState->drawBufferPos],
1574 msg_drawState->font, msg_drawState->fontVariant, msg_drawState->msgScale.x,
1575 msg_drawState->curPosX, msg_drawState->printModeFlags);
1576#endif
1577 msg_drawState->drawBufferPos++;
1578 break;
1579 }
1580 }
1581
1582 varImgHasBorder = false;
1583 if (printer->varImageScreenPos.x != 0) {
1584 s16 varImgFinalAlpha;
1585
1586 varImgFinalAlpha = printer->varImgFinalAlpha;
1587 msgVarImage = &(*gMsgVarImages)[printer->curImageIndex];
1588
1589 switch (printer->varImgHasBorder) {
1590 case 0:
1591 case 1:
1592 if (printer->varImgHasBorder) {
1593 varImgHasBorder = true;
1594 }
1595 switch (printer->varImageDisplayState) {
1596 case 0:
1597 printer->varImageFadeTimer++;
1598 varImgFinalAlpha = printer->varImageFadeTimer * printer->varImgAlphaFadeStep;
1599 if (printer->varImgFinalAlpha <= varImgFinalAlpha) {
1600 varImgFinalAlpha = printer->varImgFinalAlpha;
1601 printer->varImageFadeTimer = 0;
1602 printer->varImageDisplayState = 1;
1603 }
1604 break;
1605 case 1:
1606 varImgFinalAlpha = (u8)(((f32) spAE / 255.0) * (f32) printer->varImgFinalAlpha);
1607 break;
1608 case 2:
1609 printer->varImageFadeTimer++;
1610 varImgFinalAlpha = printer->varImgFinalAlpha - printer->varImgAlphaFadeStep * printer->varImageFadeTimer;
1611 if (varImgFinalAlpha < 1) {
1612 printer->varImageScreenPos.x = 0;
1613 }
1614 break;
1615 }
1616 break;
1617 case 2:
1618 varImgFinalAlpha = (u8)(((f32) spAE / 255.0) * (f32) printer->varImgFinalAlpha);
1619 break;
1620 }
1621
1622 if (varImgFinalAlpha > 0) {
1623 if (varImgHasBorder) {
1624 draw_box(0, WINDOW_STYLE_15, printer->varImageScreenPos.x - 7, printer->varImageScreenPos.y - 7, 0,
1625 msgVarImage->width + 15, msgVarImage->height + 14, varImgFinalAlpha, 0, 0.0f, 0.0f, 0.0f, 0.0f,
1626 0.0f, nullptr, 0, nullptr, SCREEN_WIDTH, SCREEN_HEIGHT, nullptr);
1627 }
1629 msgVarImage->format, msgVarImage->bitDepth, msgVarImage->palette,
1630 printer->varImageScreenPos.x, printer->varImageScreenPos.y, 0, 0,
1631 SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, varImgFinalAlpha);
1632 }
1633
1634 }
1637}
1638#endif
1639
1644
1647 s32 fontVariant;
1648
1649 s32 clipUly;
1650 s32 clipLry;
1651 s32 clipUlx;
1652 s32 clipLrx;
1653
1654 s32 rightPosX;
1655 s32 rightPosY;
1656
1658 s32 ulx, texOffsetX;
1659 s32 uly, texOffsetY;
1660 s32 lrx, lry;
1661 s32 dsdx, dtdy;
1662 s32 posX2, posY2;
1663
1664#if VERSION_IQUE
1665 if (charIndex == MSG_CHAR_ZH_RANK) {
1666 load_font_data(((u8 (*)[128])charset_standard_OFFSET)[charIndex], sizeof(D_801544A0[0]), D_801544A0[0]);
1667 } else if (charIndex == MSG_CHAR_ZH_CHAPTER) {
1668 load_font_data(((u8 (*)[128])charset_standard_OFFSET)[charIndex], sizeof(D_801544A0[0]), D_801544A0[1]);
1669 } else if (charIndex >= MSG_CHAR_ZH_START) {
1670 load_font_data(((u8 (*)[128])charset_standard_OFFSET)[charIndex], sizeof(D_801544A0[0]), D_801544A0[D_8014AD24]);
1671 }
1672#endif
1673
1675 fontVariant = drawState->fontVariant;
1676
1677 clipUly = drawState->clipY[0];
1678 clipLry = drawState->clipY[1];
1679 clipUlx = drawState->clipX[0];
1680 clipLrx = drawState->clipX[1];
1681
1682 posX2 = posX;
1683 posY2 = posY;
1684
1685 rightPosX = posX2 + (s32)(drawState->charScale.x * messageCharset->texSize.x);
1686 rightPosY = posY2 + (s32)(drawState->charScale.y * messageCharset->texSize.y);
1687
1688 if (posX2 >= clipLrx || posY2 >= clipLry || rightPosX <= clipUlx || rightPosY <= clipUly) {
1689 return;
1690 }
1691
1692 if (posX2 < clipUlx) {
1693 clipOffset = abs(posX2 - clipUlx) / drawState->charScale.x;
1694 texOffsetX = (f32)((clipOffset + 0.5) * 32.0);
1695 ulx = clipUlx;
1696 } else {
1697 texOffsetX = 0;
1698 ulx = posX2;
1699 }
1700
1701 if (posY2 < clipUly) {
1702 if (!(printer->stateFlags & MSG_STATE_FLAG_400) || posY2 < 0) {
1703 clipOffset = abs(posY2 - clipUly) / drawState->charScale.y;
1704 texOffsetY = clipOffset * 32.0f;
1705 uly = clipUly;
1706 } else {
1707 texOffsetY = 0;
1708 uly = posY2;
1709 }
1710 } else {
1711 texOffsetY = 0;
1712 uly = posY2;
1713 }
1714
1715 lrx = rightPosX;
1716 if (lrx >= clipLrx) {
1717 lrx = clipLrx;
1718 }
1719
1720 lry = rightPosY;
1721 if (lry >= clipLry) {
1722 lry = clipLry;
1723 }
1724
1725 dsdx = 1.0f / drawState->charScale.x * 1024.0f;
1726 dtdy = 1.0f / drawState->charScale.y * 1024.0f;
1727
1728 if (drawState->printModeFlags & (MSG_PRINT_FLAG_10 | MSG_PRINT_FLAG_1)) {
1729 drawState->printModeFlags &= ~(MSG_PRINT_FLAG_10 | MSG_PRINT_FLAG_1);
1731 }
1732
1733 if (messageCharset->texSize.x >= 16 && messageCharset->texSize.x % 16 == 0) {
1734#if VERSION_IQUE
1735 if (charIndex == MSG_CHAR_ZH_RANK || charIndex == MSG_CHAR_ZH_CHAPTER) {
1737 messageCharset->texSize.x, messageCharset->texSize.y, 0,
1739 } else if (charIndex >= MSG_CHAR_ZH_START) {
1741 messageCharset->texSize.x, messageCharset->texSize.y, 0,
1743 } else {
1744#endif
1745 gDPLoadTextureBlock_4b(gMainGfxPos++, messageCharset->rasters[fontVariant].raster + messageCharset->charRasterSize * charIndex, G_IM_FMT_CI,
1746 messageCharset->texSize.x, messageCharset->texSize.y, 0,
1748#if VERSION_IQUE
1749 }
1750#endif
1751 } else {
1752#if VERSION_IQUE
1753 if (charIndex == MSG_CHAR_ZH_RANK || charIndex == MSG_CHAR_ZH_CHAPTER) {
1755 messageCharset->texSize.x, messageCharset->texSize.y,
1756 0, 0, messageCharset->texSize.x - 1, messageCharset->texSize.y - 1, 0,
1758 } else if (charIndex >= MSG_CHAR_ZH_START) {
1760 messageCharset->texSize.x, messageCharset->texSize.y,
1761 0, 0, messageCharset->texSize.x - 1, messageCharset->texSize.y - 1, 0,
1763 } else {
1764#endif
1765 gDPLoadTextureTile_4b(gMainGfxPos++, messageCharset->rasters[fontVariant].raster + messageCharset->charRasterSize * charIndex, G_IM_FMT_CI,
1766 messageCharset->texSize.x, messageCharset->texSize.y,
1767 0, 0, messageCharset->texSize.x - 1, messageCharset->texSize.y - 1, 0,
1769#if VERSION_IQUE
1770 }
1771#endif
1772 }
1773 gSPTextureRectangle(gMainGfxPos++, ulx * 4, uly * 4, lrx * 4, lry * 4, G_TX_RENDERTILE, texOffsetX, texOffsetY,
1774 dsdx, dtdy);
1775
1776#if VERSION_IQUE
1777 if (charIndex >= MSG_CHAR_ZH_START) {
1778 D_8014AD24 = (D_8014AD24 + 1) % 120;
1779 if (D_8014AD24 == 0) {
1780 D_8014AD24 = 2;
1781 }
1782 }
1783#endif
1784}
1785
1786void msg_draw_prim_rect(u8 r, u8 g, u8 b, u8 a, u16 posX, u16 posY, u16 sizeX, u16 sizeY) {
1787 u16 lrX = posX + sizeX;
1788 u16 lrY = posY + sizeY;
1789
1790 appendGfx_msg_prim_rect(r, g, b, a, posX, posY, lrX, lrY);
1791}
1792
1820
1823 s16 posX, s16 posY, s16 straightWidth, s16 curveWidth, s16 height, f32 scaleX, f32 scaleY, u8 opacity, s32 arg9)
1824{
1826 s16 temp_v0;
1827 s16 temp_v0_2;
1828 s32 negHeight;
1829
1830 if (opacity == 255 && scaleX == 1.0 && scaleY == 1.0) {
1831 msg_draw_prim_rect(32, 128, 240, 0, posX - 1, posY + 1, curveWidth + (straightWidth + curveWidth) + 2, height - 2);
1832 }
1833
1834 negHeight = -height;
1835
1836 gMsgSpeechBoxLQuad[0].v.ob[0] = 1;
1837 gMsgSpeechBoxLQuad[2].v.ob[0] = 1;
1838 gMsgSpeechBoxLQuad[1].v.ob[0] = curveWidth;
1839 gMsgSpeechBoxLQuad[3].v.ob[0] = curveWidth;
1840 gMsgSpeechBoxLQuad[2].v.ob[1] = negHeight;
1841 gMsgSpeechBoxLQuad[3].v.ob[1] = negHeight;
1842
1844
1845 gMsgSpeechBoxMQuad[0].v.ob[0] = curveWidth;
1846 gMsgSpeechBoxMQuad[2].v.ob[0] = curveWidth;
1847 gMsgSpeechBoxMQuad[1].v.ob[0] = temp_v0;
1848 gMsgSpeechBoxMQuad[3].v.ob[0] = temp_v0;
1849 gMsgSpeechBoxMQuad[2].v.ob[1] = negHeight;
1850 gMsgSpeechBoxMQuad[3].v.ob[1] = negHeight;
1851
1853
1854 gMsgSpeechBoxRQuad[0].v.ob[0] = temp_v0;
1855 gMsgSpeechBoxRQuad[2].v.ob[0] = temp_v0;
1856 gMsgSpeechBoxRQuad[1].v.ob[0] = temp_v0_2;
1857 gMsgSpeechBoxRQuad[3].v.ob[0] = temp_v0_2;
1858 gMsgSpeechBoxRQuad[2].v.ob[1] = negHeight;
1859 gMsgSpeechBoxRQuad[3].v.ob[1] = negHeight;
1860
1861 guTranslateF(sp20, posX, -posY, 0.0f);
1862
1863 if (scaleX != 1.0 || scaleY != 1.0) {
1864 guScaleF(sp60, scaleX, scaleY, 1.0f);
1866 }
1867
1869
1872
1880
1881 if (printer->maxLinesPerPage == 3) {
1883 } else {
1885 }
1886
1887 if (opacity >= 255) {
1893 } else {
1899 gDPSetPrimColor(gMainGfxPos++, 0, 0, 32, 32, 32, opacity);
1900 }
1901
1904 ui_msg_palettes[msg_drawState->framePalette]);
1914 gSP2Triangles(gMainGfxPos++, 0, 2, 1, 0, 1, 2, 3, 0);
1918 gSP2Triangles(gMainGfxPos++, 0, 2, 1, 0, 1, 2, 3, 0);
1922 gSP2Triangles(gMainGfxPos++, 0, 2, 1, 0, 1, 2, 3, 0);
1924}
1925
1927 s16 targetX, targetY;
1930 Vtx* quad;
1931 s32 angle;
1933 Matrix4f sp10;
1934 s16 x1, x2, x3, x4;
1935 s32 y1, y2;
1936 u8 pointRightSide = false;
1937 s16 windowX = printer->windowOffsetPos.x + printer->windowBasePos.x;
1938 s16 windowY = printer->windowOffsetPos.y + printer->windowBasePos.y;
1939
1940 if (printer->openStartPos.x == 0) {
1941 return;
1942 }
1943
1944 if (printer->style == MSG_STYLE_RIGHT ||
1945 printer->style == MSG_STYLE_LEFT ||
1946 printer->style == MSG_STYLE_CENTER ||
1947 printer->maxLinesPerPage == 3) {
1948 targetY = windowY + printer->windowSize.y - 4;
1949 } else {
1950 targetY = windowY + printer->windowSize.y - 3;
1951 }
1952
1953 if (printer->style == MSG_STYLE_LEFT) {
1954 pointRightSide = false;
1955 } else if (printer->style == MSG_STYLE_CENTER || printer->openStartPos.x >= 160) {
1956 pointRightSide = true;
1957 }
1958
1959 if (pointRightSide) {
1960 targetX = windowX + (f32)printer->windowSize.x * 0.7;
1961 if (printer->openStartPos.x < targetX) {
1962 for (windowXpart = 0.7f; windowXpart >= 0.67; windowXpart -= 0.005) {
1963 targetX = windowX + printer->windowSize.x * windowXpart;
1964 angle = atan2(printer->openStartPos.x, printer->openStartPos.y, targetX, targetY);
1965 if (abs(angle) < 45) {
1966 break;
1967 }
1968 }
1969 }
1970 } else {
1971 targetX = windowX + (f32)printer->windowSize.x * 0.3;
1972 if (printer->openStartPos.x > targetX) {
1973 for (windowXpart = 0.3f; windowXpart <= 0.38; windowXpart += 0.005) {
1974 targetX = windowX + printer->windowSize.x * windowXpart;
1975 angle = atan2(printer->openStartPos.x, printer->openStartPos.y, targetX, targetY);
1976 if (abs(angle) < 45) {
1977 break;
1978 }
1979 }
1980 }
1981 }
1982
1983 x1 = targetX - 9;
1984 x2 = targetX + 9;
1985 x3 = targetX;
1986
1987 arrowLength = dist2D(printer->initOpenPos.x, printer->initOpenPos.y, targetX, targetY);
1988 if (arrowLength < 10) {
1989 return;
1990 }
1991
1992 if (arrowLength > 25) {
1993 arrowLength = 25;
1994 }
1995
1996 // alternate quads between frames
1997 if (gCurrentDisplayContextIndex != 0) {
1999 } else {
2001 }
2002
2003 angle = atan2(targetX, targetY, printer->initOpenPos.x, printer->initOpenPos.y);
2004 angle -= 180;
2005 if (abs(angle) >= 75) {
2006 return;
2007 }
2008
2009 cosAngle = cosine(angle);
2010 sinAngle = cosine(angle + 90);
2011
2012 x3 = x3 - arrowLength * cosAngle;
2013 x4 = x3 + 1;
2014
2015 y1 = -targetY;
2016 y2 = -(s16)(targetY + arrowLength * sinAngle);
2017
2018 quad[0].v.ob[0] = x1;
2019 quad[0].v.ob[1] = y1;
2020 quad[1].v.ob[0] = x2;
2021 quad[1].v.ob[1] = y1;
2022
2023 quad[2].v.ob[0] = x3;
2024 quad[2].v.ob[1] = y2;
2025 quad[3].v.ob[0] = x4;
2026 quad[3].v.ob[1] = y2;
2027
2032 gDPSetPrimColor(gMainGfxPos++, 0, 0, 32, 32, 32, 255);
2034 guTranslateF(sp10, 0.0f, 0.0f, 0.0f);
2037 gSPVertex(gMainGfxPos++, quad, 4, 0);
2038 gSP2Triangles(gMainGfxPos++, 0, 2, 1, 0, 1, 2, 3, 0);
2039}
2040
2041void msg_draw_frame(s32 posX, s32 posY, s32 sizeX, s32 sizeY, s32 style, s32 palette, s32 fading, s32 bgAlpha, s32 frameAlpha) {
2042 s32 i;
2043 s32 frameType;
2044 s32 textures[16];
2045 u8 r, g, b;
2046 Rect quads[16];
2047
2048 if (sizeX < 16 || sizeY < 16) {
2049 return;
2050 }
2051
2052 if (fading != 0 && bgAlpha == 0 && frameAlpha == 0) {
2053 return;
2054 }
2055
2064
2065 if (fading == 0 || bgAlpha != 0) {
2066 switch (style) {
2067 case MSG_STYLE_CHOICE:
2068 r = UNPACK_PAL_R(((u16*)ui_msg_palettes)[4]);
2069 g = UNPACK_PAL_G(((u16*)ui_msg_palettes)[4]);
2070 b = UNPACK_PAL_B(((u16*)ui_msg_palettes)[4]);
2071 // BUGFIX: properly remap colors to full range [0, 255]
2072 r = my_ceil(255 * r / 31.0);
2073 g = my_ceil(255 * g / 31.0);
2074 b = my_ceil(255 * b / 31.0);
2075
2077 if (fading != 0 && bgAlpha < 255) {
2079 } else {
2081 }
2083 gDPSetPrimColor(gMainGfxPos++, 0, 0, r, g, b, bgAlpha);
2084 if (posX + sizeX - 8 > 0) {
2085 gDPScisFillRectangle(gMainGfxPos++, posX + 8, posY + 8, posX + sizeX - 8, posY + sizeY - 8);
2086 }
2087 break;
2088 case MSG_STYLE_INSPECT:
2093 if (fading == 0 || bgAlpha == 255) {
2094 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, 216);
2095 } else {
2096 if (bgAlpha > 216) {
2097 bgAlpha = 216;
2098 }
2099 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, bgAlpha);
2100 }
2101
2103 if (style == MSG_STYLE_INSPECT) {
2104 gSPScisTextureRectangle(gMainGfxPos++, (posX + 3) * 4, (posY + 3) * 4, (posX + sizeX - 3) * 4, (posY + sizeY - 3) * 4,
2106 } else {
2107 gSPScisTextureRectangle(gMainGfxPos++, (posX + 5) * 4, (posY + 5) * 4, (posX + sizeX - 5) * 4, (posY + sizeY - 5) * 4,
2109 }
2110 break;
2111 }
2112 }
2113
2114 if (sizeX >= 32) {
2115 quads[2].ulx = (posX + 16) * 4;
2116 quads[2].uly = posY * 4;
2117 quads[2].lrx = (posX + sizeX - 16) * 4;
2118 quads[2].lry = (posY + 8) * 4;
2119
2120 quads[13].ulx = (posX + 16) * 4;
2121 quads[13].uly = (posY + sizeY - 8) * 4;
2122 quads[13].lrx = (posX + sizeX - 16) * 4;
2123 quads[13].lry = (posY + sizeY) * 4;
2124 } else if (sizeX > 16 && sizeX < 24) {
2125 quads[2].ulx = (posX + 8) * 4;
2126 quads[2].uly = posY * 4;
2127 quads[2].lrx = (posX + sizeX - 8) * 4;
2128 quads[2].lry = (posY + 8) * 4;
2129
2130 quads[13].ulx = (posX + 8) * 4;
2131 quads[13].uly = (posY + sizeY - 8) * 4;
2132 quads[13].lrx = (posX + sizeX - 8) * 4;
2133 quads[13].lry = (posY + sizeY) * 4;
2134 } else {
2135 quads[2].ulx = 10000;
2136 quads[13].ulx = 10000;
2137 }
2138
2139 if (sizeY >= 32) {
2140 quads[7].ulx = posX * 4;
2141 quads[7].uly = (posY + 16) * 4;
2142 quads[7].lrx = (posX + 8) * 4;
2143 quads[7].lry = (posY + sizeY - 16) * 4;
2144
2145 quads[8].ulx = (posX + sizeX - 8) * 4;
2146 quads[8].uly = (posY + 16) * 4;
2147 quads[8].lrx = (posX + sizeX) * 4;
2148 quads[8].lry = (posY + sizeY - 16) * 4;
2149 } else if (sizeY > 16 && sizeY < 24) {
2150 quads[7].ulx = posX * 4;
2151 quads[7].uly = (posY + 8) * 4;
2152 quads[7].lrx = (posX + 8) * 4;
2153 quads[7].lry = (posY + sizeY - 8) * 4;
2154
2155 quads[8].ulx = (posX + sizeX - 8) * 4;
2156 quads[8].uly = (posY + 8) * 4;
2157 quads[8].lrx = (posX + sizeX) * 4;
2158 quads[8].lry = (posY + sizeY - 8) * 4;
2159 } else {
2160 quads[7].ulx = 10000;
2161 quads[8].ulx = 10000;
2162 }
2163
2164 if (sizeX >= 24) {
2165 quads[1].ulx = (posX + 8) * 4;
2166 quads[1].uly = posY * 4;
2167 quads[1].lrx = (posX + 16) * 4;
2168 quads[1].lry = (posY + 8) * 4;
2169
2170 quads[3].ulx = (posX + sizeX - 16) * 4;
2171 quads[3].uly = posY * 4;
2172 quads[3].lrx = (posX + sizeX - 8) * 4;
2173 quads[3].lry = (posY + 8) * 4;
2174
2175 quads[12].ulx = (posX + 8) * 4;
2176 quads[12].uly = (posY + sizeY - 8) * 4;
2177 quads[12].lrx = (posX + 16) * 4;
2178 quads[12].lry = (posY + sizeY) * 4;
2179
2180 quads[14].ulx = (posX + sizeX - 16) * 4;
2181 quads[14].uly = (posY + sizeY - 8) * 4;
2182 quads[14].lrx = (posX + sizeX - 8) * 4;
2183 quads[14].lry = (posY + sizeY) * 4;
2184 } else {
2185 quads[1].ulx = 10000;
2186 quads[3].ulx = 10000;
2187 quads[12].ulx = 10000;
2188 quads[14].ulx = 10000;
2189 }
2190
2191 if (sizeY >= 24) {
2192 quads[5].ulx = posX * 4;
2193 quads[5].uly = (posY + 8) * 4;
2194 quads[5].lrx = (posX + 8) * 4;
2195 quads[5].lry = (posY + 16) * 4;
2196
2197 quads[6].ulx = (posX + sizeX - 8) * 4;
2198 quads[6].uly = (posY + 8) * 4;
2199 quads[6].lrx = (posX + sizeX) * 4;
2200 quads[6].lry = (posY + 16) * 4;
2201
2202 quads[9].ulx = posX * 4;
2203 quads[9].uly = (posY + sizeY - 16) * 4;
2204 quads[9].lrx = (posX + 8) * 4;
2205 quads[9].lry = (posY + sizeY - 8) * 4;
2206
2207 quads[10].ulx = (posX + sizeX - 8) * 4;
2208 quads[10].uly = (posY + sizeY - 16) * 4;
2209 quads[10].lrx = (posX + sizeX) * 4;
2210 quads[10].lry = (posY + sizeY - 8) * 4;
2211 } else {
2212 quads[5].ulx = 10000;
2213 quads[6].ulx = 10000;
2214 quads[9].ulx = 10000;
2215 quads[10].ulx = 10000;
2216 }
2217
2218 quads[0].ulx = posX * 4;
2219 quads[0].uly = posY * 4;
2220 quads[0].lrx = (posX + 8) * 4;
2221 quads[0].lry = (posY + 8) * 4;
2222
2223 quads[4].ulx = (posX + sizeX - 8) * 4;
2224 quads[4].uly = posY * 4;
2225 quads[4].lrx = (posX + sizeX) * 4;
2226 quads[4].lry = (posY + 8) * 4;
2227
2228 quads[11].ulx = posX * 4;
2229 quads[11].uly = (posY + sizeY - 8) * 4;
2230 quads[11].lrx = (posX + 8) * 4;
2231 quads[11].lry = (posY + sizeY) * 4;
2232
2233 quads[15].ulx = (posX + sizeX - 8) * 4;
2234 quads[15].uly = (posY + sizeY - 8) * 4;
2235 quads[15].lrx = (posX + sizeX) * 4;
2236 quads[15].lry = (posY + sizeY) * 4;
2237
2238 switch (style) {
2239 case MSG_STYLE_CHOICE:
2240 frameType = 0;
2241 break;
2242 case MSG_STYLE_INSPECT:
2243 frameType = 1;
2244 break;
2245 default:
2246 frameType = 0;
2247 break;
2248 }
2249
2250 for (i = 0; i < ARRAY_COUNT(textures); i++) {
2252 }
2253
2254 if (fading == 0) {
2255 frameAlpha = 255;
2256 }
2257
2261 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, frameAlpha);
2264
2265 for (i = 0; i < ARRAY_COUNT(textures); i++) {
2266 if (textures[i] != nullptr && quads[i].ulx < 10000) {
2268 gSPScisTextureRectangle(gMainGfxPos++, quads[i].ulx, quads[i].uly, quads[i].lrx, quads[i].lry,
2269 G_TX_RENDERTILE, 0, 0, 0x400, 0x400);
2270 }
2271 }
2272
2275}
2276
2277void msg_get_glyph(s32 font, s32 variation, s32 charIndex, s32 palette, MesasgeFontGlyphData* out) {
2278 out->raster = &MsgCharsets[font]->rasters[variation].raster[(u16)MsgCharsets[font]->charRasterSize * charIndex];
2279 out->palette = D_802F4560[palette];
2280 out->texSize.x = MsgCharsets[font]->texSize.x;
2281 out->texSize.y = MsgCharsets[font]->texSize.y;
2282 out->charWidth = msg_get_draw_char_width(charIndex, font, variation, 1.0f, 0, 0);
2283 out->charHeight = out->texSize.y;
2284}
BSS s32 PopupMenu_SelectedIndex
unsigned char charset_standard_OFFSET[]
MessageCharData * rasters
#define IMG_BIN
Mtx matrixStack[0x200]
#define PAL_PTR
#define IMG_PTR
f32 Matrix4f[4][4]
#define PAL_BIN
s8 flags
Definition demo_api.c:15
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define rand_int
#define atan2
#define draw_box
#define guScaleF
@ WINDOW_STYLE_0
Definition enums.h:5955
@ WINDOW_STYLE_15
Definition enums.h:5970
@ MSG_FX_FLAG_RISE_PRINT
Definition enums.h:5772
@ MSG_FX_FLAG_DROP_SHADOW
Definition enums.h:5776
@ MSG_FX_FLAG_BLUR
Definition enums.h:5767
@ MSG_FX_FLAG_GLOBAL_WAVE
Definition enums.h:5770
@ MSG_FX_FLAG_WAVE
Definition enums.h:5765
@ MSG_FX_FLAG_GROW_PRINT
Definition enums.h:5773
@ MSG_FX_FLAG_GLOBAL_RAINBOW
Definition enums.h:5771
@ MSG_FX_FLAG_SHAKE
Definition enums.h:5764
@ MSG_FX_FLAG_SIZE_WAVE
Definition enums.h:5775
@ MSG_FX_FLAG_NOISE_OUTLINE
Definition enums.h:5766
@ MSG_FX_FLAG_STATIC
Definition enums.h:5777
@ MSG_FX_FLAG_RAINBOW
Definition enums.h:5768
@ MSG_FX_FLAG_SIZE_JITTER
Definition enums.h:5774
@ MSG_FX_FLAG_DITHER_FADE
Definition enums.h:5769
@ MSG_STATE_FLAG_1
Definition enums.h:5824
@ MSG_STATE_FLAG_400
Definition enums.h:5832
@ MSG_STATE_FLAG_4000
Definition enums.h:5835
@ MSG_PRINT_FUNC_RIGHT
Definition enums.h:5726
@ MSG_PRINT_FUNC_UP
Definition enums.h:5728
@ MSG_PRINT_FUNC_COLOR
Definition enums.h:5719
@ MSG_PRINT_FUNC_OPTION
Definition enums.h:5736
@ MSG_PRINT_FUNC_FONT
Definition enums.h:5715
@ MSG_PRINT_FUNC_ITEM_ICON
Definition enums.h:5731
@ MSG_PRINT_FUNC_SPACING
Definition enums.h:5720
@ MSG_PRINT_FUNC_ANIM_DELAY
Definition enums.h:5732
@ MSG_PRINT_FUNC_SET_Y
Definition enums.h:5725
@ MSG_PRINT_FUNC_ANIM_LOOP
Definition enums.h:5733
@ MSG_PRINT_FUNC_ANIM_SPRITE
Definition enums.h:5730
@ MSG_PRINT_FUNC_INLINE_IMAGE
Definition enums.h:5729
@ MSG_PRINT_FUNC_SET_X
Definition enums.h:5724
@ MSG_PRINT_FUNC_SIZE_RESET
Definition enums.h:5723
@ MSG_PRINT_FUNC_DOWN
Definition enums.h:5727
@ MSG_PRINT_FUNC_SAVE_COLOR
Definition enums.h:5739
@ MSG_PRINT_FUNC_VARIANT
Definition enums.h:5716
@ MSG_PRINT_FUNC_RESTORE_COLOR
Definition enums.h:5740
@ MSG_PRINT_FUNC_SET_FRAME_PALETTE
Definition enums.h:5717
@ MSG_PRINT_FUNC_END_FX
Definition enums.h:5742
@ MSG_PRINT_FUNC_START_FX
Definition enums.h:5741
@ MSG_PRINT_FUNC_RESTORE_POS
Definition enums.h:5738
@ MSG_PRINT_FUNC_CURSOR
Definition enums.h:5735
@ MSG_PRINT_FUNC_SIZE
Definition enums.h:5722
@ MSG_PRINT_FUNC_ANIM_DONE
Definition enums.h:5734
@ MSG_PRINT_FUNC_CENTER_X
Definition enums.h:5743
@ MSG_PRINT_FUNC_SAVE_POS
Definition enums.h:5737
@ MSG_PRINT_RESET_GFX
Definition enums.h:5718
@ DRAW_FLAG_ROTSCALE
Definition enums.h:4588
@ MSG_PAL_14
Definition enums.h:5010
@ MSG_PAL_13
Definition enums.h:5009
@ MSG_PAL_22
Definition enums.h:5024
@ MSG_PAL_43
Definition enums.h:5057
@ MSG_PAL_42
Definition enums.h:5056
@ MSG_PAL_WHITE
Definition enums.h:4990
@ MSG_PAL_20
Definition enums.h:5022
@ MSG_PAL_23
Definition enums.h:5025
@ MSG_PAL_1C
Definition enums.h:5018
@ MSG_PAL_STANDARD
Definition enums.h:5000
@ MSG_PAL_10
Definition enums.h:5006
@ MSG_PAL_12
Definition enums.h:5008
@ MSG_PAL_25
Definition enums.h:5027
@ MSG_PAL_44
Definition enums.h:5058
@ MSG_PAL_40
Definition enums.h:5054
@ MSG_PAL_RED
Definition enums.h:4997
@ MSG_PAL_41
Definition enums.h:5055
@ MSG_PAL_18
Definition enums.h:5014
@ MSG_PAL_11
Definition enums.h:5007
@ EASING_SIN_OUT
Definition enums.h:521
@ EASING_LINEAR
Definition enums.h:510
@ MSG_STYLE_POSTCARD
Definition enums.h:5790
@ MSG_STYLE_CENTER
Definition enums.h:5784
@ MSG_STYLE_LEFT
Definition enums.h:5783
@ MSG_STYLE_UPGRADE
Definition enums.h:5793
@ MSG_STYLE_SIGN
Definition enums.h:5788
@ MSG_STYLE_F
Definition enums.h:5796
@ MSG_STYLE_B
Definition enums.h:5792
@ MSG_STYLE_NARRATE
Definition enums.h:5794
@ MSG_STYLE_INSPECT
Definition enums.h:5787
@ MSG_STYLE_LAMPPOST
Definition enums.h:5789
@ MSG_STYLE_POPUP
Definition enums.h:5791
@ MSG_STYLE_RIGHT
Definition enums.h:5782
@ MSG_STYLE_EPILOGUE
Definition enums.h:5795
@ MSG_STYLE_TATTLE
Definition enums.h:5785
@ MSG_STYLE_CHOICE
Definition enums.h:5786
@ MSG_PRINT_FLAG_2
Definition enums.h:5815
@ MSG_PRINT_FLAG_40
Definition enums.h:5818
@ MSG_PRINT_FLAG_100
Definition enums.h:5820
@ MSG_PRINT_FLAG_1
Definition enums.h:5814
@ MSG_PRINT_FLAG_20
Definition enums.h:5817
@ MSG_PRINT_FLAG_10
Definition enums.h:5816
@ MSG_PRINT_FLAG_80
Definition enums.h:5819
@ MSG_FX_NOISE_OUTLINE
Definition enums.h:5749
@ MSG_FX_RISE_PRINT
Definition enums.h:5756
@ MSG_FX_SIZE_JITTER
Definition enums.h:5758
@ MSG_FX_SHAKE
Definition enums.h:5747
@ MSG_FX_GLOBAL_WAVE
Definition enums.h:5754
@ MSG_FX_GLOBAL_RAINBOW
Definition enums.h:5755
@ MSG_FX_DROP_SHADOW
Definition enums.h:5760
@ MSG_FX_SIZE_WAVE
Definition enums.h:5759
@ MSG_FX_STATIC
Definition enums.h:5750
@ MSG_FX_BLUR
Definition enums.h:5751
@ MSG_FX_DITHER_FADE
Definition enums.h:5753
@ MSG_FX_WAVE
Definition enums.h:5748
@ MSG_FX_RAINBOW
Definition enums.h:5752
@ MSG_FX_GROW_PRINT
Definition enums.h:5757
@ MSG_CHAR_PRINT_SPACE
Definition enums.h:5652
@ MSG_CHAR_PRINT_VARIANT2
Definition enums.h:5650
@ MSG_CHAR_PRINT_VARIANT1
Definition enums.h:5649
@ MSG_CHAR_PRINT_NEXT
Definition enums.h:5657
@ MSG_CHAR_PRINT_END
Definition enums.h:5658
@ MSG_CHAR_PRINT_ENDL
Definition enums.h:5647
@ MSG_CHAR_PRINT_FULL_SPACE
Definition enums.h:5653
@ MSG_CHAR_PRINT_VARIANT0
Definition enums.h:5648
@ MSG_CHAR_PRINT_FUNCTION
Definition enums.h:5662
@ MSG_CHAR_PRINT_STYLE
Definition enums.h:5655
@ MSG_CHAR_PRINT_VARIANT3
Definition enums.h:5651
@ MSG_CHAR_PRINT_UNK_CHAR_FA
Definition enums.h:5656
@ MSG_CHAR_PRINT_HALF_SPACE
Definition enums.h:5654
@ MSG_WINDOW_STATE_B
Definition enums.h:5863
@ MSG_WINDOW_STATE_WAITING_FOR_CHOICE
Definition enums.h:5859
@ MSG_WINDOW_STATE_OPENING
Definition enums.h:5854
@ MSG_WINDOW_STATE_PRINTING
Definition enums.h:5856
@ MSG_WINDOW_STATE_C
Definition enums.h:5864
@ MSG_WINDOW_STATE_E
Definition enums.h:5866
@ MSG_WINDOW_STATE_D
Definition enums.h:5865
@ MSG_WINDOW_STATE_CLOSING
Definition enums.h:5855
f32 update_lerp(s32 easing, f32 start, f32 end, s32 elapsed, s32 duration)
Definition 43F0.c:735
s32 draw_ci_image_with_clipping(u8 *raster, s32 width, s32 height, s32 fmt, s32 bitDepth, u16 *palette, s16 posX, s16 posY, u16 clipULx, u16 clipULy, u16 clipLRx, u16 clipRLy, u8 opacity)
f32 cosine(s16 arg0)
Definition 43F0.c:352
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
Definition 43F0.c:670
void load_font_data(Addr offset, u16 size, void *dest)
Definition msg.c:218
IMG_BIN ui_msg_bubble_mid_png[]
void drawbox_message_delegate(s32 data, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening)
Definition msg_draw.c:131
#define MSG_SIGN_OFFSET_X
Definition msg_draw.c:205
Vtx gMsgSpeechBoxRQuad[]
Definition msg_draw.c:73
void msg_draw_speech_bubble(MessagePrintState *printer, s16 posX, s16 posY, s16 straightWidth, s16 curveWidth, s16 height, f32 scaleX, f32 scaleY, u8 opacity, s32 arg9)
Definition msg_draw.c:1821
u8 D_8014C588[]
Definition msg_draw.c:114
#define MSG_SIGN_WIDTH
Definition msg_draw.c:204
PAL_BIN D_8015C7E0[0x10]
Definition msg.c:105
Vtx gMsgArrowQuad1[]
Definition msg_draw.c:80
s32 gMessageBoxFrameParts[2][16]
Definition 5B320.c:492
IMG_BIN ui_msg_lamppost_corner_bottomright_png[]
IMG_BIN D_80159B50[0x200]
Definition msg.c:104
IMG_BIN ui_msg_sign_side_top_png[]
s16 MsgStyleVerticalLineOffsets[]
Definition msg_data.c:927
PAL_BIN ui_msg_lamppost_pal[]
void appendGfx_message(MessagePrintState *, s16, s16, u16, u16, u16, u8)
Definition msg_draw.c:213
void msg_draw_char(MessagePrintState *printer, MessageDrawState *drawState, s32 charIndex, s32 palette, s32 posX, s32 posY)
Definition msg_draw.c:1645
IMG_BIN ui_msg_sign_corner_topright_png[]
Gfx * D_80151338
Definition msg.c:93
#define MSG_POPUP_TEXT_Y
Definition msg_draw.c:206
#define MSG_NORMAL_WIN_WIDTH
Definition msg_draw.c:195
MessageImageData * MessageImageDataList[1]
Definition msg_draw.c:34
void msg_draw_frame(s32 posX, s32 posY, s32 sizeX, s32 sizeY, s32 style, s32 palette, s32 fading, s32 bgAlpha, s32 frameAlpha)
Definition msg_draw.c:2041
#define MSG_SIGN_TEXT_Y
Definition msg_draw.c:203
#define MSG_EPILOGUE_TEXT_Y
Definition msg_draw.c:207
#define MSG_NORMAL_X
Definition msg_draw.c:194
IMG_BIN ui_msg_bubble_right_png[]
IMG_BIN ui_msg_sign_fill_png[]
IMG_BIN ui_msg_background_png[]
void appendGfx_msg_prim_rect(u8 r, u8 g, u8 b, u8 a, u16 ulX, u16 ulY, u16 lrX, u16 lrY)
Definition msg_draw.c:1793
Vtx gMsgSpeechBoxMQuad[]
Definition msg_draw.c:66
#define MSG_NORMAL_WIDTH
Definition msg_draw.c:193
u16 gMsgGlobalWaveCounter
Definition msg.c:89
void msg_draw_prim_rect(u8 r, u8 g, u8 b, u8 a, u16 posX, u16 posY, u16 sizeX, u16 sizeY)
Definition msg_draw.c:1786
s32 msg_get_draw_char_width(s32 character, s32 charset, s32 variation, f32 msgScale, s32 overrideCharWidth, u16 flags)
Definition msg.c:1630
s32 gMsgBGScrollAmtY
Definition msg.c:91
PAL_BIN ui_msg_sign_pal[]
#define MSG_NORMAL_TEXT_Y
Definition msg_draw.c:197
void msg_reset_gfx_state(void)
Definition msg_draw.c:1640
#define MSG_NORMAL_ARROW_X
Definition msg_draw.c:198
IMG_BIN ui_msg_sign_side_bottom_png[]
#define MSG_NORMAL_PAGE_HT
Definition msg_draw.c:201
PAL_BIN D_802F4560[80][8]
IMG_BIN ui_msg_sign_side_right_png[]
IMG_BIN ui_msg_sign_corner_bottomleft_png[]
#define MSG_NORMAL_WIN_HEIGHT
Definition msg_draw.c:196
void msg_draw_speech_arrow(MessagePrintState *printer)
Definition msg_draw.c:1926
Vtx gMsgArrowQuad2[]
Definition msg_draw.c:87
IMG_BIN ui_msg_sign_corner_bottomright_png[]
unsigned char ui_msg_palettes[16][32]
Definition msg_img.c:42
s32 my_ceil(f32 f)
Definition msg_draw.c:11
void msg_get_glyph(s32 font, s32 variation, s32 charIndex, s32 palette, MesasgeFontGlyphData *out)
Definition msg_draw.c:2277
void draw_message_window(MessagePrintState *printer)
Definition msg_draw.c:137
IMG_BIN ui_msg_bubble_left_png[]
Gfx D_8014C500[]
Definition msg_draw.c:94
MessageImageDataList gMsgVarImages
Definition msg.c:90
#define MSG_INSPECT_TEXT_Y
Definition msg_draw.c:202
IMG_BIN ui_msg_sign_corner_topleft_png[]
#define MSG_NORMAL_ARROW_Y
Definition msg_draw.c:199
#define MSG_NORMAL_HEIGHT_CAP
Definition msg_draw.c:200
MessageCharset * MsgCharsets[5]
Definition msg_data.c:865
IMG_BIN ui_msg_arrow_png[]
IMG_BIN ui_msg_sign_side_left_png[]
Vtx gMsgSpeechBoxLQuad[4]
Definition msg_draw.c:59
u8 D_8014C580[]
Definition msg_draw.c:113
u8 * D_8015131C
Definition msg.c:92
s32 gMsgBGScrollAmtX
Definition msg.c:88
#define UNPACK_PAL_B(color)
Definition macros.h:280
#define PM_CC_PRIM_FULL_ALPHA
Definition macros.h:295
#define PM_CC_07
Definition macros.h:294
#define UNPACK_PAL_R(color)
Definition macros.h:278
#define SCREEN_WIDTH
Definition macros.h:108
#define ARRAY_COUNT(arr)
Definition macros.h:39
#define PM_CC_MSG_NOISE_OUTLINE
Definition macros.h:462
#define UNPACK_PAL_G(color)
Definition macros.h:279
#define SCREEN_HEIGHT
Definition macros.h:109
#define PM_CC_10
Definition macros.h:305
#define PM_CC_0F
Definition macros.h:304
#define PM_CC_MSG_STATIC
Definition macros.h:463
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:46
#define PM_CC_02
Definition macros.h:288
s32 spr_get_npc_raster_info(SpriteRasterInfo *out, s32 npcSpriteID, s32 rasterIndex)
Definition sprite.c:1279
GameStatus * gGameStatusPtr
Definition main_loop.c:31
Gfx * gMainGfxPos
Definition cam_main.c:14
u16 gMatrixListPos
Definition main_loop.c:44
s32 gCurrentDisplayContextIndex
Definition main_loop.c:46
DisplayContext * gDisplayContext
Definition cam_main.c:15