Skip to content

Commit

Permalink
phase_pause: added the ability to pause during cutscenes
Browse files Browse the repository at this point in the history
  • Loading branch information
walkawayy committed Oct 24, 2024
1 parent ef4c040 commit 1f12866
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/tr1/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [Unreleased](https://github.com/LostArtefacts/TRX/compare/tr1-4.5.1...develop) - ××××-××-××
- added support for wading, similar to TR2+ (#1537)
- added the ability to pause during cutscenes (#1673)
- fixed missing pushblock SFX in Natla's Mines (#1714)
- improved enemy item drops by supporting the TR2+ approach of having drops defined in level data (#1713)
- improved Italian localization for the Config Tool
Expand Down
1 change: 1 addition & 0 deletions docs/tr1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ Not all options are turned on by default. Refer to `TR1X_ConfigTool.exe` for det
- added ability to wade, similar to TR2+
- added Lara's exit-water-to-medium-height animation from TR2+
- added a pause screen
- added the ability to pause during cutscenes
- added a choice whether to play NG or NG+ without having to play the entire game
- added Japanese mode (guns deal twice the damage, inspired by JP release of TR3); available for both NG and NG+
- added ability to restart level on death
Expand Down
13 changes: 13 additions & 0 deletions src/tr1/game/phase/phase_cutscene.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,19 @@ static PHASE_CONTROL M_Control(int32_t nframes)
Phase_Set(PHASE_PHOTO_MODE, args);
m_ExitingToPhotoMode = true;
return (PHASE_CONTROL) { .end = false };
} else if (g_InputDB.pause) {
PHASE_CUTSCENE_ARGS *const cutscene_args =
Memory_Alloc(sizeof(PHASE_CUTSCENE_ARGS));
cutscene_args->resume_existing = true;
cutscene_args->level_num = g_CurrentLevel;

PHASE_PHOTO_MODE_ARGS *const args =
Memory_Alloc(sizeof(PHASE_PHOTO_MODE_ARGS));
args->phase_to_return_to = PHASE_CUTSCENE;
args->phase_arg = cutscene_args;
Phase_Set(PHASE_PAUSE, args);
m_ExitingToPhotoMode = true;
return (PHASE_CONTROL) { .end = false };
}
}

Expand Down
22 changes: 15 additions & 7 deletions src/tr1/game/phase/phase_pause.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "game/music.h"
#include "game/output.h"
#include "game/overlay.h"
#include "game/phase/phase_photo_mode.h"
#include "game/requester.h"
#include "game/shell.h"
#include "game/sound.h"
Expand All @@ -31,7 +32,7 @@ typedef enum {

static STATE m_PauseState = STATE_DEFAULT;
static bool m_IsTextReady = false;

static PHASE_PHOTO_MODE_ARGS m_Args;
static TEXTSTRING *m_PausedText = NULL;

static REQUEST_INFO m_PauseRequester = {
Expand All @@ -55,7 +56,7 @@ static void M_UpdateText(void);
static int32_t M_DisplayRequester(
const char *header, const char *option1, const char *option2,
int16_t requested);
static void M_Start(const void *args);
static void M_Start(const PHASE_PHOTO_MODE_ARGS *args);
static void M_End(void);
static PHASE_CONTROL M_Control(int32_t nframes);
static void M_Draw(void);
Expand Down Expand Up @@ -108,8 +109,15 @@ static int32_t M_DisplayRequester(
return select;
}

static void M_Start(const void *const args)
static void M_Start(const PHASE_PHOTO_MODE_ARGS *const args)
{
if (args != NULL) {
m_Args = *args;
} else {
m_Args.phase_to_return_to = PHASE_GAME;
m_Args.phase_arg = NULL;
}

g_OldInputDB = g_Input;

Overlay_HideGameInfo();
Expand Down Expand Up @@ -145,7 +153,7 @@ static PHASE_CONTROL M_Control(int32_t nframes)
if (g_InputDB.pause) {
Music_Unpause();
Sound_UnpauseAll();
Phase_Set(PHASE_GAME, NULL);
Phase_Set(m_Args.phase_to_return_to, m_Args.phase_arg);
} else if (g_InputDB.option) {
m_PauseState = STATE_ASK;
}
Expand All @@ -157,7 +165,7 @@ static PHASE_CONTROL M_Control(int32_t nframes)
if (choice == 1) {
Music_Unpause();
Sound_UnpauseAll();
Phase_Set(PHASE_GAME, NULL);
Phase_Set(m_Args.phase_to_return_to, m_Args.phase_arg);
} else if (choice == 2) {
m_PauseState = STATE_CONFIRM;
}
Expand All @@ -175,7 +183,7 @@ static PHASE_CONTROL M_Control(int32_t nframes)
} else if (choice == 2) {
Music_Unpause();
Sound_UnpauseAll();
Phase_Set(PHASE_GAME, NULL);
Phase_Set(m_Args.phase_to_return_to, m_Args.phase_arg);
}
break;
}
Expand All @@ -194,7 +202,7 @@ static void M_Draw(void)
}

PHASER g_PausePhaser = {
.start = M_Start,
.start = (PHASER_START)M_Start,
.end = M_End,
.control = M_Control,
.draw = M_Draw,
Expand Down

0 comments on commit 1f12866

Please sign in to comment.