mirror of
https://github.com/YohannDR/mzm.git
synced 2024-10-07 02:23:20 +00:00
Match TextDrawYesNoEasySleep
This commit is contained in:
parent
fe7e990fb6
commit
46641b0252
@ -2,7 +2,7 @@
|
||||
|
||||
This is a work in progress decompilation of Metroid - Zero Mission.
|
||||
|
||||
2458/2721 functions decompiled (90.33%, 263 left)
|
||||
2459/2721 functions decompiled (90.37%, 262 left)
|
||||
Progress can be seen here : https://docs.google.com/spreadsheets/d/1X8XarD5evY8ZI7r_GQqh1pYmdVMbBcINYfRBUlogmKY/edit#gid=0
|
||||
|
||||
**This decomp is not shiftable, don't use it as a base to work on anything**
|
||||
|
@ -17,6 +17,7 @@ extern const struct Message sMessageDescription_Empty;
|
||||
// Temp
|
||||
extern const u16** const sStoryTextPointers[7];
|
||||
extern const u16** const sLocationTextpointers[7];
|
||||
extern const u16** const sMessageTextpointers[7];
|
||||
extern const u16** const sFileScreenTextPointers[7];
|
||||
|
||||
extern const u32 sCharactersGFX[1];
|
||||
|
54
src/text.c
54
src/text.c
@ -1,11 +1,14 @@
|
||||
#include "text.h"
|
||||
#include "gba.h"
|
||||
#include "macros.h"
|
||||
|
||||
#include "data/text_data.h"
|
||||
#include "data/shortcut_pointers.h"
|
||||
|
||||
#include "constants/text.h"
|
||||
|
||||
#include "structs/game_state.h"
|
||||
#include "structs/menus/pause_screen.h"
|
||||
|
||||
/**
|
||||
* @brief 6e460 | 24 | Gets the width of a character
|
||||
@ -15,7 +18,7 @@
|
||||
*/
|
||||
u32 TextGetCharacterWidth(u16 charID)
|
||||
{
|
||||
if (charID >= 0x4A0)
|
||||
if (charID >= ARRAY_SIZE(sCharacterWidths))
|
||||
return 10;
|
||||
else
|
||||
return sCharacterWidths[charID];
|
||||
@ -675,9 +678,58 @@ u8 TextProcessCurrentMessage(struct Message* pMessage, const u16* pText, u32* ds
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 6facc | ec | Draws the "yes no" prompt of the easy sleep menu
|
||||
*
|
||||
*/
|
||||
void TextDrawYesNoEasySleep(void)
|
||||
{
|
||||
const u16* pText;
|
||||
u8 shouldDraw;
|
||||
|
||||
// Clear graphics buffer
|
||||
BitFill(3, USHORT_MAX, PAUSE_SCREEN_EWRAM.easySleepTextFormatted_1,
|
||||
sizeof(PAUSE_SCREEN_EWRAM.easySleepTextFormatted_1) * 5, 16);
|
||||
|
||||
// Signal that the main text can start drawing
|
||||
PAUSE_SCREEN_DATA.easySleepTextState = 0;
|
||||
|
||||
// Get text pointer
|
||||
pText = sMessageTextpointers[gLanguage][MESSAGE_EASY_SLEEP_PROMPT];
|
||||
|
||||
// Reset current message
|
||||
BitFill(3, 0, &gCurrentMessage, sizeof(gCurrentMessage), 32);
|
||||
|
||||
while (*pText != CHAR_TERMINATOR)
|
||||
{
|
||||
shouldDraw = TRUE;
|
||||
if (*pText == CHAR_NEW_LINE)
|
||||
{
|
||||
// Hardcode indent
|
||||
if (gCurrentMessage.indent > 112)
|
||||
return;
|
||||
|
||||
gCurrentMessage.indent = 112;
|
||||
shouldDraw = FALSE;
|
||||
}
|
||||
else if (*pText & CHAR_WIDTH_MASK)
|
||||
{
|
||||
// Check for color change
|
||||
if ((*pText & CHAR_TERMINATOR) == CHAR_COLOR_MASK)
|
||||
gCurrentMessage.color = *pText;
|
||||
|
||||
shouldDraw = FALSE;
|
||||
}
|
||||
|
||||
if (shouldDraw)
|
||||
{
|
||||
// Draw and update indent
|
||||
TextDrawMessageCharacter(*pText, (u32*)PAUSE_SCREEN_EWRAM.unk_6000, gCurrentMessage.indent, gCurrentMessage.color);
|
||||
gCurrentMessage.indent += TextGetCharacterWidth(*pText);
|
||||
}
|
||||
|
||||
pText++;
|
||||
}
|
||||
}
|
||||
|
||||
void TextDrawEasySleep(void)
|
||||
|
Loading…
Reference in New Issue
Block a user