mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-05-09 18:31:53 +00:00
Restore level music to where it left off
Toggleable via the resume cvar.
This commit is contained in:
parent
8524c3749d
commit
911dd57334
6 changed files with 19 additions and 1 deletions
|
|
@ -988,6 +988,8 @@ void D_RegisterClientCommands(void)
|
||||||
CV_RegisterVar(&cv_invincmusicfade);
|
CV_RegisterVar(&cv_invincmusicfade);
|
||||||
CV_RegisterVar(&cv_growmusicfade);
|
CV_RegisterVar(&cv_growmusicfade);
|
||||||
|
|
||||||
|
CV_RegisterVar(&cv_resume);
|
||||||
|
|
||||||
// ingame object placing
|
// ingame object placing
|
||||||
COM_AddCommand("objectplace", Command_ObjectPlace_f);
|
COM_AddCommand("objectplace", Command_ObjectPlace_f);
|
||||||
COM_AddCommand("writethings", Command_Writethings_f);
|
COM_AddCommand("writethings", Command_Writethings_f);
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ extern INT16 gamemap;
|
||||||
extern char mapmusname[7];
|
extern char mapmusname[7];
|
||||||
extern UINT16 mapmusflags;
|
extern UINT16 mapmusflags;
|
||||||
extern UINT32 mapmusposition;
|
extern UINT32 mapmusposition;
|
||||||
|
extern UINT32 mapmusresume;
|
||||||
#define MUSIC_TRACKMASK 0x0FFF // ----************
|
#define MUSIC_TRACKMASK 0x0FFF // ----************
|
||||||
#define MUSIC_RELOADRESET 0x8000 // *---------------
|
#define MUSIC_RELOADRESET 0x8000 // *---------------
|
||||||
#define MUSIC_FORCERESET 0x4000 // -*--------------
|
#define MUSIC_FORCERESET 0x4000 // -*--------------
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@ static void G_DoStartVote(void);
|
||||||
char mapmusname[7]; // Music name
|
char mapmusname[7]; // Music name
|
||||||
UINT16 mapmusflags; // Track and reset bit
|
UINT16 mapmusflags; // Track and reset bit
|
||||||
UINT32 mapmusposition; // Position to jump to
|
UINT32 mapmusposition; // Position to jump to
|
||||||
|
UINT32 mapmusresume;
|
||||||
|
|
||||||
INT16 gamemap = 1;
|
INT16 gamemap = 1;
|
||||||
INT16 maptol;
|
INT16 maptol;
|
||||||
|
|
@ -532,6 +533,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_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_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
|
#if MAXPLAYERS > 16
|
||||||
#error "please update player_name table using the new value for MAXPLAYERS"
|
#error "please update player_name table using the new value for MAXPLAYERS"
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,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_invincmusicfade;
|
||||||
extern consvar_t cv_growmusicfade;
|
extern consvar_t cv_growmusicfade;
|
||||||
|
|
||||||
|
extern consvar_t cv_resume;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
AXISNONE = 0,
|
AXISNONE = 0,
|
||||||
|
|
|
||||||
10
src/p_user.c
10
src/p_user.c
|
|
@ -1188,6 +1188,8 @@ boolean P_EndingMusic(player_t *player)
|
||||||
//
|
//
|
||||||
void P_RestoreMusic(player_t *player)
|
void P_RestoreMusic(player_t *player)
|
||||||
{
|
{
|
||||||
|
UINT32 position;
|
||||||
|
|
||||||
if (!P_IsLocalPlayer(player)) // Only applies to a local player
|
if (!P_IsLocalPlayer(player)) // Only applies to a local player
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1262,8 +1264,14 @@ void P_RestoreMusic(player_t *player)
|
||||||
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value))
|
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value))
|
||||||
S_SpeedMusic(1.2f);
|
S_SpeedMusic(1.2f);
|
||||||
#endif
|
#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());
|
S_GetRestoreMusicFadeIn());
|
||||||
|
mapmusresume = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2073,6 +2073,9 @@ void S_StopMusic(void)
|
||||||
|| demo.title) // SRB2Kart: Demos don't interrupt title screen music
|
|| demo.title) // SRB2Kart: Demos don't interrupt title screen music
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (strcasecmp(music_name, mapmusname) == 0)
|
||||||
|
mapmusresume = I_GetSongPosition();
|
||||||
|
|
||||||
if (I_SongPaused())
|
if (I_SongPaused())
|
||||||
I_ResumeSong();
|
I_ResumeSong();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue