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) {
239 }
else if (font == 1) {
255 for (i = 0; i <
ARRAY_COUNT(gMessagePrinters); i++) {
281 if (
printer->effectFrameCounter >= 3600) {
282 printer->effectFrameCounter = 0;
286 if (speechPan < 5.0) {
288 }
else if (speechPan > 122.0) {
291 printer->speechPan = speechPan;
298 switch (
printer->windowState) {
342 if (
printer->unkArraySize > 0) {
399 if (
printer->scrollingTime >= (s32)(5 *
DT)) {
420 if (
printer->animTimers[i] > 0) {
425 switch (
printer->windowState) {
450 if ((
printer->curPrintDelay == 0) || --
printer->curPrintDelay == 0) {
525 printer->rewindArrowCounter = 0;
572 for (i = 0; i <
ARRAY_COUNT(gMessagePrinters); i++) {
575 guOrtho(
matrix, 0.0f, 319.0f, -240.0f, 0.0f, -500.0f, 500.0f, 1.0f);
586 for (i = 0; i <
ARRAY_COUNT(gMessagePrinters); i++) {
672 printer->rewindArrowCounter = 0;
1012 printer->varImageDisplayState = 0;
1013 printer->varImageFadeTimer = 0;
1024 printer->varImageDisplayState = 2;
1026 printer->varImageFadeTimer = 0;
1028 printer->varImageScreenPos.x = 0;
1144 if (
printer->varBufferReadPos == 0) {
1177 switch (gMessageMsgVars[
arg][
printer->varBufferReadPos++]) {
1197 for (i = 0; i <
a0; i++) {
1204 printer->varBufferReadPos = 0;
1310 printer->windowScrollRate = (s32)(6 /
DT);
1314 printer->windowOffsetPos.x = 0;
1315 printer->windowOffsetPos.y = 0;
1319 printer->rewindArrowCounter = 0;
1320 printer->rewindArrowPos.x = 0;
1321 printer->rewindArrowPos.y = 0;
1337 printer->effectFrameCounter = 0;
1349 printer->speechSoundType = -1;
1352 printer->rewindArrowCounter = 0;
1360 printer->speechPitchShift = 0;
1363 printer->varBufferReadPos = 0;
1365 printer->varImageScreenPos.x = 0;
1366 printer->varImageScreenPos.y = 0;
1368 printer->varImgFinalAlpha = 255;
1369 printer->varImageDisplayState = 0;
1370 printer->varImageFadeTimer = 0;
1385 dma_copy(addr, addr + 4, &offset[0]);
1400 dma_copy(addr, addr + 4, &offset[0]);
1435 s32 maxLinesPerPage;
1442 srcBuffer = (
s8*) msgID;
1447 for (i = 0; i <
ARRAY_COUNT(gMessagePrinters); i++) {
1448 printer = &gMessagePrinters[i];
1453 printer->srcBuffer = srcBuffer;
1459 printer->maxLineChars = maxLineChars;
1461 printer->maxLinesPerPage = maxLinesPerPage;
1480 buffer = (
s8*) msgID;
1532 msgVars = gMessageMsgVars[index];
1573#define CHAR_SPACE_MULTIPLIER 0.7
1575#define CHAR_SPACE_MULTIPLIER 0.6
1591 return charWidth * msgScale;
1597 }
else if (
flags != 0) {
1600 if (charWidthTable !=
NULL
1620 return charWidth * msgScale * 0.5;
1625 return charWidth * msgScale;
1643 if (charWidthTable !=
NULL
1723 message = (
u8*)msgID;
1804 font = message[i++];
1858 if (message[i] == 0) {
1877 switch (message[i++]) {
1928 if (buffer !=
NULL) {
1951 if (width !=
NULL) {
1954 if (height !=
NULL) {
1957 if (maxLineChars !=
NULL) {
1960 if (numLines !=
NULL) {
1961 *numLines = lineCount;
1963 if (maxLinesPerPage !=
NULL) {
1987void draw_msg(s32 msgID, s32 posX, s32 posY, s32 opacity, s32 palette,
u8 style) {
2007 if (opacity < 0xFF) {
2075 switch (
printer->rewindArrowAnimState) {
2077 printer->rewindArrowCounter = 0;
2078 printer->rewindArrowSwingPhase = 0;
2083 scale =
temp * 0.2 + 0.5;
2084 if (++
printer->rewindArrowCounter >= 4) {
2085 printer->rewindArrowCounter = 0;
2090 if (++
printer->rewindArrowCounter >= 25) {
2091 printer->rewindArrowCounter = 0;
2099 if (++
printer->rewindArrowCounter >= 15) {
2100 printer->rewindArrowCounter = 0;
2108 if (++
printer->rewindArrowCounter >= 15) {
2109 printer->rewindArrowCounter = 0;
2121 printer->rewindArrowSwingPhase += 15;
2122 if (
printer->rewindArrowSwingPhase >= 360) {
2123 printer->rewindArrowSwingPhase -= 360;
2139 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);
2140 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);
2148 if (
printer->rewindArrowCounter < 6) {
2153 printer->rewindArrowCounter++;
2154 if (
printer->rewindArrowCounter >= 12) {
2155 printer->rewindArrowCounter = 0;
2187 opacity = 255.0 -
printer->fadeOutCounter * 46.0;
2189 opacity = 72.0 -
printer->fadeOutCounter * 14.4;
2199 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);
2200 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);
2242 for (i = 0; i < 10; i++) {
2265 for (i = count - 1; i >= 0; i--) {
2274 for (i = 0; i < count; i++) {
2285 for (i = 0; i < count; i++) {
2295 if (opacity == 255) {
2305 for (i = 0; i < count; i++) {
2307 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)
#define INCLUDE_ASM(TYPE, FOLDER, NAME, ARGS...)
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