Restore level music to where it left off

Toggleable via the resume cvar.
This commit is contained in:
James R committed 2020-09-27 16:12:37 -07:00
1 parent 823ff04e2a
commit b6b7ec92ed
6 files changed
+19 -1

No files matched your search

+2
View File
@@ -975,6 +975,8 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_invincmusicfade);
CV_RegisterVar(&cv_growmusicfade);
CV_RegisterVar(&cv_resume);
// ingame object placing
COM_AddCommand("objectplace", Command_ObjectPlace_f);
COM_AddCommand("writethings", Command_Writethings_f);
+1
View File
@@ -34,6 +34,7 @@ extern INT16 gamemap;
extern char mapmusname[7];
extern UINT16 mapmusflags;
extern UINT32 mapmusposition;
extern UINT32 mapmusresume;
#define MUSIC_TRACKMASK 0x0FFF // ----************
#define MUSIC_RELOADRESET 0x8000 // *---------------
#define MUSIC_FORCERESET 0x4000 // -*--------------
+2
View File
@@ -85,6 +85,7 @@ static void G_DoStartVote(void);
char mapmusname[7]; // Music name
UINT16 mapmusflags; // Track and reset bit
UINT32 mapmusposition; // Position to jump to
UINT32 mapmusresume;
INT16 gamemap = 1;
INT16 maptol;
@@ -522,6 +523,7 @@ consvar_t cv_deadzone4 = {"joy4_deadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_con
consvar_t cv_invincmusicfade = {"invincmusicfade", "300", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_growmusicfade = {"growmusicfade", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_resume = {"resume", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
#if MAXPLAYERS > 16
#error "please update player_name table using the new value for MAXPLAYERS"
+2
View File
@@ -127,6 +127,8 @@ extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_gu
extern consvar_t cv_invincmusicfade;
extern consvar_t cv_growmusicfade;
extern consvar_t cv_resume;
typedef enum
{
AXISNONE = 0,
+9 -1
View File
@@ -1219,6 +1219,8 @@ boolean P_EndingMusic(player_t *player)
//
void P_RestoreMusic(player_t *player)
{
UINT32 position;
if (!P_IsLocalPlayer(player)) // Only applies to a local player
return;
@@ -1293,8 +1295,14 @@ void P_RestoreMusic(player_t *player)
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1))
S_SpeedMusic(1.2f);
#endif
S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0,
if (mapmusresume && cv_resume.value)
position = mapmusresume;
else
position = mapmusposition;
S_ChangeMusicEx(mapmusname, mapmusflags, true, position, 0,
S_GetRestoreMusicFadeIn());
mapmusresume = 0;
}
}
}
+3
View File
@@ -2075,6 +2075,9 @@ void S_StopMusic(void)
|| demo.title) // SRB2Kart: Demos don't interrupt title screen music
return;
if (strcasecmp(music_name, mapmusname) == 0)
mapmusresume = I_GetSongPosition();
if (I_SongPaused())
I_ResumeSong();