3#include "message_ids.h"
7#include "charset/postcard.png.h"
8#include "charset/letter_content_1.png.h"
19#define MSG_ROM_START (s32)msg_ROM_START
21#define MSG_ROM_START 0x1D40000
23#define MSG_ROM_START 0x1B83000
27#define CHOICE_POINTER_MOVE_RATE 5.0
29#define CHOICE_POINTER_MOVE_RATE 6.0
36 .vscale = {640, 480, 511, 0},
37 .vtrans = {640, 480, 511, 0},
65 {{{ -16, 9, 0 }, 0, { 0x000, 0x000 }, { 255, 255, 255, 255 }}},
66 {{{ 16, 9, 0 }, 0, { 0x400, 0x000 }, { 255, 255, 255, 255 }}},
67 {{{ -16, -9, 0 }, 0, { 0x000, 0x240 }, { 255, 255, 255, 255 }}},
68 {{{ 16, -9, 0 }, 0, { 0x400, 0x240 }, { 255, 255, 255, 255 }}},
95static char gMessageBuffers[2][1024];
100static u8 gMessageMsgVars[3][32];
101static s16 D_80155C98;
102static Mtx gMessageWindowProjMatrix[2];
136 .digitWidth = {11, 8, 11, 11, 11, 11, 11, 11, 11, 11},
143 .digitWidth = {9, 8, 9, 9, 9, 9, 9, 9, 9, 9},
152 .digitWidth = {11, 8, 11, 11, 11, 11, 11, 11, 11, 11},
159 .digitWidth = {9, 8, 9, 9, 9, 9, 9, 9, 9, 9},
199 for (i = 0; i <
ARRAY_COUNT(gMessagePrinters); i++) {
206 for (i = 0; i <
ARRAY_COUNT(gMessageMsgVars); i++) {
207 gMessageMsgVars[i][0] = 0;
226 if (font != D_80155C98) {
241 for (
s32 i = 0; i < 80; i++) {
245 }
else if (font == 1) {
261 for (i = 0; i <
ARRAY_COUNT(gMessagePrinters); i++) {
286 if (
printer->effectFrameCounter >= 3600) {
287 printer->effectFrameCounter = 0;
291 if (speechPan < 5.0) {
293 }
else if (speechPan > 122.0) {
296 printer->speechPan = speechPan;
303 switch (
printer->windowState) {
347 if (
printer->unkArraySize > 0) {
425 if (
printer->animTimers[i] > 0) {
430 switch (
printer->windowState) {
455 if ((
printer->curPrintDelay == 0) || --
printer->curPrintDelay == 0) {
530 printer->rewindArrowCounter = 0;
552 if (
printer->letterBackgroundImg !=
nullptr) {
555 if (
printer->letterBackgroundPal !=
nullptr) {
558 if (
printer->letterContentImg !=
nullptr) {
561 if (
printer->letterContentPal !=
nullptr) {
564 if (
printer->closedWritebackBool !=
nullptr) {
565 *
printer->closedWritebackBool =
true;
566 printer->closedWritebackBool =
nullptr;
577 for (i = 0; i <
ARRAY_COUNT(gMessagePrinters); i++) {
580 guOrtho(
matrix, 0.0f, 319.0f, -240.0f, 0.0f, -500.0f, 500.0f, 1.0f);
591 for (i = 0; i <
ARRAY_COUNT(gMessagePrinters); i++) {
675 printer->rewindArrowCounter = 0;
842 if (
printer->closedWritebackBool !=
nullptr) {
843 *
printer->closedWritebackBool =
true;
1015 printer->varImageDisplayState = 0;
1016 printer->varImageFadeTimer = 0;
1027 printer->varImageDisplayState = 2;
1029 printer->varImageFadeTimer = 0;
1031 printer->varImageScreenPos.x = 0;
1147 if (
printer->varBufferReadPos == 0) {
1179 switch (gMessageMsgVars[
arg][
printer->varBufferReadPos++]) {
1199 for (i = 0; i <
a0; i++) {
1206 printer->varBufferReadPos = 0;
1316 printer->windowOffsetPos.x = 0;
1317 printer->windowOffsetPos.y = 0;
1321 printer->rewindArrowCounter = 0;
1322 printer->rewindArrowPos.x = 0;
1323 printer->rewindArrowPos.y = 0;
1334 printer->closedWritebackBool =
nullptr;
1339 printer->effectFrameCounter = 0;
1351 printer->speechSoundType = -1;
1354 printer->rewindArrowCounter = 0;
1362 printer->speechPitchShift = 0;
1365 printer->varBufferReadPos = 0;
1367 printer->varImageScreenPos.x = 0;
1368 printer->varImageScreenPos.y = 0;
1370 printer->varImgFinalAlpha = 255;
1371 printer->varImageDisplayState = 0;
1372 printer->varImageFadeTimer = 0;
1373 printer->letterBackgroundImg =
nullptr;
1374 printer->letterBackgroundPal =
nullptr;
1375 printer->letterContentImg =
nullptr;
1376 printer->letterContentPal =
nullptr;
1387 dma_copy(addr, addr + 4, &offset[0]);
1402 dma_copy(addr, addr + 4, &offset[0]);
1437 s32 maxLinesPerPage;
1444 srcBuffer = (
s8*) msgID;
1449 for (i = 0; i <
ARRAY_COUNT(gMessagePrinters); i++) {
1450 printer = &gMessagePrinters[i];
1455 printer->srcBuffer = srcBuffer;
1458 get_msg_properties(msgID, &height, &width, &maxLineChars, &numLines, &maxLinesPerPage,
nullptr, 0);
1461 printer->maxLineChars = maxLineChars;
1463 printer->maxLinesPerPage = maxLinesPerPage;
1482 buffer = (
s8*) msgID;
1534 msgVars = gMessageMsgVars[index];
1575#define CHAR_SPACE_MULTIPLIER 0.7
1577#define CHAR_SPACE_MULTIPLIER 0.6
1593 return charWidth * msgScale;
1599 }
else if (
flags != 0) {
1602 if (charWidthTable !=
nullptr
1622 return charWidth * msgScale * 0.5;
1627 return charWidth * msgScale;
1645 if (charWidthTable !=
nullptr
1725 message = (
u8*)msgID;
1806 font = message[i++];
1860 if (message[i] == 0) {
1879 switch (message[i++]) {
1930 if (buffer !=
nullptr) {
1953 if (width !=
nullptr) {
1956 if (height !=
nullptr) {
1959 if (maxLineChars !=
nullptr) {
1962 if (numLines !=
nullptr) {
1963 *numLines = lineCount;
1965 if (maxLinesPerPage !=
nullptr) {
1984 get_msg_properties(msgID,
nullptr,
nullptr,
nullptr, &numLines,
nullptr,
nullptr, 0);
2009 if (opacity < 0xFF) {
2077 switch (
printer->rewindArrowAnimState) {
2079 printer->rewindArrowCounter = 0;
2080 printer->rewindArrowSwingPhase = 0;
2085 scale =
temp * 0.2 + 0.5;
2086 if (++
printer->rewindArrowCounter >= 4) {
2087 printer->rewindArrowCounter = 0;
2092 if (++
printer->rewindArrowCounter >= 25) {
2093 printer->rewindArrowCounter = 0;
2101 if (++
printer->rewindArrowCounter >= 15) {
2102 printer->rewindArrowCounter = 0;
2110 if (++
printer->rewindArrowCounter >= 15) {
2111 printer->rewindArrowCounter = 0;
2123 printer->rewindArrowSwingPhase += 15;
2124 if (
printer->rewindArrowSwingPhase >= 360) {
2125 printer->rewindArrowSwingPhase -= 360;
2141 gDPLoadTextureTile(
gMainGfxPos++,
ui_msg_star_png,
G_IM_FMT_RGBA,
G_IM_SIZ_16b, 16, 0, 0, 0, 15, 17, 0,
G_TX_MIRROR |
G_TX_WRAP,
G_TX_NOMIRROR |
G_TX_WRAP, 4, 4,
G_TX_NOLOD,
G_TX_NOLOD);
2142 gDPLoadMultiTile_4b(
gMainGfxPos++,
ui_msg_star_silhouette_png, 0x0100, 1,
G_IM_FMT_I, 16, 0, 0, 0, 15, 18, 0,
G_TX_MIRROR |
G_TX_WRAP,
G_TX_NOMIRROR |
G_TX_WRAP, 4, 5,
G_TX_NOLOD,
G_TX_NOLOD);
2150 if (
printer->rewindArrowCounter < 6) {
2155 printer->rewindArrowCounter++;
2156 if (
printer->rewindArrowCounter >= 12) {
2157 printer->rewindArrowCounter = 0;
2189 opacity = 255.0 -
printer->fadeOutCounter * 46.0;
2191 opacity = 72.0 -
printer->fadeOutCounter * 14.4;
2201 draw_image_with_clipping(
ui_point_right_png, 16, 16,
G_IM_FMT_CI,
G_IM_SIZ_4b, posX + 2, posY + 2, 10, 10, 300, 220);
2202 draw_ci_image_with_clipping(
ui_point_right_png, 16, 16,
G_IM_FMT_CI,
G_IM_SIZ_4b,
ui_point_right_pal, posX, posY, 20, 20, 300, 200,
pointerAlpha);
2244 for (i = 0; i < 10; i++) {
2267 for (i = count - 1; i >= 0; i--) {
2276 for (i = 0; i < count; i++) {
2287 for (i = 0; i < count; i++) {
2297 if (opacity == 255) {
2307 for (i = 0; i < count; i++) {
2309 if (posX > 0 && posX < 320) {
BSS s32 PopupMenu_SelectedIndex
unsigned char charset_standard_pal_OFFSET[]
unsigned char charset_postcard_OFFSET[]
unsigned short charset_postcard_pal_OFFSET[]
unsigned char charset_standard_OFFSET[]
unsigned char charset_subtitle_pal_OFFSET[]
unsigned char charset_subtitle_OFFSET[]
unsigned char charset_title_OFFSET[]
MessageCharData * rasters
#define general_heap_malloc
@ DRAW_MSG_STYLE_DROP_SHADOW
@ DRAW_NUMBER_STYLE_ALIGN_RIGHT
drawn to the left of posX
@ DRAW_NUMBER_STYLE_DROP_SHADOW
@ DRAW_NUMBER_STYLE_MONOSPACE
@ MSG_STATE_FLAG_PRINT_QUICKLY
@ MSG_STATE_FLAG_SPEAKING
@ MSG_READ_FUNC_RESTORE_COLOR
@ MSG_READ_FUNC_RESET_GFX
@ MSG_READ_FUNC_INPUT_OFF
@ MSG_READ_FUNC_SET_CURSOR
@ MSG_READ_FUNC_SET_CANCEL
@ MSG_READ_FUNC_DELAY_OFF
@ MSG_PRINT_FUNC_ITEM_ICON
@ MSG_READ_FUNC_SAVE_COLOR
@ MSG_READ_FUNC_CUSTOM_VOICE
@ MSG_PRINT_FUNC_ANIM_DELAY
@ MSG_READ_FUNC_INLINE_IMAGE
@ MSG_PRINT_FUNC_ANIM_LOOP
@ MSG_PRINT_FUNC_ANIM_SPRITE
@ MSG_PRINT_FUNC_INLINE_IMAGE
@ MSG_PRINT_FUNC_SIZE_RESET
@ MSG_PRINT_FUNC_SAVE_COLOR
@ MSG_READ_FUNC_RESTORE_POS
@ MSG_READ_FUNC_ENABLE_CDOWN_NEXT
@ MSG_READ_FUNC_HIDE_IMAGE
@ MSG_PRINT_FUNC_RESTORE_COLOR
@ MSG_PRINT_FUNC_START_FX
@ MSG_READ_FUNC_END_CHOICE
@ MSG_PRINT_FUNC_RESTORE_POS
@ MSG_READ_FUNC_ANIM_LOOP
@ MSG_READ_FUNC_ANIM_DELAY
@ MSG_READ_FUNC_ITEM_ICON
@ MSG_READ_FUNC_SET_REWIND
@ MSG_PRINT_FUNC_ANIM_DONE
@ MSG_READ_FUNC_SIZE_RESET
@ MSG_PRINT_FUNC_CENTER_X
@ MSG_PRINT_FUNC_SAVE_POS
@ MSG_READ_FUNC_ANIM_SPRITE
@ MSG_READ_FUNC_ANIM_DONE
@ SOUND_MENU_CHANGE_SELECTION
@ MSG_CHAR_READ_HALF_SPACE
@ MSG_CHAR_READ_FULL_SPACE
@ MSG_CHAR_READ_UNK_CHAR_FA
@ MSG_CHAR_PRINT_FULL_SPACE
@ MSG_CHAR_PRINT_VARIANT0
@ MSG_CHAR_PRINT_FUNCTION
@ MSG_CHAR_PRINT_UNK_CHAR_FA
@ MSG_CHAR_PRINT_HALF_SPACE
@ MSG_WINDOW_STATE_WAITING
@ MSG_WINDOW_STATE_WAITING_FOR_CHOICE
@ MSG_WINDOW_STATE_OPENING
@ MSG_WINDOW_STATE_SCROLLING
@ MSG_WINDOW_STATE_PRINTING
@ MSG_WINDOW_STATE_SCROLLING_BACK
@ MSG_WINDOW_STATE_CLOSING
@ MSG_WINDOW_STATE_VIEWING_PREV
f32 update_lerp(s32 easing, f32 start, f32 end, s32 elapsed, s32 duration)
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)
u32 dma_copy(Addr romStart, Addr romEnd, void *vramDest)
s32 general_heap_free(void *data)
char * int_to_string(s32, char *, s32)
void * heap_malloc(s32 size)
s32 gItemIconPaletteOffsets[]
void msg_draw_rewind_arrow(s32)
void get_msg_properties(s32 msgID, s32 *height, s32 *width, s32 *maxLineChars, s32 *numLines, s32 *maxLinesPerPage, s32 *numSpaces, u16 charset)
IMG_BIN ui_msg_rewind_arrow_png[]
void msg_printer_set_origin_pos(MessagePrintState *msgPrintState, s32 x, s32 y)
MessagePrintState * _msg_get_printer_for_msg(s32 msgID, s32 *donePrintingWriteback, s32 arg2)
s32 cancel_message(MessagePrintState *msgPrintState)
s8 * load_message_to_buffer(s32 msgID)
IMG_BIN MsgCharImgSubtitle[]
void render_messages(void)
s32 draw_image_with_clipping(IMG_PTR raster, s32 width, s32 height, s32 fmt, s32 bitDepth, s16 posX, s16 posY, u16 clipULx, u16 clipULy, u16 clipLRx, u16 clipRLy)
IMG_BIN D_80159B50[0x200]
void clear_character_set(void)
s16 MsgStyleVerticalLineOffsets[]
PAL_PTR MsgLetterPaletteOffsets[]
s32 msg_get_print_char_width(s32 character, s32 charset, s32 variation, f32 msgScale, s32 overrideCharWidth, u8 flags)
PAL_BIN ui_msg_rewind_arrow_pal[]
void close_message(MessagePrintState *msgPrintState)
void appendGfx_message(MessagePrintState *, s16, s16, u16, u16, u16, u8)
void draw_digit(IMG_PTR img, s32 charset, s32 posX, s32 posY)
IMG_BIN MsgCharImgTitle[]
void clear_printers(void)
MessageImageData * MessageImageDataList[1]
s32 gItemIconRasterOffsets[]
#define CHOICE_POINTER_MOVE_RATE
u16 gMsgGlobalWaveCounter
Gfx gMsgDlistInitDrawNumber[]
void dma_load_msg(u32 msgID, void *dest)
s32 msg_get_draw_char_width(s32 character, s32 charset, s32 variation, f32 msgScale, s32 overrideCharWidth, u16 flags)
void msg_play_speech_sound(MessagePrintState *printer, u8 character)
void initialize_printer(MessagePrintState *printer, s32 arg1, s32 arg2)
void load_font_data(Addr offset, u16 size, void *dest)
IMG_BIN ui_msg_star_png[]
IMG_BIN MsgCharImgNormal[]
s32 get_msg_lines(s32 msgID)
MessageNumber gMsgNumbers[]
PAL_BIN D_802F4560[80][8]
void set_message_int_var(s32 value, s32 index)
void set_message_text_var(s32 msgID, s32 index)
IMG_BIN ui_msg_star_silhouette_png[]
void msg_update_rewind_arrow(s32)
MessagePrintState * msg_get_printer_for_msg(s32 msgID, s32 *donePrintingWriteback)
void draw_message_window(MessagePrintState *printer)
void msg_copy_to_print_buffer(MessagePrintState *printer, s32 arg1, s32 arg2)
void draw_number(s32 value, s32 x, s32 y, s32 charset, s32 palette, s32 opacity, u16 style)
void set_message_images(MessageImageData *images)
MessageImageDataList gMsgVarImages
IMG_BIN ui_point_right_png[]
s32 msg_printer_load_msg(s32 msgID, MessagePrintState *printer)
s32 _update_message(MessagePrintState *printer)
MessageCharset * MsgCharsets[5]
void msg_draw_choice_pointer(MessagePrintState *printer)
#define CHAR_SPACE_MULTIPLIER
IMG_PTR MsgLetterRasterOffsets[]
void update_messages(void)
PAL_BIN ui_point_right_pal[]
@ REWIND_ARROW_STATE_NEUTRAL
@ REWIND_ARROW_STATE_INIT
@ REWIND_ARROW_STATE_CHANGE_COLOR_BACK
@ REWIND_ARROW_STATE_GROW
@ REWIND_ARROW_STATE_CHANGE_COLOR
IMG_BIN MsgCharImgLatin[]
IMG_BIN MsgCharImgMenuKana[]
IMG_BIN MsgCharImgMenuLatin[]
void sfx_play_sound_with_params(s32 soundID, u8 volume, u8 pan, s16 pitchShift)
#define PM_CC_MSG_UP_ARROW
#define VIRTUAL_TO_PHYSICAL(addr)
u8 Addr[]
Linker symbol address, as in ld_addrs.h.
GameStatus * gGameStatusPtr
s32 gCurrentDisplayContextIndex
DisplayContext * gDisplayContext