mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-21 13:10:37 +02:00
Quake 4 integrated with DoomRTX
This commit is contained in:
+110
-7
@@ -56,6 +56,26 @@ static const int SSF_UNCLAMPED = BIT(7); // don't clamp calculated volumes at
|
||||
static const int SSF_NO_FLICKER = BIT(8); // always return 1.0 for volume queries
|
||||
static const int SSF_NO_DUPS = BIT(9); // try not to play the same sound twice in a row
|
||||
|
||||
#ifdef QUAKE4
|
||||
// sound classes are used to fade most sounds down inside cinematics, leaving dialog
|
||||
// flagged with a non-zero class full volume
|
||||
const int SOUND_CLASS_MUSICAL = 3;
|
||||
const int SOUND_MAX_CLASSES = 4;
|
||||
|
||||
static const int SSF_VO = BIT(10); // VO - direct a portion of the sound through the center channel (set automatically on shaders that contain files that start with "sound/vo/")
|
||||
static const int SSF_MUSIC = BIT(11); // Music - Muted when the player is playing his own music
|
||||
|
||||
// RAVEN BEGIN
|
||||
static const int SSF_USEDOPPLER = BIT(17); // allow doppler pitch shifting effects
|
||||
static const int SSF_NO_RANDOMSTART = BIT(18); // don't offset the start position for looping sounds
|
||||
static const int SSF_VO_FOR_PLAYER = BIT(12); // Notifies a funcRadioChatter that this shader is directed at the player
|
||||
static const int SSF_IS_VO = BIT(13); // this sound is VO
|
||||
static const int SSF_CAUSE_RUMBLE = BIT(14); // causes joystick rumble
|
||||
static const int SSF_CENTER = BIT(15); // sound through center channel only
|
||||
static const int SSF_HILITE = BIT(16); // display debug info for this emitter
|
||||
// RAVEN END
|
||||
#endif
|
||||
|
||||
#ifdef PREY
|
||||
static const int SSF_VOICEAMPLITUDE = BIT(10); // HUMANHEAD pdm: include in findamplitude queries
|
||||
static const int SSF_OMNI_WHEN_CLOSE = BIT(11); // HUMANHEAD pdm: make omni when within the mindistance
|
||||
@@ -74,15 +94,23 @@ static const int SSF_NOPORTALFLOW = BIT(13); // don't allow sounds to flow thro
|
||||
typedef struct {
|
||||
float minDistance;
|
||||
float maxDistance;
|
||||
float volume; // in dB, unfortunately. Negative values get quieter
|
||||
float volume;
|
||||
#ifdef QUAKE4
|
||||
float attenuatedVolume;
|
||||
#endif
|
||||
float shakes;
|
||||
int soundShaderFlags; // SSF_* bit flags
|
||||
int soundClass; // for global fading of sounds
|
||||
int soundShaderFlags;
|
||||
int soundClass;
|
||||
#ifdef QUAKE4
|
||||
float frequencyShift;
|
||||
float wetLevel;
|
||||
float dryLevel;
|
||||
#endif
|
||||
#ifdef PREY
|
||||
int subIndex; //HUMANHEAD rww - indices into the subtitle table
|
||||
int profanityIndex; // HUMANHEAD pdm
|
||||
float profanityDelay; // HUMANHEAD pdm
|
||||
float profanityDuration; // HUMANHEAD pdm
|
||||
int subIndex;
|
||||
int profanityIndex;
|
||||
float profanityDelay;
|
||||
float profanityDuration;
|
||||
#endif
|
||||
} soundShaderParms_t;
|
||||
|
||||
@@ -117,6 +145,13 @@ const int SOUNDCLASS_SPIRITWALK = 2;
|
||||
const int SOUNDCLASS_VOICE = 3;
|
||||
const int SOUNDCLASS_MUSIC = 4;
|
||||
const int SOUND_MAX_CLASSES = 5;
|
||||
#elif defined(QUAKE4)
|
||||
#define SOUNDWORLD_ANY -1
|
||||
#define SOUNDWORLD_NONE 0
|
||||
#define SOUNDWORLD_GAME 1
|
||||
#define SOUNDWORLD_MENU 2
|
||||
#define SOUNDWORLD_EDITOR 3
|
||||
#define SOUNDWORLD_MAX 4
|
||||
#else
|
||||
const int SOUND_MAX_CLASSES = 4;
|
||||
#endif
|
||||
@@ -156,6 +191,10 @@ public:
|
||||
|
||||
virtual bool CheckShakesAndOgg( void ) const;
|
||||
|
||||
#ifdef QUAKE4
|
||||
virtual bool IsVO_ForPlayer() const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
friend class idSoundWorldLocal;
|
||||
friend class idSoundEmitterLocal;
|
||||
@@ -176,7 +215,16 @@ private:
|
||||
int numLeadins;
|
||||
idSoundSample * entries[SOUND_MAX_LIST_WAVS];
|
||||
int numEntries;
|
||||
#ifdef QUAKE4
|
||||
bool noShakes;
|
||||
bool frequentlyUsed;
|
||||
idStrList shakes;
|
||||
|
||||
float minFrequencyShift;
|
||||
float maxFrequencyShift;
|
||||
|
||||
int playCount;
|
||||
#endif
|
||||
private:
|
||||
void Init( void );
|
||||
bool ParseShader( idLexer &src );
|
||||
@@ -209,6 +257,11 @@ public:
|
||||
// the parms specified will be the default overrides for all sounds started on this emitter.
|
||||
// NULL is acceptable for parms
|
||||
virtual void UpdateEmitter( const idVec3 &origin, int listenerId, const soundShaderParms_t *parms ) = 0;
|
||||
#ifdef QUAKE4
|
||||
virtual void UpdateEmitter(const idVec3& origin, const idVec3& velocity, int listenerId, const soundShaderParms_t* parms) {
|
||||
UpdateEmitter(origin, listenerId, parms); // TODO implement velocity!
|
||||
}
|
||||
#endif
|
||||
|
||||
// returns the length of the started sound in msec
|
||||
virtual int StartSound( const idSoundShader *shader, const s_channelType channel, float diversity = 0, int shaderFlags = 0, bool allowSlow = true ) = 0;
|
||||
@@ -396,12 +449,62 @@ public:
|
||||
// is EAX support present - -1: disabled at compile time, 0: no suitable hardware, 1: ok, 2: failed to load OpenAL DLL
|
||||
virtual int IsEAXAvailable( void ) = 0;
|
||||
|
||||
virtual idSoundSample* FindSample(const idStr& filename) = 0;
|
||||
#ifdef PREY
|
||||
virtual int GetSubtitleIndex( const char *soundName ) = 0;
|
||||
virtual void SetSubtitleData( int subIndex, int subNum, const char *subText, float subTime, int subChannel ) = 0;
|
||||
virtual soundSub_t * GetSubtitle( int subIndex, int subNum ) = 0;
|
||||
virtual soundSubtitleList_t *GetSubtitleList( int subIndex ) = 0;
|
||||
#endif
|
||||
|
||||
#ifdef QUAKE4
|
||||
// jmarshall: Quake 4 specific code
|
||||
// RAVEN BEGIN
|
||||
// get a new emitter that can play sounds in this world
|
||||
virtual idSoundWorld* GetSoundWorldFromId(int worldId) = 0;
|
||||
|
||||
idSoundEmitter* EmitterForIndex(int worldId, int index) {
|
||||
return GetSoundWorldFromId(worldId)->EmitterForIndex(index);
|
||||
}
|
||||
|
||||
void FadeSoundClasses(int worldId, const int soundClass, const float to, const float over) {
|
||||
GetSoundWorldFromId(worldId)->FadeSoundClasses(soundClass, to, over);
|
||||
}
|
||||
|
||||
void PlayShaderDirectly(int worldId, const char* name, int channel = -1) {
|
||||
GetSoundWorldFromId(worldId)->PlayShaderDirectly(name, channel);
|
||||
}
|
||||
|
||||
virtual int AllocSoundEmitter(int worldId) {
|
||||
return GetSoundWorldFromId(worldId)->AllocSoundEmitter()->Index();
|
||||
}
|
||||
virtual void FreeSoundEmitter(int worldId, int handle, bool immediate) {
|
||||
|
||||
}
|
||||
|
||||
virtual void StopAllSounds(int worldId) {
|
||||
GetSoundWorldFromId(worldId)->StopAllSounds();
|
||||
}
|
||||
|
||||
virtual void SetActiveSoundWorld(bool val) { }
|
||||
|
||||
virtual void WriteToSaveGame(int worldId, idFile* savefile) {
|
||||
GetSoundWorldFromId(worldId)->WriteToSaveGame(savefile);
|
||||
}
|
||||
virtual void ReadFromSaveGame(int worldId, idFile* savefile) {
|
||||
GetSoundWorldFromId(worldId)->ReadFromSaveGame(savefile);
|
||||
}
|
||||
|
||||
void PlaceListener(const idVec3& origin, const idMat3& axis, const int listenerId, const int gameTime, const idStr& areaName) {
|
||||
GetSoundWorldFromId(SOUNDWORLD_GAME)->PlaceListener(origin, axis, listenerId, gameTime, areaName);
|
||||
}
|
||||
|
||||
virtual float CurrentShakeAmplitudeForPosition(int worldId, const int time, const idVec3& listenerPosition) {
|
||||
return GetSoundWorldFromId(worldId)->CurrentShakeAmplitudeForPosition(time, listenerPosition);
|
||||
}
|
||||
// RAVEN END
|
||||
// jmarshall end
|
||||
#endif
|
||||
};
|
||||
|
||||
extern idSoundSystem *soundSystem;
|
||||
|
||||
Reference in New Issue
Block a user