Add text script command macro for textbox auto press

This commit is contained in:
DizzyEggg
2025-06-18 14:03:03 +02:00
parent a20ec30b07
commit 5c3b02570d
22 changed files with 195 additions and 174 deletions

View File

@@ -35,6 +35,7 @@
// 20: execute script as parented object, maybe? Unused in ROM
// 21: follow object/make object follow/get parented?
// 22..2f: ???
#define TEXTBOX_AUTO_PRESS(endF, midF) { 0x2b, 0, 0, endF, midF, NULL} // Waits specified number of frames, then automatically does a button press without waiting for player's input. -1 disables it.
// 30..39: various text printing
// 3a: yes/no choice (only used for saving)
// 3b: uber command (conditional jump)

View File

@@ -17,8 +17,8 @@ extern u8 gFormatBuffer_Names[10][FORMAT_BUFFER_LEN];
extern u8 gSpeakerNameBuffer[FORMAT_BUFFER_LEN];
extern u8 gFormatBuffer_FriendArea[FRIEND_AREA_BUFFER_LEN];
void sub_8014144(void);
void sub_801416C(s32 param_1,s32 param_2);
void ResetDialogueBox(void);
void SetDialogueBoxAutoPressFrames(s32 endMsgFrames, s32 midMsgFrames);
void CreateDialogueBoxAndPortrait(const u8 *text, void *param_2, MonPortraitMsg *monPortraitPtr, u16 flags);
void CreateYesNoDialogueBoxAndPortrait_DefaultYes(const u8 *text, MonPortraitMsg *monPortraitPtr, u16 flags);
void CreateYesNoDialogueBoxAndPortrait_DefaultNo(const u8 *text, MonPortraitMsg *monPortraitPtr, u16 flags);
@@ -30,10 +30,13 @@ const u8 *FormatString(const u8 *str, u8 *dst, u8 *dstMax, u16 flags);
void PrintFormattedStringOnWindow(s32 x, s32 y, const u8 *str, u32 windowId, u32 terminatingChr);
void PrintFormattedStringOnWindow2(s32 x, s32 y, const u8 *str, u32 windowId, u32 terminatingChr, s32 lineSpacing);
#define STR_FORMAT_FLAG_WAIT_FOR_BUTTON_PRESS_2 0x1 // Same as STR_FORMAT_FLAG_WAIT_FOR_BUTTON_PRESS, except the check is in a different place. Functionally, both need to be set to wait for the button press.
#define STR_FORMAT_FLAG_TIMED_AUTO_MSG_CLOSE 0x2 // Textbox closes automatically after waiting a couple of frames.
#define STR_FORMAT_FLAG_DIALOGUE_SOUND 0x4
#define STR_FORMAT_FLAG_SPEAKER_NAME 0x8
#define STR_FORMAT_FLAG_INSTANT_TEXT 0x20
#define STR_FORMAT_FLAG_INSTANT_TEXT_ON_AB_PRESS 0x40
#define STR_FORMAT_FLAG_NEW_LINE_TERMINATES 0x80
#define STR_FORMAT_FLAG_WAIT_FOR_BUTTON_PRESS 0x100
#endif // GUARD_STRING_FORMAT_H

View File

