mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- serialize the temporary music volume that can be set through ACS.
This commit is contained in:
parent
40bf8a421e
commit
da74b9df95
7 changed files with 25 additions and 4 deletions
|
@ -87,6 +87,7 @@
|
|||
#include "vm.h"
|
||||
#include "events.h"
|
||||
#include "dobjgc.h"
|
||||
#include "i_music.h"
|
||||
|
||||
#include "gi.h"
|
||||
|
||||
|
@ -600,6 +601,7 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill
|
|||
|
||||
startpos = position;
|
||||
gameaction = ga_completed;
|
||||
level.SetMusicVolume(1.0);
|
||||
|
||||
if (nextinfo != NULL)
|
||||
{
|
||||
|
@ -1469,6 +1471,7 @@ void G_InitLevelLocals ()
|
|||
level.levelnum = info->levelnum;
|
||||
level.Music = info->Music;
|
||||
level.musicorder = info->musicorder;
|
||||
level.MusicVolume = 1.f;
|
||||
|
||||
level.LevelName = level.info->LookupLevelName();
|
||||
level.NextMap = info->NextMap;
|
||||
|
@ -1960,6 +1963,17 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, SetInterMusic)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FLevelLocals::SetMusicVolume(float f)
|
||||
{
|
||||
MusicVolume = f;
|
||||
I_SetMusicVolume(f);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
template <typename T>
|
||||
inline T VecDiff(const T& v1, const T& v2)
|
||||
{
|
||||
|
|
|
@ -46,6 +46,7 @@ struct FLevelLocals
|
|||
void Tick ();
|
||||
void AddScroller (int secnum);
|
||||
void SetInterMusic(const char *nextmap);
|
||||
void SetMusicVolume(float v);
|
||||
|
||||
uint8_t md5[16]; // for savegame validation. If the MD5 does not match the savegame won't be loaded.
|
||||
int time; // time in the hub
|
||||
|
@ -149,6 +150,7 @@ struct FLevelLocals
|
|||
int skyfog;
|
||||
|
||||
float pixelstretch;
|
||||
float MusicVolume;
|
||||
|
||||
bool IsJumpingAllowed() const;
|
||||
bool IsCrouchingAllowed() const;
|
||||
|
@ -162,6 +164,7 @@ struct FLevelLocals
|
|||
{
|
||||
return headgamenode;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
extern FLevelLocals level;
|
||||
|
|
|
@ -6689,7 +6689,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
|||
break;
|
||||
|
||||
case ACSF_SetMusicVolume:
|
||||
I_SetMusicVolume(ACSToFloat(args[0]));
|
||||
level.SetMusicVolume(ACSToFloat(args[0]));
|
||||
break;
|
||||
|
||||
case ACSF_CheckProximity:
|
||||
|
|
|
@ -1094,7 +1094,7 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply
|
|||
|
||||
if (isconsole)
|
||||
{
|
||||
I_SetMusicVolume (1.f);
|
||||
I_SetMusicVolume (level.MusicVolume);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -546,19 +546,22 @@ void P_SerializeSounds(FSerializer &arc)
|
|||
DSeqNode::SerializeSequences (arc);
|
||||
const char *name = NULL;
|
||||
uint8_t order;
|
||||
float musvol = level.MusicVolume;
|
||||
|
||||
if (arc.isWriting())
|
||||
{
|
||||
order = S_GetMusic(&name);
|
||||
}
|
||||
arc.StringPtr("musicname", name)
|
||||
("musicorder", order);
|
||||
("musicorder", order)
|
||||
("musicvolume", musvol);
|
||||
|
||||
if (arc.isReading())
|
||||
{
|
||||
if (!S_ChangeMusic(name, order))
|
||||
if (level.cdtrack == 0 || !S_ChangeCDMusic(level.cdtrack, level.cdid))
|
||||
S_ChangeMusic(level.Music, level.musicorder);
|
||||
level.SetMusicVolume(musvol);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3651,6 +3651,7 @@ void P_SetupLevel (const char *lumpname, int position)
|
|||
|
||||
if (!savegamerestore)
|
||||
{
|
||||
level.SetMusicVolume(level.MusicVolume);
|
||||
for (i = 0; i < MAXPLAYERS; ++i)
|
||||
{
|
||||
players[i].killcount = players[i].secretcount
|
||||
|
|
|
@ -886,7 +886,7 @@ bool Win32GLVideo::InitHardware (HWND Window, int multisample)
|
|||
{
|
||||
// let's try to get the best version possible. Some drivers only give us the version we request
|
||||
// which breaks all version checks for feature support. The highest used features we use are from version 4.4, and 3.0 is a requirement.
|
||||
static int versions[] = { 45, 44, 43, 42, 41, 40, 33, 32, 31, 30, -1 };
|
||||
static int versions[] = { 46, 45, 44, 43, 42, 41, 40, 33, 32, 31, 30, -1 };
|
||||
|
||||
for (int i = 0; versions[i] > 0; i++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue