Fade level music back in after Invincibility and Grow
Cvars are invincibilitymusicfade and growmusicfade. Both measure milliseconds.
This commit is contained in:
1 parent
7f0fa6987a
commit
823ff04e2a
6 files changed
+38
-1
No files matched your search
@@ -972,6 +972,9 @@ void D_RegisterClientCommands(void)
|
||||
|
||||
CV_RegisterVar(&cv_soundtest);
|
||||
|
||||
CV_RegisterVar(&cv_invincmusicfade);
|
||||
CV_RegisterVar(&cv_growmusicfade);
|
||||
|
||||
// ingame object placing
|
||||
COM_AddCommand("objectplace", Command_ObjectPlace_f);
|
||||
COM_AddCommand("writethings", Command_Writethings_f);
|
||||
|
||||
@@ -519,6 +519,9 @@ consvar_t cv_fireaxis4 = {"joyaxis4_fire", "Z-Axis", CV_SAVE, joyaxis_cons_t, NU
|
||||
consvar_t cv_driftaxis4 = {"joyaxis4_drift", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_deadzone4 = {"joy4_deadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, 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};
|
||||
|
||||
|
||||
#if MAXPLAYERS > 16
|
||||
#error "please update player_name table using the new value for MAXPLAYERS"
|
||||
|
||||
@@ -124,6 +124,9 @@ extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis
|
||||
extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4,cv_deadzone4;
|
||||
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
|
||||
|
||||
extern consvar_t cv_invincmusicfade;
|
||||
extern consvar_t cv_growmusicfade;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AXISNONE = 0,
|
||||
|
||||
+8
-1
@@ -1275,10 +1275,16 @@ void P_RestoreMusic(player_t *player)
|
||||
|
||||
// Item - Grow
|
||||
if (wantedmus == 2)
|
||||
{
|
||||
S_ChangeMusicInternal("kgrow", true);
|
||||
S_SetRestoreMusicFadeInCvar(&cv_growmusicfade);
|
||||
}
|
||||
// Item - Invincibility
|
||||
else if (wantedmus == 1)
|
||||
{
|
||||
S_ChangeMusicInternal("kinvnc", true);
|
||||
S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
@@ -1287,7 +1293,8 @@ 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, 0);
|
||||
S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0,
|
||||
S_GetRestoreMusicFadeIn());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1565,6 +1565,7 @@ static char music_name[7]; // up to 6-character name
|
||||
static void *music_data;
|
||||
static UINT16 music_flags;
|
||||
static boolean music_looping;
|
||||
static consvar_t *music_refade_cv;
|
||||
|
||||
static char queue_name[7];
|
||||
static UINT16 queue_flags;
|
||||
@@ -1948,6 +1949,8 @@ static void S_UnloadMusic(void)
|
||||
music_name[0] = 0;
|
||||
music_flags = 0;
|
||||
music_looping = false;
|
||||
|
||||
music_refade_cv = 0;
|
||||
}
|
||||
|
||||
static boolean S_PlayMusic(boolean looping, UINT32 fadeinms)
|
||||
@@ -2169,6 +2172,21 @@ void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
S_SetRestoreMusicFadeInCvar (consvar_t *cv)
|
||||
{
|
||||
music_refade_cv = cv;
|
||||
}
|
||||
|
||||
int
|
||||
S_GetRestoreMusicFadeIn (void)
|
||||
{
|
||||
if (music_refade_cv)
|
||||
return music_refade_cv->value;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
/// Music Fading
|
||||
/// ------------------------
|
||||
|
||||
@@ -186,6 +186,9 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
|
||||
#define S_ChangeMusicInternal(a,b) S_ChangeMusicEx(a,0,b,0,0,0)
|
||||
#define S_ChangeMusic(a,b,c) S_ChangeMusicEx(a,b,c,0,0,0)
|
||||
|
||||
void S_SetRestoreMusicFadeInCvar (consvar_t *cvar);
|
||||
int S_GetRestoreMusicFadeIn (void);
|
||||
|
||||
// Stops the music.
|
||||
void S_StopMusic(void);
|
||||
|
||||
|
||||
Reference in new issue
Block a user