@@ -5,7 +5,7 @@
typedef struct UnkDrawStringStruct
{
s16 x;
s16 unk2;
s16 y;
s16 unk4;
s16 unk6;
s16 unk8;
@@ -15,8 +15,8 @@ typedef struct UnkDrawStringStruct
u32 unk14;
u32 unk18;
u32 unk1C;
u8 unk20;
u8 unk21;
bool8 waitButtonPress;
bool8 waitFrames;
u8 fill22;
u8 fill23;
const u8 * (*unk24)(const u8 *, const u8 *, struct UnkDrawStringStruct *);

View File

@@ -4,6 +4,8 @@
void TextboxInit(void);
void TextboxFree(void);
void SetAutoPressTextboxFrames(s32 frames);
void SetAutoPressTextboxMidEndMsgFrames(s32 endMsgFrames, s32 midMsgFrames);
bool8 ScriptClearTextbox(void);
bool8 ScriptClearTextbox2(void);
void ResetTextboxPortrait(s16 id_);

View File

@@ -1322,7 +1322,7 @@ static const struct ScriptCommand s_gs171_g6_s0_lives0_dlg0[] = { /* 0x8223d40 *
{ 0xe4, 0x00, 0x0008, 0x00000000, 0x00000000, NULL },
{ 0xe4, 0x00, 0x0009, 0x00000000, 0x00000000, NULL },
WAIT(30),
{ 0x2b, 0x00, 0x0000, 0x0000003c, 0x0000003c, NULL },
TEXTBOX_AUTO_PRESS(60, 60),
{ 0x2d, 0x09, 0x0009, 0x0000004e, 0x00000000, NULL },
{ 0x2e, 0x0c, 0x0009, 0x00000041, 0x00000000, NULL },
{ 0x34, 0x00, 0x0009, 0x00000000, 0x00000000, _(" {NAME_0}!") },
@@ -1344,7 +1344,7 @@ static const struct ScriptCommand s_gs171_g6_s0_lives0_dlg0[] = { /* 0x8223d40 *
{ 0xe3, 0x00, 0x0005, 0x00000000, 0x00000000, NULL },
{ 0x59, 0x00, 0x0000, -0x000000c8, 0x00000000, NULL },
{ 0xe3, 0x00, 0x0005, 0x00000000, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, 0x000000b4, 0x000000b4, NULL },
TEXTBOX_AUTO_PRESS(180, 180),
{ 0x2e, 0x03, 0x0001, 0x00000006, 0x00000000, NULL },
{ 0x34, 0x00, 0x0001, 0x00000000, 0x00000000, _(" {NAME_0}!!! Nooooo!!!") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
@@ -2119,7 +2119,7 @@ static const struct ScriptCommand s_gs171_g7_s0_lives0_dlg0[] = { /* 0x8227f54 *
WAIT(90),
{ 0xdf, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
WAIT(90),
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
{ 0x2e, 0x02, 0x0006, 0x00000042, 0x00000000, NULL },
{ 0x34, 0x00, 0x0006, 0x00000000, 0x00000000, _(" Snivel... {NAME_0}...{WAIT_PRESS}\nWhy...{WAIT_PRESS} I don't understand...") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },

View File

@@ -41,18 +41,18 @@ static const struct ScriptCommand s_gs175_g1_s0_eff1_script[] = { /* 0x822b0f4 *
WAIT(40),
BGM_SWITCH(44),
WAIT(300),
{ 0x2b, 0x00, 0x0000, -0x000000c8, 0x0000003c, NULL },
TEXTBOX_AUTO_PRESS(-200, 60),
{ 0x33, 0x00, 0x0000, 0x00000000, 0x00000000, _("(..................)") },
{ 0x33, 0x00, 0x0000, 0x00000000, 0x00000000, _("(What is this...?)") },
{ 0x33, 0x00, 0x0000, 0x00000000, 0x00000000, _("(I'm rising into the sky...)") },
{ 0x2b, 0x00, 0x0000, -0x000000be, 0x0000003c, NULL },
TEXTBOX_AUTO_PRESS(-190, 60),
{ 0x33, 0x00, 0x0000, 0x00000000, 0x00000000, _("(Is this my spirit...?)") },
{ 0x33, 0x00, 0x0000, 0x00000000, 0x00000000, _("(I wonder where I'm going?)") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
WAIT(120),
{ 0x2b, 0x00, 0x0000, -0x0000006e, 0x0000003c, NULL },
TEXTBOX_AUTO_PRESS(-110, 60),
{ 0x33, 0x00, 0x0000, 0x00000000, 0x00000000, _("(......!)") },
{ 0x2b, 0x00, 0x0000, -0x000000d2, 0x00000032, NULL },
TEXTBOX_AUTO_PRESS(-210, 50),
{ 0x33, 0x00, 0x0000, 0x00000000, 0x00000000, _("(Voices...{WAIT_PRESS}\nI hear voices...)") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
{ 0xe4, 0x00, 0x0003, 0x00000000, 0x00000000, NULL },
@@ -85,7 +85,7 @@ static const struct ScriptCommand s_gs175_g2_s0_eff1_script[] = { /* 0x822b3d0 *
WAIT(120),
BGM_SWITCH(45),
WAIT(60),
{ 0x2b, 0x00, 0x0000, 0x000000be, 0x000000be, NULL },
TEXTBOX_AUTO_PRESS(190, 190),
{ 0x26, 0x01, 0x0000, 0x00000000, 0x00000000, NULL },
WAIT(1),
{ 0x39, 0x00, 0x001e, 0x00000000, 0x00000000, _("\n{CENTER_ALIGN}I don't want to leave...") },

View File

@@ -96,7 +96,7 @@ static const struct ScriptCommand s_gs176_g1_s0_eff1_script[] = { /* 0x822bb50 *
{ 0x26, 0x01, 0x0000, 0x00000000, 0x00000000, NULL },
{ 0xdf, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
WAIT(90),
{ 0x2b, 0x00, 0x0000, 0x000000b4, 0x000000b4, NULL },
TEXTBOX_AUTO_PRESS(180, 180),
WAIT(60),
{ 0x39, 0x00, 0x005a, 0x00000000, 0x00000000, _("{CENTER_ALIGN}Your friend is heartbroken...") },
WAIT(80),

View File

@@ -22,7 +22,7 @@ static const struct ScriptCommand s_gs177_g1_s0_station_sref_script[] = { /* 0x8
{ 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL },
{ 0xe0, 0x00, 0x002d, 0x00000000, 0x00000000, NULL },
WAIT(240),
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
{ 0x38, 0x00, -0x0001, 0x00000000, 0x00000000, _("\n") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
WAIT(1),

View File

@@ -7875,7 +7875,7 @@ static const struct ScriptCommand s_gs9_g53_s0_lives0_dlg0[] = { /* 0x81c02fc */
{ 0xe4, 0x00, 0x0006, 0x00000000, 0x00000000, NULL },
{ 0xe3, 0x00, 0x0005, 0x00000000, 0x00000000, NULL },
WAIT(30),
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
{ 0x2e, 0x02, 0x0001, 0x00000000, 0x00000000, NULL },
MSG_VAR(2, PARTNER_TALK_KIND, 1),
VARIANT(/* == */ 1, _(" OK! Thanks!")),
@@ -8001,11 +8001,11 @@ static const struct ScriptCommand s_gs9_g53_s0_lives2_dlg0[] = { /* 0x81c1678 */
{ 0xe3, 0x00, 0x0007, 0x00000000, 0x00000000, NULL },
{ 0x91, 0x04, 0x000b, 0x00000000, 0x00000000, NULL },
WAIT(20),
{ 0x2b, 0x00, 0x0000, 0x0000003c, 0x0000003c, NULL },
TEXTBOX_AUTO_PRESS(60, 60),
{ 0x2e, 0x0b, 0x0002, 0x00000000, 0x00000000, NULL },
{ 0x34, 0x00, 0x0002, 0x00000000, 0x00000000, _(" Take care!") },
{ 0x31, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
{ 0xe3, 0x00, 0x0007, 0x00000000, 0x00000000, NULL },
HALT,
};
@@ -8118,11 +8118,11 @@ static const struct ScriptCommand s_gs9_g53_s0_lives5_dlg0[] = { /* 0x81c1d74 */
{ 0xe3, 0x00, 0x000b, 0x00000000, 0x00000000, NULL },
{ 0x91, 0x04, 0x000b, 0x00000000, 0x00000000, NULL },
WAIT(110),
{ 0x2b, 0x00, 0x0000, 0x00000050, 0x00000050, NULL },
TEXTBOX_AUTO_PRESS(80, 80),
{ 0x2e, 0x0b, 0x0006, 0x00000000, 0x00000000, NULL },
{ 0x34, 0x00, 0x0006, 0x00000000, 0x00000000, _(" We'll be waiting for both\nof you to return!") },
{ 0x31, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
{ 0xe4, 0x00, 0x0005, 0x00000000, 0x00000000, NULL },
{ 0xe3, 0x00, 0x000b, 0x00000000, 0x00000000, NULL },
HALT,

View File

@@ -284,39 +284,39 @@ static const struct ScriptCommand s_gs192_g2_s0_lives0_dlg0[] = { /* 0x823ef68 *
{ 0xe3, 0x00, 0x0005, 0x00000000, 0x00000000, NULL },
WAIT(20),
{ 0xe4, 0x00, 0x0006, 0x00000000, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, 0x0000001e, 0x0000001e, NULL },
TEXTBOX_AUTO_PRESS(30, 30),
{ 0x2e, 0x15, 0x0001, 0x00000000, 0x00000000, NULL },
{ 0x34, 0x00, 0x0001, 0x00000000, 0x00000000, _(" Tickle, tickle, tickle.") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
WAIT(30),
{ 0x34, 0x00, -0x0001, 0x00000000, 0x00000000, _(" ............") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
WAIT(10),
{ 0xe4, 0x00, 0x0006, 0x00000000, 0x00000000, NULL },
WAIT(10),
{ 0x2b, 0x00, 0x0000, 0x0000001e, 0x0000001e, NULL },
TEXTBOX_AUTO_PRESS(30, 30),
{ 0x34, 0x00, 0x0001, 0x00000000, 0x00000000, _(" Tickle, tickle, tickle, tickle,\ntickle, tickle.") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
WAIT(30),
{ 0x34, 0x00, -0x0001, 0x00000000, 0x00000000, _(" ....................................") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
WAIT(10),
{ 0xe4, 0x00, 0x0006, 0x00000000, 0x00000000, NULL },
WAIT(20),
{ 0x2b, 0x00, 0x0000, 0x00000014, 0x00000014, NULL },
TEXTBOX_AUTO_PRESS(20, 20),
{ 0x34, 0x00, 0x0001, 0x00000000, 0x00000000, _(" Tickle, tickle, tickle, tickle,\ntickle, tickle, tickle, tickle, tickle, tickle,\ntickle, tickle, tickle, tickle, tickle, tickle.") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
WAIT(30),
{ 0x34, 0x00, -0x0001, 0x00000000, 0x00000000, _(" ................................................\n............................................................\n............................................................") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
WAIT(10),
{ 0xe4, 0x00, 0x0006, 0x00000000, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, 0x0000001e, 0x0000001e, NULL },
TEXTBOX_AUTO_PRESS(30, 30),
{ 0x34, 0x00, 0x0001, 0x00000000, 0x00000000, _(" Tickle, tickle, tickle......") },
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
WAIT(10),
{ 0xe4, 0x00, 0x0006, 0x00000000, 0x00000000, NULL },
{ 0xe3, 0x00, 0x0005, 0x00000000, 0x00000000, NULL },
@@ -417,14 +417,14 @@ static const struct ScriptCommand s_gs192_g2_s0_lives0_dlg0[] = { /* 0x823ef68 *
{ 0x91, 0x05, 0x0002, 0x00000003, 0x00000000, NULL },
{ 0xe3, 0x00, 0x0005, 0x00000000, 0x00000000, NULL },
WAIT(30),
{ 0x2b, 0x00, 0x0000, 0x0000002d, 0x0000003c, NULL },
TEXTBOX_AUTO_PRESS(45, 60),
{ 0x2e, 0x03, 0x0001, 0x00000003, 0x00000000, NULL },
MSG_VAR(2, PARTNER_TALK_KIND, 1),
VARIANT(/* == */ 1, _(" All right. Counting down.{WAIT_PRESS}\nThree...{WAIT_PRESS} Two...{WAIT_PRESS} One...{WAIT_PRESS} Now...!")),
VARIANT_DEFAULT(_(" OK. Counting down.{WAIT_PRESS}\nThree...{WAIT_PRESS} Two...{WAIT_PRESS} One...{WAIT_PRESS} Now...!")),
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
WAIT(10),
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
{ 0xe4, 0x00, 0x0007, 0x00000000, 0x00000000, NULL },
WAIT(10),
{ 0x36, 0x00, -0x0001, 0x00000000, 0x00000000, _("Kwaaaaaaaaah!") },

View File

@@ -405,7 +405,7 @@ static const struct ScriptCommand s_gs209_g3_s0_station_sref_script[] = { /* 0x8
{ 0x28, 0x01, 0x0005, 0x0000003c, 0x00ffffff, NULL },
WAIT(120),
{ 0x31, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
WAIT(240),
RET,
};
@@ -419,7 +419,7 @@ static const struct ScriptCommand s_gs209_g3_s0_lives0_dlg0[] = { /* 0x8263a7c *
{ 0xdf, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
WAIT(30),
WAIT(30),
{ 0x2b, 0x00, 0x0000, 0x0000000f, 0x0000000f, NULL },
TEXTBOX_AUTO_PRESS(15, 15),
{ 0x2e, 0x02, 0x0001, 0x0000000c, 0x00000000, NULL },
{ 0x34, 0x00, 0x0001, 0x00000000, 0x00000000, _(" Waaaaaaaaaaaaaaaaaah!") },
{ 0xe4, 0x00, 0x0003, 0x00000000, 0x00000000, NULL },

View File

@@ -140,7 +140,7 @@ static const struct ScriptCommand s_gs216_g1_s0_lives0_dlg0[] = { /* 0x8267cc8 *
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
WAIT(10),
BGM_SWITCH(35),
{ 0x2b, 0x00, 0x0000, 0x0000003c, 0x0000003c, NULL },
TEXTBOX_AUTO_PRESS(60, 60),
{ 0x34, 0x00, -0x0001, 0x00000000, 0x00000000, _(" ............{WAIT_PRESS}Is it{WAIT_PRESS} \nyou...?") },
{ 0x34, 0x00, -0x0001, 0x00000000, 0x00000000, _(" ......Who...disturbs...my sleep...{WAIT_PRESS}\nIs it{WAIT_PRESS} you?!\n") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
@@ -154,7 +154,7 @@ static const struct ScriptCommand s_gs216_g1_s0_lives0_dlg0[] = { /* 0x8267cc8 *
WAIT(15),
{ 0x92, 0x04, 0x0002, 0x00000005, 0x00000000, NULL },
WAIT(30),
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
{ 0x34, 0x00, 0x0000, 0x00000000, 0x00000000, _(" Wh-who's there?!") },
{ 0x34, 0x00, 0x0000, 0x00000000, 0x00000000, _(" Who are you?!{WAIT_PRESS}\nShow yourself!") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
@@ -162,7 +162,7 @@ static const struct ScriptCommand s_gs216_g1_s0_lives0_dlg0[] = { /* 0x8267cc8 *
FANFARE_PLAY2(453),
{ 0x97, 0x00, 0x0001, 0x00000000, 0x00000000, NULL },
WAIT(60),
{ 0x2b, 0x00, 0x0000, 0x0000005a, 0x0000005a, NULL },
TEXTBOX_AUTO_PRESS(90, 90),
{ 0x34, 0x00, -0x0001, 0x00000000, 0x00000000, _(" Me...?") },
{ 0x34, 0x00, -0x0001, 0x00000000, 0x00000000, _(" I was...{WAIT_PRESS}\nEngineered...") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
@@ -188,7 +188,7 @@ static const struct ScriptCommand s_gs216_g1_s0_lives0_dlg0[] = { /* 0x8267cc8 *
BGM_SWITCH(11),
{ 0x27, 0x01, 0x0001, 0x00000005, 0x00ffffff, NULL },
{ 0x23, 0x01, 0x000a, 0x00000000, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, 0x00000078, 0x00000078, NULL },
TEXTBOX_AUTO_PRESS(120, 120),
{ 0x39, 0x00, 0x001e, 0x00000000, 0x00000000, _("{CENTER_ALIGN}The most powerful of all Pokémon!") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
WAIT(1),
@@ -198,7 +198,7 @@ static const struct ScriptCommand s_gs216_g1_s0_lives0_dlg0[] = { /* 0x8267cc8 *
{ 0xe4, 0x00, 0x0006, 0x00000000, 0x00000000, NULL },
WAIT(60),
{ 0x28, 0x01, 0x0005, 0x00000078, 0x00ffffff, NULL },
{ 0x2b, 0x00, 0x0000, 0x0000003c, 0x0000003c, NULL },
TEXTBOX_AUTO_PRESS(60, 60),
{ 0x2e, 0x02, 0x0000, 0x00000003, 0x00000000, NULL },
FANFARE_PLAY2(877),
{ 0x34, 0x00, 0x0000, 0x00000000, 0x00000000, _(" Gwaaaaaaaaaaaah!") },
@@ -208,7 +208,7 @@ static const struct ScriptCommand s_gs216_g1_s0_lives0_dlg0[] = { /* 0x8267cc8 *
FANFARE_PLAY2(877),
{ 0x34, 0x00, 0x0001, 0x00000000, 0x00000000, _(" Gyaaaaaaaah!") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
BGM_FADEOUT(60),
WAIT(60),
{ 0xe4, 0x00, 0x0003, 0x00000000, 0x00000000, NULL },

View File

@@ -5995,11 +5995,11 @@ static const struct ScriptCommand s_gs1_g23_s0_lives0_dlg0[] = { /* 0x814dc14 */
{ 0x91, 0x04, 0x000a, 0x00000002, 0x00000000, NULL },
{ 0xe4, 0x00, 0x000f, 0x00000000, 0x00000000, NULL },
WAIT(15),
{ 0x2b, 0x00, 0x0000, 0x000000d2, 0x000000d2, NULL },
TEXTBOX_AUTO_PRESS(210, 210),
{ 0x2e, 0x03, 0x0009, -0x00000002, 0x00000000, NULL },
{ 0x34, 0x00, 0x0009, 0x00000000, 0x00000000, _(" Extra! Extra!\nRead all about it!") },
{ 0x31, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
{ 0x91, 0x0a, 0x000a, 0x00000003, 0x00000000, NULL },
{ 0xe3, 0x00, 0x0005, 0x00000000, 0x00000000, NULL },
WAIT(20),

View File

@@ -499,7 +499,7 @@ static const struct ScriptCommand s_gs4_g1_s1_lives0_dlg0[] = { /* 0x818b710 */
{ 0xe3, 0x00, 0x0005, 0x00000000, 0x00000000, NULL },
{ 0x34, 0x00, 0x0002, 0x00000000, 0x00000000, _(" Get set!") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
TEXTBOX_AUTO_PRESS(0, 0),
WAIT(10),
{ 0xe4, 0x00, 0x0007, 0x00000000, 0x00000000, NULL },
{ 0xe3, 0x00, 0x0005, 0x00000000, 0x00000000, NULL },
@@ -542,7 +542,7 @@ static const struct ScriptCommand s_gs4_g1_s1_lives0_dlg0[] = { /* 0x818b710 */
{ 0xe4, 0x00, 0x0007, 0x00000000, 0x00000000, NULL },
{ 0xe3, 0x00, 0x0005, 0x00000000, 0x00000000, NULL },
WAIT(30),
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
{ 0xe4, 0x00, 0x0008, 0x00000000, 0x00000000, NULL },
{ 0x34, 0x00, 0x0003, 0x00000000, 0x00000000, _(" Papa!") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
@@ -2207,7 +2207,7 @@ static const struct ScriptCommand s_gs4_g20_s1_lives1_dlg0[] = { /* 0x81929a0 */
{ 0x34, 0x00, 0x0002, 0x00000000, 0x00000000, _(" ..................{WAIT_PRESS}\nWell, Son...{WAIT_PRESS}\nThe three of us cooperate, and...") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
WAIT(10),
{ 0x2b, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
TEXTBOX_AUTO_PRESS(0, 0),
{ 0xe4, 0x00, 0x0007, 0x00000000, 0x00000000, NULL },
{ 0xe3, 0x00, 0x0005, 0x00000000, 0x00000000, NULL },
{ 0x2e, 0x07, 0x0002, 0x00000000, 0x00000000, NULL },
@@ -2238,13 +2238,13 @@ static const struct ScriptCommand s_gs4_g20_s1_lives1_dlg0[] = { /* 0x81929a0 */
{ 0xe4, 0x00, 0x0006, 0x00000000, 0x00000000, NULL },
{ 0xe4, 0x00, 0x0008, 0x00000000, 0x00000000, NULL },
{ 0x93, 0x04, 0x000a, 0x00000042, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, 0x0000001e, 0x0000001e, NULL },
TEXTBOX_AUTO_PRESS(30, 30),
{ 0x2e, 0x07, 0x0002, 0x00000000, 0x00000000, NULL },
{ 0x34, 0x00, 0x0002, 0x00000000, 0x00000000, _(" Hah!") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
{ 0xe4, 0x00, 0x0007, 0x00000000, 0x00000000, NULL },
{ 0xe3, 0x00, 0x0005, 0x00000000, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
{ 0x2e, 0x02, 0x0002, 0x00000000, 0x00000000, NULL },
{ 0x34, 0x00, 0x0002, 0x00000000, 0x00000000, _(" ...And that's sort of how\nwe swim!{WAIT_PRESS}\nGasp, gasp...") },
{ 0x34, 0x00, 0x0002, 0x00000000, 0x00000000, _(" What do you...{WAIT_PRESS}\nTake us for?!{WAIT_PRESS}\nGasp, gasp...") },
@@ -2466,7 +2466,7 @@ static const struct ScriptCommand s_gs4_g21_s1_lives0_dlg0[] = { /* 0x8193870 */
{ 0x34, 0x00, 0x0002, 0x00000000, 0x00000000, _(" What do you...{WAIT_PRESS}\nTake us for?!") },
{ 0x34, 0x00, 0x0002, 0x00000000, 0x00000000, _(" If we were in charge...{WAIT_PRESS}\nThis is what we'd do to any earthquake!") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
TEXTBOX_AUTO_PRESS(0, 0),
{ 0xe4, 0x00, 0x0007, 0x00000000, 0x00000000, NULL },
{ 0xe3, 0x00, 0x0005, 0x00000000, 0x00000000, NULL },
{ 0x2e, 0x02, 0x0002, 0x00000000, 0x00000000, NULL },
@@ -2497,13 +2497,13 @@ static const struct ScriptCommand s_gs4_g21_s1_lives0_dlg0[] = { /* 0x8193870 */
{ 0xe4, 0x00, 0x0006, 0x00000000, 0x00000000, NULL },
{ 0xe4, 0x00, 0x0008, 0x00000000, 0x00000000, NULL },
{ 0x93, 0x04, 0x000a, 0x00000042, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, 0x0000001e, 0x0000001e, NULL },
TEXTBOX_AUTO_PRESS(30, 30),
{ 0x2e, 0x08, 0x0002, 0x00000000, 0x00000000, NULL },
{ 0x34, 0x00, 0x0002, 0x00000000, 0x00000000, _(" Hah!") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
{ 0xe4, 0x00, 0x0007, 0x00000000, 0x00000000, NULL },
{ 0xe3, 0x00, 0x0005, 0x00000000, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
{ 0x2e, 0x02, 0x0002, 0x00000000, 0x00000000, NULL },
{ 0x34, 0x00, 0x0002, 0x00000000, 0x00000000, _(" Gasp, gasp...") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
@@ -2722,13 +2722,13 @@ static const struct ScriptCommand s_gs4_g22_s1_lives0_dlg0[] = { /* 0x81947b4 */
{ 0x34, 0x00, 0x0002, 0x00000000, 0x00000000, _(" If we were in charge...{WAIT_PRESS}\nThis is what we'd do to the {COLOR YELLOW_D}Magma\nCavern{RESET}!{WAIT_PRESS} Hah!") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
WAIT(30),
{ 0x2b, 0x00, 0x0000, 0x0000000a, 0x0000000a, NULL },
TEXTBOX_AUTO_PRESS(10, 10),
{ 0x34, 0x00, 0x0002, 0x00000000, 0x00000000, _(" Hah!") },
{ 0x30, 0x00, 0x0000, 0x00000000, 0x00000000, NULL },
FANFARE_PLAY2(486),
{ 0xe4, 0x00, 0x0007, 0x00000000, 0x00000000, NULL },
{ 0xe3, 0x00, 0x0005, 0x00000000, 0x00000000, NULL },
{ 0x2b, 0x00, 0x0000, -0x00000001, -0x00000001, NULL },
TEXTBOX_AUTO_PRESS(-1, -1),
{ 0x34, 0x00, 0x0003, 0x00000000, 0x00000000, _(" ............") },
{ 0x34, 0x00, 0x0003, 0x00000000, 0x00000000, _(" ........................") },
{ 0x34, 0x00, 0x0003, 0x00000000, 0x00000000, _(" ....................................{WAIT_PRESS}Huh?{WAIT_PRESS}\nPapa?{WAIT_PRESS} Where did you go, Papa?") },

View File

@@ -46,7 +46,7 @@ UNUSED static void DebugMapViewer(void)
sub_8099648();
sub_809975C();
sub_809D0AC();
sub_8014144();
ResetDialogueBox();
sub_8005838(NULL, 0);
AllocGroundMapAction();
while (1) {

View File

@@ -234,7 +234,7 @@ void xxx_draw_string_80524F0(void)
const u8 *txtPtr = strPtr->unk0[id];
sp.x = 4;
sp.unk2 = strPtr->unk1C066;
sp.y = strPtr->unk1C066;
sp.unk10 = 7;
sub_80073B8(0);
if (strPtr->unk1C054[id] != 0 && strPtr->unk1C066 >= 8) {
@@ -250,7 +250,7 @@ void xxx_draw_string_80524F0(void)
sp.x += 6;
}
else {
sp.x += DrawCharOnWindow(sp.x, sp.unk2, currChr, sp.unk10, 0);
sp.x += DrawCharOnWindow(sp.x, sp.y, currChr, sp.unk10, 0);
}
}
sub_80073E0(0);

View File

@@ -64,7 +64,6 @@ extern u16 gUnknown_2026E4E;
extern void GroundSprite_Reset(s32);
extern s16 sub_8098FCC(u32 unused);
extern s16 sub_80A2654(s16 r0);
extern void sub_809A71C(s32);
extern bool8 sub_809AFAC(void);
extern bool8 sub_80048BC(void);
extern u8 sub_80023E4(u32);
@@ -206,7 +205,7 @@ u32 xxx_script_related_8098468(s32 param_1)
gUnknown_20398C4 = -1;
r7 = -1;
while (gUnknown_20398A8 - 1 <= 1) {
sub_809A71C(-1);
SetAutoPressTextboxFrames(-1);
ScriptClearTextbox();
sub_809977C();
switch (gUnknown_20398B4) {

View File

@@ -83,7 +83,6 @@ void sub_80973A8(s16, bool8);
void sub_80975A8(s16, bool8);
u32 sub_809A6E4();
u32 sub_809A6F8();
u32 sub_809A738();
u32 sub_809A768();
u32 sub_809AC7C();
u32 sub_809ADD8();
@@ -1845,7 +1844,7 @@ s32 ExecuteScriptCommand(Action *action)
break;
}
case 0x2b: {
sub_809A738(curCmd.arg1, curCmd.arg2);
SetAutoPressTextboxMidEndMsgFrames(curCmd.arg1, curCmd.arg2);
break;
}
case 0x2c: {

View File

@@ -132,7 +132,7 @@ void GameLoop(void)
NDS_DebugInit();
ResetSoundEffectCounters();
NDS_LoadOverlay_GroundMain();
sub_8014144();
ResetDialogueBox();
LoadMonsterParameters();
sub_8097670();
InitializePlayTime();
@@ -356,7 +356,7 @@ static void QuickSave_Async(u32 mode)
saveStatus = 0;
counter = 0;
UpdateFadeInTile(0);
sub_8014144();
ResetDialogueBox();
InitFontPalette();
sub_800CDA8(2);
sub_80095CC(0, 20);
@@ -467,7 +467,7 @@ static void sub_80008C0_Async(u32 errorKind)
s32 counter = 0;
UpdateFadeInTile(0);
sub_8014144();
ResetDialogueBox();
InitFontPalette();
sub_800CDA8(2);
sub_80095CC(0, 20);
@@ -888,7 +888,7 @@ static void LoadAndRunQuickSaveDungeon_Async(DungeonSetupStruct *setupStr)
sUnknown_203B03C = 1;
sub_800A8F8(3);
sub_8014144();
ResetDialogueBox();
sub_8043D50(&local_1c, &dungeonStructSize);
setupStr->info.unk74 = MemoryAlloc(local_1c, 7); // size: 0x4800

View File

@@ -83,14 +83,14 @@ static EWRAM_DATA SpriteOAM sDialogueBoxArrowSprite = {0};
// 't' - team name. This buffer seems wastefully large, given team name can be max 10(or so) characters.
static EWRAM_DATA u8 sFormatBuffer_TeamName[FORMAT_BUFFER_LEN] = {0};
static EWRAM_DATA s32 gUnknown_202E738 = 0;
static EWRAM_DATA s32 gUnknown_202E73C = 0;
static EWRAM_DATA s32 gUnknown_202E740 = 0;
static EWRAM_DATA s32 sAutoPressNewTextboxFrames = 0;
static EWRAM_DATA s32 sAutoPressMidTextboxFrames = 0;
static EWRAM_DATA s32 sAutoPressFramesEndMsg = 0;
static EWRAM_DATA s32 sPrintStringState = 0;
static EWRAM_DATA UnkDrawStringStruct sTextPrintStruct = {0};
static EWRAM_DATA u16 sStringFormatFlags = 0;
static EWRAM_DATA s32 gUnknown_202E780 = 0;
static EWRAM_DATA s32 gUnknown_202E784 = 0;
static EWRAM_DATA s32 sAutoPressFrames = 0;
static EWRAM_DATA s32 sDialoguePrintFrames = 0;
static EWRAM_DATA s32 sTextPrintSpeed = 0;
static EWRAM_DATA s32 sFramesBetweenCharPrints = 0;
static EWRAM_DATA bool8 sInstantText = FALSE;
@@ -144,25 +144,40 @@ static EWRAM_INIT WindowTemplates sUnknown_203B198 = {
}
};
void sub_8014144(void)
enum
{
sPrintStringState = 0;
gUnknown_202E738 = 60;
gUnknown_202E73C = 60;
gUnknown_202E740 = 0;
STATE_FINISHED,
STATE_PRINT_CHAR,
STATE_PRINT_CHAR_SOUND_WAIT,
STATE_PRINT_FINISHED_MENU,
STATE_4,
STATE_5,
STATE_PRINT_FINISHED,
// These 3 are the same
STATE_WAIT_FOR_BUTTON_MID_TEXTBOX,
STATE_WAIT_FOR_BUTTON_NEW_TEXTBOX,
STATE_WAIT_FOR_BUTTON_PRESS_END_MSG,
};
void ResetDialogueBox(void)
{
sPrintStringState = STATE_FINISHED;
sAutoPressNewTextboxFrames = 60;
sAutoPressMidTextboxFrames = 60;
sAutoPressFramesEndMsg = 0;
}
void sub_801416C(s32 param_1,s32 param_2)
void SetDialogueBoxAutoPressFrames(s32 endMsgFrames, s32 midMsgFrames)
{
if (param_1 < -1) {
gUnknown_202E738 = param_2;
gUnknown_202E740 = -param_1;
if (endMsgFrames < -1) {
sAutoPressNewTextboxFrames = midMsgFrames;
sAutoPressFramesEndMsg = -endMsgFrames;
}
else {
gUnknown_202E738 = param_1;
gUnknown_202E740 = 0;
sAutoPressNewTextboxFrames = endMsgFrames;
sAutoPressFramesEndMsg = 0;
}
gUnknown_202E73C = (param_2 < 0 ) ? 0 : param_2;
sAutoPressMidTextboxFrames = (midMsgFrames < 0 ) ? 0 : midMsgFrames;
}
void CreateDialogueBoxAndPortrait(const u8 *text, void *param_2, MonPortraitMsg *monPortraitPtr, u16 flags)
@@ -180,12 +195,9 @@ void CreateYesNoDialogueBoxAndPortrait_DefaultNo(const u8 *text, MonPortraitMsg
CreateMenuDialogueBoxAndPortrait(text, NULL, -1, sYesNoMenuItems_DefaultNo, NULL, 3, 0, monPortraitPtr, flags | 0x300);
}
enum
{
STATE_FINISHED,
STATE_PRINT_CHAR,
STATE_PRINT_CHAR_SOUND_WAIT,
};
#define TEXTBOX_LINE_HEIGHT 11
#define TEXTBOX_HEIGHT ((TEXTBOX_LINE_HEIGHT * 3) + 1)
#define TEXTBOX_OUT_OF_SPACE(y)(y > TEXTBOX_HEIGHT)
// arm9.bin::0201D700
void CreateMenuDialogueBoxAndPortrait(const u8 *text, void *a1, u32 r9, const MenuItem *menuItems, void *arg_0, u32 a5, u32 unknownUnused, MonPortraitMsg *monPortraitPtr, u16 flags)
@@ -237,12 +249,12 @@ void CreateMenuDialogueBoxAndPortrait(const u8 *text, void *a1, u32 r9, const Me
ResetUnusedInputStruct();
ShowWindows(&sUnknown_203B198, TRUE, TRUE);
sTextPrintStruct.x = 4;
sTextPrintStruct.unk2 = 4;
sTextPrintStruct.y = 4;
sTextPrintStruct.unk8 = 0x70;
sTextPrintStruct.unkA = (gWindows[0].y * 8) + 34;
sTextPrintStruct.unkA = (gWindows[0].y * 8) + TEXTBOX_HEIGHT;
sTextPrintStruct.unk10 = 7;
sTextPrintStruct.unk1C = 0;
sTextPrintStruct.unk20 = 0;
sTextPrintStruct.waitButtonPress = 0;
SetCharacterMask((flags & 0x10) ? 8 : 3);
sPrintStringState = 1;
sStringFormatFlags = flags;
@@ -260,7 +272,7 @@ void CreateMenuDialogueBoxAndPortrait(const u8 *text, void *a1, u32 r9, const Me
sFramesBetweenCharPrints = 1;
UnpressButtons();
sArrowFrames = 0;
gUnknown_202E784 = 0;
sDialoguePrintFrames = 0;
if (portraitOn) {
const u8 *data = monPortraitPtr->faceData->sprites[monPortraitPtr->spriteId].gfx;
@@ -294,7 +306,7 @@ void DrawDialogueBoxString(void)
{
bool8 keepLooping = TRUE;
gUnknown_202E784++;
sDialoguePrintFrames++;
while (keepLooping) {
switch (sPrintStringState) {
case STATE_FINISHED: {
@@ -315,17 +327,17 @@ void DrawDialogueBoxString(void)
sub_80073B8(0);
while (txtSpeed > 0) {
str = HandleSpecialCharFormat(str, &sTextPrintStruct);
if (sTextPrintStruct.unk21 != 0) {
if (sTextPrintStruct.waitFrames) {
break;
}
if (sTextPrintStruct.unk20 != 0) {
if (sTextPrintStruct.unk2 > 34) {
sPrintStringState = 8;
gUnknown_202E780 = gUnknown_202E738;
if (sTextPrintStruct.waitButtonPress) {
if (TEXTBOX_OUT_OF_SPACE(sTextPrintStruct.y)) {
sPrintStringState = STATE_WAIT_FOR_BUTTON_NEW_TEXTBOX;
sAutoPressFrames = sAutoPressNewTextboxFrames;
}
else {
sPrintStringState = 7;
gUnknown_202E780 = gUnknown_202E73C;
sPrintStringState = STATE_WAIT_FOR_BUTTON_MID_TEXTBOX;
sAutoPressFrames = sAutoPressMidTextboxFrames;
}
sArrowFrames = 0;
break;
@@ -336,28 +348,28 @@ void DrawDialogueBoxString(void)
if (*str == '\r' || *str == '\n') {
sTextPrintStruct.x = 4;
sTextPrintStruct.unk2 += 11;
sTextPrintStruct.y += TEXTBOX_LINE_HEIGHT;
str++;
}
else {
u32 chr;
str = GetNextCharFromStr(str, &chr);
sTextPrintStruct.x += DrawCharOnWindow(sTextPrintStruct.x, sTextPrintStruct.unk2, chr, sTextPrintStruct.unk10, 0);
sTextPrintStruct.x += DrawCharOnWindow(sTextPrintStruct.x, sTextPrintStruct.y, chr, sTextPrintStruct.unk10, 0);
sTextPrintStruct.framesToWait = sFramesBetweenCharPrints;
}
if (sTextPrintStruct.unk2 > 34) {
if (TEXTBOX_OUT_OF_SPACE(sTextPrintStruct.y)) {
if (!(sStringFormatFlags & 0x10)) {
sTextPrintStruct.unk1C = 0;
sTextPrintStruct.unk20 = 1;
sPrintStringState = 8;
sTextPrintStruct.waitButtonPress = TRUE;
sPrintStringState = STATE_WAIT_FOR_BUTTON_NEW_TEXTBOX;
sArrowFrames = 0;
gUnknown_202E780 = gUnknown_202E738;
sAutoPressFrames = sAutoPressNewTextboxFrames;
break;
}
else {
sTextPrintStruct.unk2 = 4;
sTextPrintStruct.y = 4;
}
}
txtSpeed--;
@@ -367,20 +379,20 @@ void DrawDialogueBoxString(void)
ResetTouchScreenMenuInput(&sDialogueMenuTouchScreenInput);
if (*sCurrStr == '\0') {
if (sDialogueMenuItems != NULL) {
sPrintStringState = 3;
sPrintStringState = STATE_PRINT_FINISHED_MENU;
}
else {
sPrintStringState = 6;
sPrintStringState = STATE_PRINT_FINISHED;
}
keepLooping = FALSE;
}
else {
sTextPrintStruct.currFrames = 0;
if (sTextPrintStruct.unk20 != 0) {
if (sPrintStringState == 1) {
if (sTextPrintStruct.waitButtonPress) {
if (sPrintStringState == STATE_PRINT_CHAR) {
sPrintStringState = 7;
sArrowFrames = 0;
gUnknown_202E780 = gUnknown_202E738;
sAutoPressFrames = sAutoPressNewTextboxFrames;
}
keepLooping = FALSE;
}
@@ -403,26 +415,26 @@ void DrawDialogueBoxString(void)
if (++sTextPrintStruct.currFrames > sTextPrintStruct.framesToWait) {
sPrintStringState = STATE_PRINT_CHAR;
sTextPrintStruct.unk21 = 0;
sTextPrintStruct.waitFrames = FALSE;
}
else {
keepLooping = FALSE;
}
}
break;
case 6: {
if (sStringFormatFlags & 0x100) {
sPrintStringState = 9;
case STATE_PRINT_FINISHED: {
if (sStringFormatFlags & STR_FORMAT_FLAG_WAIT_FOR_BUTTON_PRESS) {
sPrintStringState = STATE_WAIT_FOR_BUTTON_PRESS_END_MSG;
sArrowFrames = 0;
if (gUnknown_202E740 > 0) {
gUnknown_202E780 = gUnknown_202E740 - gUnknown_202E784;
if (gUnknown_202E780 < 0) {
if (sAutoPressFramesEndMsg > 0) {
sAutoPressFrames = sAutoPressFramesEndMsg - sDialoguePrintFrames;
if (sAutoPressFrames < 0) {
sPrintStringState = 11;
gUnknown_202E780 = 0;
sAutoPressFrames = 0;
}
}
else {
gUnknown_202E780 = gUnknown_202E738;
sAutoPressFrames = sAutoPressNewTextboxFrames;
}
}
else {
@@ -430,19 +442,19 @@ void DrawDialogueBoxString(void)
}
}
break;
case 7:
case 8:
case 9: {
case STATE_WAIT_FOR_BUTTON_MID_TEXTBOX:
case STATE_WAIT_FOR_BUTTON_NEW_TEXTBOX:
case STATE_WAIT_FOR_BUTTON_PRESS_END_MSG: {
bool8 buttonPress = FALSE;
sTextPrintStruct.unk20 = 0;
sTextPrintStruct.waitButtonPress = 0;
GetTouchScreenMenuInput(&sDialogueMenuTouchScreenInput, 0);
if (!(sStringFormatFlags & 1)) {
if (!(sStringFormatFlags & STR_FORMAT_FLAG_WAIT_FOR_BUTTON_PRESS_2)) {
buttonPress = TRUE;
}
else {
if (sStringFormatFlags & 2) {
if (gUnknown_202E780 > 0) {
gUnknown_202E780--;
if (sStringFormatFlags & STR_FORMAT_FLAG_TIMED_AUTO_MSG_CLOSE) {
if (sAutoPressFrames > 0) {
sAutoPressFrames--;
}
else {
buttonPress = TRUE;
@@ -461,7 +473,7 @@ void DrawDialogueBoxString(void)
if (!buttonPress) {
sArrowFrames++;
if (!(sStringFormatFlags & 0x2) && sArrowFrames & 8) {
if (!(sStringFormatFlags & STR_FORMAT_FLAG_TIMED_AUTO_MSG_CLOSE) && sArrowFrames & 8) {
SpriteSetAffine1(&sDialogueBoxArrowSprite, 0);
SpriteSetAffine2(&sDialogueBoxArrowSprite, 0);
SpriteSetObjMode(&sDialogueBoxArrowSprite, 0);
@@ -483,7 +495,7 @@ void DrawDialogueBoxString(void)
SpriteSetX(&sDialogueBoxArrowSprite, sTextPrintStruct.unk8);
}
AddSprite(&sDialogueBoxArrowSprite, 0x100, NULL, NULL);
AddSprite(&sDialogueBoxArrowSprite, 256, NULL, NULL);
}
}
else {
@@ -495,8 +507,8 @@ void DrawDialogueBoxString(void)
}
else if (sPrintStringState == 8) {
sTextPrintStruct.x = 4;
if (sTextPrintStruct.unk2 > 34) {
sTextPrintStruct.unk2 = 4;
if (TEXTBOX_OUT_OF_SPACE(sTextPrintStruct.y)) {
sTextPrintStruct.y = 4;
if (sStringFormatFlags & 0x10) {
CallPrepareTextbox_8008C54(0);
sPrintStringState = 1;
@@ -519,7 +531,7 @@ void DrawDialogueBoxString(void)
}
sTextPrintStruct.unk8 = 0x70;
sTextPrintStruct.unkA = (gWindows[0].y * 8) + 34;
sTextPrintStruct.unkA = (gWindows[0].y * 8) + TEXTBOX_HEIGHT;
}
keepLooping = FALSE;
}
@@ -537,15 +549,15 @@ void DrawDialogueBoxString(void)
if (sStringFormatFlags & 0x200) {
ResetUnusedInputStruct();
ShowWindows(NULL, TRUE, TRUE);
sPrintStringState = 0;
sPrintStringState = STATE_FINISHED;
}
else {
sPrintStringState = 0;
sPrintStringState = STATE_FINISHED;
}
keepLooping = FALSE;
}
break;
case 3: {
case STATE_PRINT_FINISHED_MENU: {
sub_8014A88();
sPrintStringState = 4;
keepLooping = FALSE;

View File

@@ -174,7 +174,7 @@ static void DrawStringInternal(Window *windows, s32 x, s32 y, const u8 *str, u32
u32 currChr;
sp.x = x;
sp.unk2 = y;
sp.y = y;
sp.unkC = x;
sp.unk10 = 7;
while (TRUE) {
@@ -194,17 +194,17 @@ static void DrawStringInternal(Window *windows, s32 x, s32 y, const u8 *str, u32
}
else if (currChr == '\r' || currChr == '\n') {
sp.x = sp.unkC;
sp.unk2 += lineSpacing;
sp.y += lineSpacing;
}
else if (currChr == '\x1D') { // ASCII group separator.
sp.x = sp.unkC;
sp.unk2 += 5;
sp.y += 5;
}
else if (currChr == '`') {
sp.x += 6;
}
else if (characterSpacing == 0) {
sp.x += DrawCharOnWindowInternal(windows, sp.x, sp.unk2, currChr, sp.unk10, windowId);
sp.x += DrawCharOnWindowInternal(windows, sp.x, sp.y, currChr, sp.unk10, windowId);
}
else {
const unkChar *chrPtr = GetCharacter(currChr);
@@ -212,7 +212,7 @@ static void DrawStringInternal(Window *windows, s32 x, s32 y, const u8 *str, u32
s32 x = sp.x;
s32 x2 = gCharacterSpacing + 10;
x +=((x2 - chrPtr->width) / 2);
DrawCharOnWindowInternal(windows, x, sp.unk2, currChr, sp.unk10, windowId);
DrawCharOnWindowInternal(windows, x, sp.y, currChr, sp.unk10, windowId);
sp.x += characterSpacing;
}
}
@@ -265,7 +265,7 @@ static const u8 *HandleCharFormatInternal(Window *windows, const u8 *str, UnkDra
if (str[1] == '[') {
const u8 *strBefore = str;
str += 2;
sp->unk21 = 0;
sp->waitFrames = FALSE;
while (*str != '\0') {
if (*str == ']') {
str++;
@@ -279,7 +279,7 @@ static const u8 *HandleCharFormatInternal(Window *windows, const u8 *str, UnkDra
str = strNew;
}
if (sp->unk21 != 0)
if (sp->waitFrames)
break;
}
else if (str[1] == '=') {
@@ -289,7 +289,7 @@ static const u8 *HandleCharFormatInternal(Window *windows, const u8 *str, UnkDra
str++;
}
else if (str[1] == 'y') {
sp->unk2 = str[2];
sp->y = str[2];
str += 3;
if (*str == '.')
str++;
@@ -303,7 +303,7 @@ static const u8 *HandleCharFormatInternal(Window *windows, const u8 *str, UnkDra
}
else if (str[1] == 'n') {
sp->x = sp->unkC;
sp->unk2 += 11;
sp->y += 11;
str += 2;
}
else if (str[1] == ':') {
@@ -351,27 +351,27 @@ static const u8 *HandleCharFormatInternal(Window *windows, const u8 *str, UnkDra
else if (str[1] == 'W') {
str += 2;
sp->unk8 = ((windows[0].x * 8) + sp->x) - 2;
sp->unkA = ((windows[0].y * 8) + sp->unk2) + 3;
sp->unk20 = 1;
sp->unkA = ((windows[0].y * 8) + sp->y) + 3;
sp->waitButtonPress = TRUE;
break;
}
else if (str[1] == 'P') {
str += 2;
sp->unk2 = 9999;
sp->y = 9999;
sp->unk1C = 0;
sp->unk20 = 1;
sp->waitButtonPress = TRUE;
break;
}
else if (str[1] == 'p') {
str += 2;
sp->unk2 = 9999;
sp->y = 9999;
sp->unk1C = 1;
sp->unk20 = 1;
sp->waitButtonPress = TRUE;
break;
}
else if (str[1] == '~') {
sp->framesToWait = str[2];
sp->unk21 = 1;
sp->waitFrames = TRUE;
str += 3;
}
else {

View File

@@ -73,8 +73,8 @@ struct Textbox
{
// size: 0x5A8
u32 unk0;
u32 unk4;
u32 unk8;
s32 endMsgFrames;
s32 midMsgFrames;
struct TextboxText unkC;
u32 unk414;
const struct unkStruct_3001B64_unk418 *unk418;
@@ -213,7 +213,12 @@ void sub_809C414(void);
void sub_809C4B0(void);
void sub_809C550(void);
#define TEXTBOX_FLAG_INTANT_TEXT 0x20
#define TEXTBOX_FLAG_UNUSED_x2 0x2 // Unused, but set for almost all flag sets
#define TEXTBOX_FLAG_INSTANT_TEXT 0x20
// Both need to be set to wait for the player's button press. One flag would be sufficient in my opinion, but what can you do?
#define TEXTBOX_FLAG_WAIT_FOR_BUTTON_PRESS_2 0x40
#define TEXTBOX_FLAG_WAIT_FOR_BUTTON_PRESS 0x80
#define TEXTBOX_FLAG_SPEAKER 0x100 // Speaker's name + dialogue sound
#define TEXTBOX_FLAG_DIALOGUE_SOUND 0x200 // Only dialogue sound
@@ -275,10 +280,10 @@ static const u32 sTextboxTypes[] =
static const u16 sFlagSets[] =
{
0x02 | 0x40 | 0x80 | TEXTBOX_FLAG_INTANT_TEXT,
0x02 | 0x40 | 0x80,
0x02 | 0x40 | 0x80 | TEXTBOX_FLAG_SPEAKER,
0x02 | 0x40 | 0x80 | TEXTBOX_FLAG_DIALOGUE_SOUND,
TEXTBOX_FLAG_UNUSED_x2 | TEXTBOX_FLAG_WAIT_FOR_BUTTON_PRESS_2 | TEXTBOX_FLAG_WAIT_FOR_BUTTON_PRESS | TEXTBOX_FLAG_INSTANT_TEXT,
TEXTBOX_FLAG_UNUSED_x2 | TEXTBOX_FLAG_WAIT_FOR_BUTTON_PRESS_2 | TEXTBOX_FLAG_WAIT_FOR_BUTTON_PRESS,
TEXTBOX_FLAG_UNUSED_x2 | TEXTBOX_FLAG_WAIT_FOR_BUTTON_PRESS_2 | TEXTBOX_FLAG_WAIT_FOR_BUTTON_PRESS | TEXTBOX_FLAG_SPEAKER,
TEXTBOX_FLAG_UNUSED_x2 | TEXTBOX_FLAG_WAIT_FOR_BUTTON_PRESS_2 | TEXTBOX_FLAG_WAIT_FOR_BUTTON_PRESS | TEXTBOX_FLAG_DIALOGUE_SOUND,
0x01,
// These are effectively unused
0x121, 0x101, 0x10D, 0x105, 0
@@ -300,11 +305,11 @@ static void ResetTextbox(void);
void TextboxInit(void)
{
sub_8014144();
ResetDialogueBox();
sTextbox = MemoryAlloc(sizeof(struct Textbox), 6);
sTextbox->unk0 = 0;
sTextbox->unk4 = -1;
sTextbox->unk8 = -1;
sTextbox->endMsgFrames = -1;
sTextbox->midMsgFrames = -1;
gUnknown_20399DC = 0;
gUnknown_20399DE = 0;
sub_80095CC(0,0x14);
@@ -335,8 +340,8 @@ void sub_809A62C(void)
s32 index;
sTextbox->unk0 = 0;
sTextbox->unk4 = -1;
sTextbox->unk8 = -1;
sTextbox->endMsgFrames = -1;
sTextbox->midMsgFrames = -1;
gUnknown_20399DC = 0;
gUnknown_20399DE = 0;
for (index = 0; index < MAX_TEXTBOX_PORTRAITS; index++) {
@@ -393,18 +398,18 @@ UNUSED static void nullsub_209(void)
{
}
void sub_809A71C(s32 param_1)
void SetAutoPressTextboxFrames(s32 frames)
{
sTextbox->unk4 = param_1;
sTextbox->unk8 = param_1;
sub_801416C(param_1, param_1);
sTextbox->endMsgFrames = frames;
sTextbox->midMsgFrames = frames;
SetDialogueBoxAutoPressFrames(frames, frames);
}
void sub_809A738(s32 param_1, s32 param_2)
void SetAutoPressTextboxMidEndMsgFrames(s32 endMsgFrames, s32 midMsgFrames)
{
sTextbox->unk4 = param_1;
sTextbox->unk8 = param_2;
sub_801416C(param_1, param_2);
sTextbox->endMsgFrames = endMsgFrames;
sTextbox->midMsgFrames = midMsgFrames;
SetDialogueBoxAutoPressFrames(endMsgFrames, midMsgFrames);
}
u8 IsTextboxOpen_809A750(void)
@@ -889,7 +894,7 @@ void sub_809B028(const MenuItem * menuItems, s32 a1_, s32 a2, s32 a3, s32 a4_, c
CreateMenuDialogueBoxAndPortrait(text, sub_809B428, a2, menuItems, 0, 4, 0, GetSpeakerPortrait(a4),
((sFlagSets[a3] & TEXTBOX_FLAG_SPEAKER) ? STR_FORMAT_FLAG_SPEAKER_NAME | STR_FORMAT_FLAG_DIALOGUE_SOUND : 0)
| ((sFlagSets[a3] & TEXTBOX_FLAG_DIALOGUE_SOUND) ? STR_FORMAT_FLAG_DIALOGUE_SOUND : 0)
| ((sFlagSets[a3] & 0x20) ? 0x21 : 1)); // What an ugly way to get flags lol
| ((sFlagSets[a3] & TEXTBOX_FLAG_INSTANT_TEXT) ? STR_FORMAT_FLAG_INSTANT_TEXT | STR_FORMAT_FLAG_WAIT_FOR_BUTTON_PRESS_2 : STR_FORMAT_FLAG_WAIT_FOR_BUTTON_PRESS_2));
if (sTextbox->unk424 & 2) {
sub_809A6E4(1);
@@ -994,11 +999,11 @@ static bool8 ScriptPrintTextInternal(struct TextboxText *textboxText, u32 flags_
| ((flags & TEXTBOX_FLAG_DIALOGUE_SOUND) ? STR_FORMAT_FLAG_DIALOGUE_SOUND : 0)
| ((sTextbox->unk0 == 3) ? 0x10 : 0)
| ((sTextbox->unk0 == 2) ? 0x10 : 0)
| ((flags & TEXTBOX_FLAG_INTANT_TEXT) ? STR_FORMAT_FLAG_INSTANT_TEXT : 0)
| ((flags & 0x40) ? 0x1 : 0)
| ((flags & 0x80) ? 0x100 : 0)
| ((flags & TEXTBOX_FLAG_INSTANT_TEXT) ? STR_FORMAT_FLAG_INSTANT_TEXT : 0)
| ((flags & TEXTBOX_FLAG_WAIT_FOR_BUTTON_PRESS_2) ? STR_FORMAT_FLAG_WAIT_FOR_BUTTON_PRESS_2 : 0)
| ((flags & TEXTBOX_FLAG_WAIT_FOR_BUTTON_PRESS) ? STR_FORMAT_FLAG_WAIT_FOR_BUTTON_PRESS : 0)
| ((flags & 0x4) ? 0x200 : 0)
| ((sTextbox->unk4 != -1) ? 0x2 : 0)
| ((sTextbox->endMsgFrames != -1) ? STR_FORMAT_FLAG_TIMED_AUTO_MSG_CLOSE : 0)
);
return TRUE;