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++) {
287 if (
printer->effectFrameCounter >= 3600) {
288 printer->effectFrameCounter = 0;
292 if (speechPan < 5.0) {
294 }
else if (speechPan > 122.0) {
297 printer->speechPan = speechPan;
304 switch (
printer->windowState) {
348 if (
printer->unkArraySize > 0) {
405 if (
printer->scrollingTime >= (s32)(5 *
DT)) {
426 if (
printer->animTimers[i] > 0) {
431 switch (
printer->windowState) {
456 if ((
printer->curPrintDelay == 0) || --
printer->curPrintDelay == 0) {
531 printer->rewindArrowCounter = 0;
578 for (i = 0; i <
ARRAY_COUNT(gMessagePrinters); i++) {
581 guOrtho(
matrix, 0.0f, 319.0f, -240.0f, 0.0f, -500.0f, 500.0f, 1.0f);
592 for (i = 0; i <
ARRAY_COUNT(gMessagePrinters); i++) {
678 printer->rewindArrowCounter = 0;
1018 printer->varImageDisplayState = 0;
1019 printer->varImageFadeTimer = 0;
1030 printer->varImageDisplayState = 2;
1032 printer->varImageFadeTimer = 0;
1034 printer->varImageScreenPos.x = 0;
1150 if (
printer->varBufferReadPos == 0) {
1183 switch (gMessageMsgVars[
arg][
printer->varBufferReadPos++]) {
1203 for (i = 0; i <
a0; i++) {
1210 printer->varBufferReadPos = 0;
1316 printer->windowScrollRate = (s32)(6 /
DT);
1320 printer->windowOffsetPos.x = 0;
1321 printer->windowOffsetPos.y = 0;
1325 printer->rewindArrowCounter = 0;
1326 printer->rewindArrowPos.x = 0;
1327 printer->rewindArrowPos.y = 0;
1343 printer->effectFrameCounter = 0;
1355 printer->speechSoundType = -1;
1358 printer->rewindArrowCounter = 0;
1366 printer->speechPitchShift = 0;
1369 printer->varBufferReadPos = 0;
1371 printer->varImageScreenPos.x = 0;
1372 printer->varImageScreenPos.y = 0;
1374 printer->varImgFinalAlpha = 255;
1375 printer->varImageDisplayState = 0;
1376 printer->varImageFadeTimer = 0;
1391 dma_copy(addr, addr + 4, &offset[0]);
1406 dma_copy(addr, addr + 4, &offset[0]);
1441 s32 maxLinesPerPage;
1448 srcBuffer = (
s8*) msgID;
1453 for (i = 0; i <
ARRAY_COUNT(gMessagePrinters); i++) {
1454 printer = &gMessagePrinters[i];
1459 printer->srcBuffer = srcBuffer;
1465 printer->maxLineChars = maxLineChars;
1467 printer->maxLinesPerPage = maxLinesPerPage;
1486 buffer = (
s8*) msgID;
1538 msgVars = gMessageMsgVars[index];
1579#define CHAR_SPACE_MULTIPLIER 0.7
1581#define CHAR_SPACE_MULTIPLIER 0.6
1597 return charWidth * msgScale;
1603 }
else if (
flags != 0) {
1606 if (charWidthTable !=
NULL
1626 return charWidth * msgScale * 0.5;
1631 return charWidth * msgScale;
1649 if (charWidthTable !=
NULL
1729 message = (
u8*)msgID;
1810 font = message[i++];
1864 if (message[i] == 0) {
1883 switch (message[i++]) {
1934 if (buffer !=
NULL) {
1957 if (width !=
NULL) {
1960 if (height !=
NULL) {
1963 if (maxLineChars !=
NULL) {
1966 if (numLines !=
NULL) {
1967 *numLines = lineCount;
1969 if (maxLinesPerPage !=
NULL) {
1993void draw_msg(s32 msgID, s32 posX, s32 posY, s32 opacity, s32 palette,
u8 style) {
2013 if (opacity < 0xFF) {
2081 switch (
printer->rewindArrowAnimState) {
2083 printer->rewindArrowCounter = 0;
2084 printer->rewindArrowSwingPhase = 0;
2089 scale =
temp * 0.2 + 0.5;
2090 if (++
printer->rewindArrowCounter >= 4) {
2091 printer->rewindArrowCounter = 0;
2096 if (++
printer->rewindArrowCounter >= 25) {
2097 printer->rewindArrowCounter = 0;
2105 if (++
printer->rewindArrowCounter >= 15) {
2106 printer->rewindArrowCounter = 0;
2114 if (++
printer->rewindArrowCounter >= 15) {
2115 printer->rewindArrowCounter = 0;
2127 printer->rewindArrowSwingPhase += 15;
2128 if (
printer->rewindArrowSwingPhase >= 360) {
2129 printer->rewindArrowSwingPhase -= 360;
2145 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);
2146 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);
2154 if (
printer->rewindArrowCounter < 6) {
2159 printer->rewindArrowCounter++;
2160 if (
printer->rewindArrowCounter >= 12) {
2161 printer->rewindArrowCounter = 0;
2193 opacity = 255.0 -
printer->fadeOutCounter * 46.0;
2195 opacity = 72.0 -
printer->fadeOutCounter * 14.4;
2205 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);
2206 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);
2248 for (i = 0; i < 10; i++) {
2271 for (i = count - 1; i >= 0; i--) {
2280 for (i = 0; i < count; i++) {
2291 for (i = 0; i < count; i++) {
2301 if (opacity == 255) {
2311 for (i = 0; i < count; i++) {
2313 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