Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Press Start on the ending screen to reset the game #283

Open
wants to merge 5 commits into
base: nightly
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions levels/ending/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "make_const_nonconst.h"
#include "levels/ending/header.h"

#include "levels/intro/header.h"

const LevelScript level_ending_entry[] = {
/*0*/ INIT_LEVEL(),
/*1*/ LOAD_MIO0(/*seg*/ 0x07, _ending_segment_7SegmentRomStart, _ending_segment_7SegmentRomEnd),
Expand All @@ -31,7 +33,9 @@ const LevelScript level_ending_entry[] = {
/*12*/ TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_COLOR, /*time*/ 75, /*color*/ 0x00, 0x00, 0x00),
/*14*/ SLEEP(/*frames*/ 120),
/*15*/ CALL(/*arg*/ 0, /*func*/ lvl_play_the_end_screen_sound),
// L1:
/*17*/ SLEEP(/*frames*/ 1),
/*18*/ JUMP(level_ending_entry + 17),
// The following lines were added/altered to allow the player to reset
/*17*/ CALL_LOOP(/*arg*/ 1, /*func*/ credits_end_wait_for_reset),
/*18*/ TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 75, /*color*/ 0x00, 0x00, 0x00),
/*19*/ SLEEP(/*frames*/ 120),
/*20*/ EXECUTE(/*seg*/ 0x14, /*script*/ _introSegmentRomStart, /*scriptEnd*/ _introSegmentRomEnd, /*entry*/ level_intro_entry_2),
};
8 changes: 8 additions & 0 deletions src/game/level_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -1325,3 +1325,11 @@ s32 lvl_play_the_end_screen_sound(UNUSED s16 arg0, UNUSED s32 arg1) {
play_sound(SOUND_MENU_THANK_YOU_PLAYING_MY_GAME, gDefaultSoundArgs);
return 1;
}

// Added so the player can reset the game at the end screen
s32 credits_end_wait_for_reset() {
if (gPlayer1Controller->buttonPressed & START_BUTTON) {
return 1;
}
return 0;
}
2 changes: 2 additions & 0 deletions src/game/level_update.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,12 @@ void load_level_init_text(u32 arg);
s16 level_trigger_warp(struct MarioState *m, s32 warpOp);
void level_set_transition(s16 length, void (*updateFunction)(s16 *));


s32 lvl_init_or_update(s16 initOrUpdate, UNUSED s32 unused);
s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum);
s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum);
s32 lvl_play_the_end_screen_sound(UNUSED s16 arg0, UNUSED s32 arg1);
s32 credits_end_wait_for_reset();
void basic_update(UNUSED s16 *arg);

#endif // LEVEL_UPDATE_H