Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
msg.h File Reference

Go to the source code of this file.

Functions

s32 msg_get_print_char_width (s32 character, s32 charset, s32 variation, f32 msgScale, s32 overrideCharWidth, u8 flags)
 
void msg_get_glyph (s32 font, s32 variation, s32 charIndex, s32 palette, MesasgeFontGlyphData *out)
 
void dma_load_msg (u32 msgID, void *dest)
 

Function Documentation

◆ msg_get_print_char_width()

s32 msg_get_print_char_width ( s32 character,
s32 charset,
s32 variation,
f32 msgScale,
s32 overrideCharWidth,
u8 flags )

Definition at line 1578 of file msg.c.

1578 {
1579 f32 charWidth;
1580
1581 if (character >= MSG_CONTROL_CHAR
1582 && (character != MSG_CHAR_READ_SPACE
1583 && character != MSG_CHAR_READ_FULL_SPACE
1584 && character != MSG_CHAR_READ_HALF_SPACE)) {
1585 return 0;
1586 }
1587
1588#if VERSION_IQUE
1589 if (character >= MSG_CHAR_MULTIBYTE_FIRST && character <= MSG_CHAR_MULTIBYTE_LAST) {
1590 charWidth = 16.0;
1591 return charWidth * msgScale;
1592 }
1593#endif
1594
1595 if (overrideCharWidth != 0) {
1596 charWidth = overrideCharWidth;
1597 } else if (flags != 0) {
1598 u8* charWidthTable = MsgCharsets[charset]->rasters[variation].charWidthTable;
1599
1600 if (charWidthTable != NULL
1601 && character != MSG_CHAR_READ_SPACE
1602 && character != MSG_CHAR_READ_FULL_SPACE
1603 && character != MSG_CHAR_READ_HALF_SPACE) {
1604 charWidth = charWidthTable[character];
1605 } else {
1606 charWidth = MsgCharsets[charset]->rasters[variation].monospaceWidth;
1607 }
1608 } else {
1609 charWidth = MsgCharsets[charset]->rasters[variation].monospaceWidth;
1610 }
1611
1612 if (character == MSG_CHAR_READ_SPACE) {
1613 return charWidth * msgScale * CHAR_SPACE_MULTIPLIER;
1614 }
1615 if (character == MSG_CHAR_READ_FULL_SPACE) {
1616 f64 retWidth = charWidth * msgScale;
1617 return retWidth;
1618 }
1619 if (character == MSG_CHAR_READ_HALF_SPACE) {
1620 return charWidth * msgScale * 0.5;
1621 }
1622 if (character >= MSG_CONTROL_CHAR) {
1623 return 0;
1624 }
1625 return charWidth * msgScale;
1626}
MessageCharData * rasters
s8 flags
Definition demo_api.c:15
@ MSG_CHAR_READ_HALF_SPACE
Definition enums.h:6052
@ MSG_CHAR_READ_SPACE
Definition enums.h:6050
@ MSG_CHAR_READ_FULL_SPACE
Definition enums.h:6051
@ MSG_CONTROL_CHAR
Definition enums.h:6061
MessageCharset * MsgCharsets[5]
Definition msg_data.c:865
#define CHAR_SPACE_MULTIPLIER
Definition msg.c:1575

Referenced by get_msg_properties().

◆ msg_get_glyph()

void msg_get_glyph ( s32 font,
s32 variation,
s32 charIndex,
s32 palette,
MesasgeFontGlyphData * out )

Definition at line 2279 of file msg_draw.c.

2279 {
2280 out->raster = &MsgCharsets[font]->rasters[variation].raster[(u16)MsgCharsets[font]->charRasterSize * charIndex];
2281 out->palette = D_802F4560[palette];
2282 out->texSize.x = MsgCharsets[font]->texSize.x;
2283 out->texSize.y = MsgCharsets[font]->texSize.y;
2284 out->charWidth = msg_get_draw_char_width(charIndex, font, variation, 1.0f, 0, 0);
2285 out->charHeight = out->texSize.y;
2286}
s32 msg_get_draw_char_width(s32 character, s32 charset, s32 variation, f32 msgScale, s32 overrideCharWidth, u16 flags)
Definition msg.c:1628
PAL_BIN D_802F4560[80][8]
MessageCharset * MsgCharsets[5]
Definition msg_data.c:865

◆ dma_load_msg()

void dma_load_msg ( u32 msgID,
void * dest )

Definition at line 1396 of file msg.c.

1396 {
1397 u8* addr = (u8*) MSG_ROM_START + (msgID >> 14); // (msgID >> 16) * 4
1398 u8* offset[2]; // start, end
1399
1400 dma_copy(addr, addr + 4, &offset[0]); // Load section offset
1401
1402 addr = MSG_ROM_START + offset[0] + (msgID & 0xFFFF) * 4;
1403 dma_copy(addr, addr + 8, &offset); // Load message start and end offsets
1404
1405 // Load the msg data
1406 dma_copy(MSG_ROM_START + offset[0], MSG_ROM_START + offset[1], dest);
1407}
u32 dma_copy(Addr romStart, Addr romEnd, void *vramDest)
Definition 43F0.c:444
#define MSG_ROM_START
Definition msg.c:23

Referenced by draw_msg(), get_msg_properties(), load_message_to_buffer(), and set_message_text_var().