mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Fade out music upon dying or level change: 2.1 frontport
This commit is contained in:
parent
e5ca2cfb77
commit
5c308c5597
5 changed files with 50 additions and 6 deletions
|
|
@ -89,6 +89,7 @@ extern INT32 lastwipetic;
|
||||||
void F_WipeStartScreen(void);
|
void F_WipeStartScreen(void);
|
||||||
void F_WipeEndScreen(void);
|
void F_WipeEndScreen(void);
|
||||||
void F_RunWipe(UINT8 wipetype, boolean drawMenu);
|
void F_RunWipe(UINT8 wipetype, boolean drawMenu);
|
||||||
|
tic_t F_GetWipeLength(UINT8 wipetype);
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|
|
||||||
27
src/f_wipe.c
27
src/f_wipe.c
|
|
@ -378,3 +378,30 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
||||||
WipeInAction = false;
|
WipeInAction = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns tic length of wipe
|
||||||
|
* One lump equals one tic
|
||||||
|
*/
|
||||||
|
tic_t F_GetWipeLength(UINT8 wipetype)
|
||||||
|
{
|
||||||
|
#ifdef NOWIPE
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
static char lumpname[10] = "FADEmmss";
|
||||||
|
lumpnum_t lumpnum;
|
||||||
|
UINT8 wipeframe;
|
||||||
|
|
||||||
|
if (wipetype > 99)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (wipeframe = 0; wipeframe < 100; wipeframe++)
|
||||||
|
{
|
||||||
|
sprintf(&lumpname[4], "%.2hu%.2hu", (UINT16)wipetype, (UINT16)wipeframe);
|
||||||
|
|
||||||
|
lumpnum = W_CheckNumForName(lumpname);
|
||||||
|
if (lumpnum == LUMPERROR)
|
||||||
|
return --wipeframe;
|
||||||
|
}
|
||||||
|
return --wipeframe;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1305,6 +1305,7 @@ static menuitem_t OP_SoundOptionsMenu[] =
|
||||||
|
|
||||||
{IT_HEADER, NULL, "Advanced", NULL, 103}, // 50
|
{IT_HEADER, NULL, "Advanced", NULL, 103}, // 50
|
||||||
{IT_STRING | IT_CVAR, NULL, "Closed Captioning", &cv_closedcaptioning, 115}, // 56
|
{IT_STRING | IT_CVAR, NULL, "Closed Captioning", &cv_closedcaptioning, 115}, // 56
|
||||||
|
{IT_STRING | IT_CVAR, NULL, "Reset Music Upon Dying", &cv_resetmusic, 127}, // 62
|
||||||
};
|
};
|
||||||
|
|
||||||
static menuitem_t OP_DataOptionsMenu[] =
|
static menuitem_t OP_DataOptionsMenu[] =
|
||||||
|
|
|
||||||
|
|
@ -2693,6 +2693,12 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||||
|
|
||||||
S_StartSound(NULL, sfx_s3kaf);
|
S_StartSound(NULL, sfx_s3kaf);
|
||||||
|
|
||||||
|
// Fade music! Time it to S3KAF: 0.25 seconds is snappy.
|
||||||
|
if (cv_resetmusic.value ||
|
||||||
|
strnicmp(S_MusicName(),
|
||||||
|
(mapmusflags & MUSIC_RELOADRESET) ? mapheaderinfo[gamemap-1]->musname : mapmusname, 7))
|
||||||
|
S_FadeOutStopMusic(MUSICRATE/4); //FixedMul(FixedDiv(F_GetWipeLength(wipedefs[wipe_speclevel_towhite])*NEWTICRATERATIO, NEWTICRATE), MUSICRATE)
|
||||||
|
|
||||||
F_WipeStartScreen();
|
F_WipeStartScreen();
|
||||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0);
|
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0);
|
||||||
|
|
||||||
|
|
@ -2700,6 +2706,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||||
F_RunWipe(wipedefs[wipe_speclevel_towhite], false);
|
F_RunWipe(wipedefs[wipe_speclevel_towhite], false);
|
||||||
|
|
||||||
nowtime = lastwipetic;
|
nowtime = lastwipetic;
|
||||||
|
|
||||||
// Hold on white for extra effect.
|
// Hold on white for extra effect.
|
||||||
while (nowtime < endtime)
|
while (nowtime < endtime)
|
||||||
{
|
{
|
||||||
|
|
@ -2720,14 +2727,17 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||||
|
|
||||||
if (!titlemapinaction)
|
if (!titlemapinaction)
|
||||||
{
|
{
|
||||||
// As oddly named as this is, this handles music only.
|
|
||||||
// We should be fine starting it here.
|
|
||||||
S_Start();
|
|
||||||
|
|
||||||
// Let's fade to black here
|
// Let's fade to black here
|
||||||
// But only if we didn't do the special stage wipe
|
// But only if we didn't do the special stage wipe
|
||||||
if (rendermode != render_none && !ranspecialwipe)
|
if (rendermode != render_none && !ranspecialwipe)
|
||||||
{
|
{
|
||||||
|
// Fade out music here. Deduct 2 tics so the fade volume actually reaches 0
|
||||||
|
if (cv_resetmusic.value ||
|
||||||
|
strnicmp(S_MusicName(),
|
||||||
|
(mapmusflags & MUSIC_RELOADRESET) ? mapheaderinfo[gamemap-1]->musname : mapmusname, 7))
|
||||||
|
S_FadeOutStopMusic(FixedMul(
|
||||||
|
FixedDiv((F_GetWipeLength(wipedefs[wipe_level_toblack])-2)*NEWTICRATERATIO, NEWTICRATE), MUSICRATE));
|
||||||
|
|
||||||
F_WipeStartScreen();
|
F_WipeStartScreen();
|
||||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||||
|
|
||||||
|
|
@ -2735,6 +2745,10 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||||
F_RunWipe(wipedefs[wipe_level_toblack], false);
|
F_RunWipe(wipedefs[wipe_level_toblack], false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// As oddly named as this is, this handles music only.
|
||||||
|
// We should be fine starting it here.
|
||||||
|
S_Start();
|
||||||
|
|
||||||
if (ranspecialwipe == 2)
|
if (ranspecialwipe == 2)
|
||||||
{
|
{
|
||||||
pausedelay = -3; // preticker plus one
|
pausedelay = -3; // preticker plus one
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ consvar_t cv_closedcaptioning = {"closedcaptioning", "Off", CV_SAVE|CV_CALL, CV_
|
||||||
consvar_t cv_numChannels = {"snd_channels", "32", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_numChannels = {"snd_channels", "32", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
static consvar_t surround = {"surround", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
static consvar_t surround = {"surround", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_resetmusic = {"resetmusic", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
// Sound system toggles, saved into the config
|
// Sound system toggles, saved into the config
|
||||||
consvar_t cv_gamedigimusic = {"digimusic", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameDigiMusic_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_gamedigimusic = {"digimusic", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameDigiMusic_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
@ -1613,7 +1613,8 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefadems && S_MusicPlaying()) // queue music change for after fade // allow even if the music is the same
|
if (prefadems) // queue music change for after fade // allow even if the music is the same
|
||||||
|
// && S_MusicPlaying() // Let the delay happen even if we're not playing music
|
||||||
{
|
{
|
||||||
CONS_Debug(DBG_DETAILED, "Now fading out song %s\n", music_name);
|
CONS_Debug(DBG_DETAILED, "Now fading out song %s\n", music_name);
|
||||||
S_QueueMusic(newmusic, mflags, looping, position, fadeinms);
|
S_QueueMusic(newmusic, mflags, looping, position, fadeinms);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue