Skip to content

Commit

Permalink
Normal dialogue box for New game intro, instant Autorun message
Browse files Browse the repository at this point in the history
  • Loading branch information
Pseurae committed Oct 2, 2024
1 parent 8430dd6 commit 6b6805c
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 28 deletions.
25 changes: 10 additions & 15 deletions assembly/events/autorun.inc
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
.global EventScript_DisableAutoRun
.global EventScript_EnableAutoRun

EventScript_DisableAutoRun:
lockall
msgbox Text_DisableAutoRun, MSGBOX_AUTOCLOSE
releaseall
end

EventScript_EnableAutoRun:
lockall
msgbox Text_EnableAutoRun, MSGBOX_AUTOCLOSE
releaseall
.global EventScript_CloseAutorunMessage

EventScript_CloseAutorunMessage:
lockall
waitmessage
waitbuttonpress
callnative HideFieldMessageBoxInstant
releaseall
end

Text_DisableAutoRun:
Text_DisabledAutoRun:
.string "Autorun {COLOR RED}disabled{COLOR DARK_GREY}.$"

Text_EnableAutoRun:
Text_EnabledAutoRun:
.string "Autorun {COLOR GREEN}enabled{COLOR DARK_GREY}.$"
3 changes: 3 additions & 0 deletions config.asm
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
; New "Snakewood" logo
.definelabel NEW_TITLE_SCREEN, 1

; New Game speech uses the dialogue box instead of the normal menu box.
.definelabel BIRCH_SPEECH_DBOX, 1

; Bugfixes
; --------

Expand Down
3 changes: 1 addition & 2 deletions include/field_control_avatar.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ struct FieldInput
u8 input_field_3;
};

extern const u8 EventScript_DisableAutoRun[];
extern const u8 EventScript_EnableAutoRun[];
extern const u8 EventScript_CloseAutorunMessage[];
extern bool8 gAutorunEnabled;
1 change: 1 addition & 0 deletions linker/text.ld
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ Menu_PrintText = 0x8071e50 | 1;
Menu_EraseWindowRect = 0x8071e84 | 1;
Menu_BlankWindowRect = 0x8071ebc | 1;
Menu_DrawStdWindowFrame = 0x8071f08 | 1;
Menu_DisplayDialogueFrame = 0x8071ffc | 1;
Menu_PrintTextPixelCoords = 0x80729d8 | 1;
MenuPrint_RightAligned = 0x8072b4c | 1;
MenuPrint_Centered = 0x8072bd8 | 1;
Expand Down
1 change: 1 addition & 0 deletions main.asm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
.include "scripts/bugfixes/text_colors.asm"

.include "scripts/autorun.asm"
.include "scripts/birch_speech.asm"
.include "scripts/bag_expansion.asm"
.include "scripts/colored_field_moves.asm"
.include "scripts/colored_stats.asm"
Expand Down
73 changes: 73 additions & 0 deletions scripts/birch_speech.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
.if BIRCH_SPEECH_DBOX

.org 0x800A3A0
.area 0x800A3AC - 0x800A3A0, 0x0
bl 0x8071ffc
.endarea

.org 0x800A3AE
mov r1, #2
mov r2, #0xf

.org 0x800A3F6
mov r1, #2
mov r2, #0xf

.org 0x800A53C
mov r1, #2
mov r2, #0xf

.org 0x800a576
.area 0x800a582 - 0x800a576, 0x0
bl 0x8071ffc
.endarea

.org 0x800a584
mov r1, #2
mov r2, #0xf

.org 0x800a764
.area 0x800a770 - 0x800a764, 0x0
bl 0x8071ffc
.endarea

.org 0x800a772
mov r1, #2
mov r2, #0xf

.org 0x800a97c
.area 0x800a988 - 0x800a97c, 0x0
bl 0x8071ffc
.endarea

.org 0x800a98a
mov r1, #2
mov r2, #0xf

.org 0x800aaf4
.area 0x800ab00 - 0x800aaf4, 0x0
bl 0x8071ffc
.endarea

.org 0x800ab0c
mov r1, #2
mov r2, #0xf

.org 0x800ad08
.area 0x800ad14 - 0x800ad08, 0x0
bl 0x8071ffc
.endarea

.org 0x800ad20
mov r1, #2
mov r2, #0xf

.org 0x800aeaa
.area 0x800aeb6 - 0x800aeaa, 0x0
bl 0x8071ffc
.endarea

.org 0x800aeb8
mov r1, #2
mov r2, #0xf
.endif
27 changes: 17 additions & 10 deletions src/field_control_avatar.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "types.h"
#include "event_object_movement.h"
#include "field_control_avatar.h"
#include "field_message_box.h"
#include "field_player_avatar.h"
#include "flags.h"
#include "item_menu.h"
#include "main.h"
Expand All @@ -24,22 +26,27 @@ int ProcessPlayerFieldInput_Rest(struct FieldInput *input)
return FALSE;
}

#include "save_time_util.h"

static const u8 sText_DisabledAutorun[] = _("Autorun {COLOR RED}disabled{COLOR DARK_GREY}.");
static const u8 sText_EnabledAutorun[] =_("Autorun {COLOR GREEN}enabled{COLOR DARK_GREY}.");

static bool8 EnableAutoRun(void)
{
if (!FlagGet(FLAG_SYS_B_DASH))
return FALSE;

PlaySE(SE_SELECT);
if (gAutorunEnabled)
{
gAutorunEnabled = FALSE;
ScriptContext1_SetupScript(EventScript_DisableAutoRun);
}
else
{
gAutorunEnabled = TRUE;
ScriptContext1_SetupScript(EventScript_EnableAutoRun);
}

ScriptContext2_Enable();
FreezeObjectEvents();
PlayerFreeze();
StopPlayerAvatar();

gAutorunEnabled = !gAutorunEnabled;

ShowFieldMessageInstant(gAutorunEnabled ? sText_EnabledAutorun : sText_DisabledAutorun);
ScriptContext1_SetupScript(EventScript_CloseAutorunMessage);

return TRUE;
}
2 changes: 1 addition & 1 deletion src/field_message_box.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ void HideFieldMessageBoxInstant(void)

TextWindow_EraseDialogueFrame(&gFieldMessageBoxWindow);
sMessageBoxMode = FIELD_MESSAGE_BOX_HIDDEN;
}
}

0 comments on commit 6b6805c

Please sign in to comment.