diff --git a/docs/rh-log.txt b/docs/rh-log.txt
index 8e64b66d7e..0367502d5a 100644
--- a/docs/rh-log.txt
+++ b/docs/rh-log.txt
@@ -1,3 +1,13 @@
+June 12, 2008
+- Add environment 255, 255 as a way to get the software underwater effect in
+ any zone you want.
+- Using a too-recent version of FMOD now gives an error, since there may be
+ breaking changes to the API from one version to the next (excluding
+ revisions in stable branches, which only represent bug fixes).
+- Updated fmod_wrap.h for FMOD 4.16 and corrected a bug that had gone
+ unnoticed before: The delayhi and delaylo parameters for Channel::setDelay()
+ and getDelay() were swapped.
+
June 12, 2008 (Changes by Graf Zahl)
- Fixed: P_ChangeSector could incorrectly block movement when checking for
mid textures linked to a moving floor.
diff --git a/src/s_environment.cpp b/src/s_environment.cpp
index bc06fc0aca..03bad0e3d0 100644
--- a/src/s_environment.cpp
+++ b/src/s_environment.cpp
@@ -103,9 +103,22 @@ static const char *ReverbFieldNames[NUM_REVERB_FIELDS+2] =
static const char *BoolNames[3] = { "False", "True", NULL };
+static ReverbContainer DSPWater =
+{
+ // Based on the "off" reverb, this one uses the software water effect,
+ // which is completely independant from EAX-like reverb.
+ NULL,
+ "DSP Water",
+ 0xffff,
+ true,
+ false,
+ {0, 0, 7.5f, 1.00f, -10000, -10000, 0, 1.00f, 1.00f, 1.0f, -2602, 0.007f, 0.0f,0.0f,0.0f, 200, 0.011f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 0.0f, 0.0f, 0x33f },
+ true
+};
+
static ReverbContainer Psychotic =
{
- NULL,
+ &DSPWater,
"Psychotic",
0x1900,
true,
@@ -564,6 +577,7 @@ static void ReadReverbDef (int lump)
newenv->ID = (id1 << 8) | id2;
newenv->Builtin = false;
newenv->Properties = props;
+ newenv->SoftwareWater = false;
S_AddEnvironment (newenv);
}
}
diff --git a/src/s_sound.h b/src/s_sound.h
index a5ed5cd68e..dc1ed9af8d 100644
--- a/src/s_sound.h
+++ b/src/s_sound.h
@@ -132,7 +132,7 @@ void S_CacheSound (sfxinfo_t *sfx);
void S_Sound (int channel, const char *name, float volume, int attenuation);
void S_Sound (AActor *ent, int channel, const char *name, float volume, int attenuation);
void S_Sound (fixed_t *pt, int channel, const char *name, float volume, int attenuation);
-void S_Sound (fixed_t x, fixed_t y, int channel, const char *name, float volume, int attenuation);
+//void S_Sound (fixed_t x, fixed_t y, int channel, const char *name, float volume, int attenuation);
void S_SoundID (int channel, int sfxid, float volume, int attenuation);
void S_SoundID (AActor *ent, int channel, int sfxid, float volume, int attenuation);
void S_SoundID (fixed_t *pt, int channel, int sfxid, float volume, int attenuation);
@@ -299,6 +299,7 @@ struct ReverbContainer
bool Builtin;
bool Modified;
REVERB_PROPERTIES Properties;
+ bool SoftwareWater;
};
extern ReverbContainer *Environments;
diff --git a/src/sound/fmod_wrap.h b/src/sound/fmod_wrap.h
index c3f9bd184e..1c9c2d2979 100644
--- a/src/sound/fmod_wrap.h
+++ b/src/sound/fmod_wrap.h
@@ -46,7 +46,7 @@ namespace FMOD
/*
FMOD global system functions (optional).
*/
- inline FMOD_RESULT Memory_Initialize(void *poolmem, int poollen, FMOD_MEMORY_ALLOCCALLBACK useralloc, FMOD_MEMORY_REALLOCCALLBACK userrealloc, FMOD_MEMORY_FREECALLBACK userfree) { return FMOD_Memory_Initialize(poolmem, poollen, useralloc, userrealloc, userfree); }
+ inline FMOD_RESULT Memory_Initialize(void *poolmem, int poollen, FMOD_MEMORY_ALLOCCALLBACK useralloc, FMOD_MEMORY_REALLOCCALLBACK userrealloc, FMOD_MEMORY_FREECALLBACK userfree, FMOD_MEMORY_TYPE memtypeflags = (FMOD_MEMORY_NORMAL | FMOD_MEMORY_XBOX360_PHYSICAL)) { return FMOD_Memory_Initialize(poolmem, poollen, useralloc, userrealloc, userfree, memtypeflags); }
inline FMOD_RESULT Memory_GetStats (int *currentalloced, int *maxalloced) { return FMOD_Memory_GetStats(currentalloced, maxalloced); }
inline FMOD_RESULT Debug_SetLevel(FMOD_DEBUGLEVEL level) { return FMOD_Debug_SetLevel(level); }
inline FMOD_RESULT Debug_GetLevel(FMOD_DEBUGLEVEL *level) { return FMOD_Debug_GetLevel(level); }
@@ -93,7 +93,7 @@ namespace FMOD
FMOD_RESULT getAdvancedSettings (FMOD_ADVANCEDSETTINGS *settings) { return FMOD_System_GetAdvancedSettings(this, settings); }
FMOD_RESULT setSpeakerMode (FMOD_SPEAKERMODE speakermode) { return FMOD_System_SetSpeakerMode(this, speakermode); }
FMOD_RESULT getSpeakerMode (FMOD_SPEAKERMODE *speakermode) { return FMOD_System_GetSpeakerMode(this, speakermode); }
- FMOD_RESULT setCallback (FMOD_SYSTEM_CALLBACKTYPE type, FMOD_SYSTEM_CALLBACK callback) { return FMOD_System_SetCallback(this, type, callback); }
+ FMOD_RESULT setCallback (FMOD_SYSTEM_CALLBACK callback) { return FMOD_System_SetCallback(this, callback); }
// Plug-in support
FMOD_RESULT setPluginPath (const char *path) { return FMOD_System_SetPluginPath(this, path); }
@@ -280,8 +280,8 @@ namespace FMOD
FMOD_RESULT getFrequency (float *frequency) { return FMOD_Channel_GetFrequency(this, frequency); }
FMOD_RESULT setPan (float pan) { return FMOD_Channel_SetPan(this, pan); }
FMOD_RESULT getPan (float *pan) { return FMOD_Channel_GetPan(this, pan); }
- FMOD_RESULT setDelay (FMOD_DELAYTYPE delaytype, unsigned int delayhi, unsigned int delaylo) { return FMOD_Channel_SetDelay(this, delaytype, delaylo, delayhi); }
- FMOD_RESULT getDelay (FMOD_DELAYTYPE delaytype, unsigned int *delayhi, unsigned int *delaylo) { return FMOD_Channel_GetDelay(this, delaytype, delaylo, delayhi); }
+ FMOD_RESULT setDelay (FMOD_DELAYTYPE delaytype, unsigned int delayhi, unsigned int delaylo) { return FMOD_Channel_SetDelay(this, delaytype, delayhi, delaylo); }
+ FMOD_RESULT getDelay (FMOD_DELAYTYPE delaytype, unsigned int *delayhi, unsigned int *delaylo) { return FMOD_Channel_GetDelay(this, delaytype, delayhi, delaylo); }
FMOD_RESULT setSpeakerMix (float frontleft, float frontright, float center, float lfe, float backleft, float backright, float sideleft, float sideright) { return FMOD_Channel_SetSpeakerMix(this, frontleft, frontright, center, lfe, backleft, backright, sideleft, sideright); }
FMOD_RESULT getSpeakerMix (float *frontleft, float *frontright, float *center, float *lfe, float *backleft, float *backright, float *sideleft, float *sideright) { return FMOD_Channel_GetSpeakerMix(this, frontleft, frontright, center, lfe, backleft, backright, sideleft, sideright); }
FMOD_RESULT setSpeakerLevels (FMOD_SPEAKER speaker, float *levels, int numlevels) { return FMOD_Channel_SetSpeakerLevels(this, speaker, levels, numlevels); }
@@ -469,6 +469,8 @@ namespace FMOD
FMOD_RESULT getActive (bool *active) { FMOD_BOOL b; FMOD_RESULT res = FMOD_DSP_GetActive(this, &b); *active = b; return res; }
FMOD_RESULT setBypass (bool bypass) { return FMOD_DSP_SetBypass(this, bypass); }
FMOD_RESULT getBypass (bool *bypass) { FMOD_BOOL b; FMOD_RESULT res = FMOD_DSP_GetBypass(this, &b); *bypass = b; return res; }
+ FMOD_RESULT setSpeakerActive (FMOD_SPEAKER speaker, bool active) { return FMOD_DSP_SetSpeakerActive(this, speaker, active); }
+ FMOD_RESULT getSpeakerActive (FMOD_SPEAKER speaker, bool *active) { FMOD_BOOL b; FMOD_RESULT res = FMOD_DSP_GetSpeakerActive(this, speaker, &b); *active = b; return res; }
FMOD_RESULT reset () { return FMOD_DSP_Reset(this); }
// DSP parameter control.
diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp
index 78d4aee4fe..7859535503 100644
--- a/src/sound/fmodsound.cpp
+++ b/src/sound/fmodsound.cpp
@@ -641,10 +641,20 @@ bool FMODSoundRenderer::Init()
return false;
}
+ const char *wrongver = NULL;
if (version < FMOD_VERSION)
{
- Printf (" "TEXTCOLOR_ORANGE"Error! You are using an old version of FMOD (%x.%02x.%02x).\n"
+ wrongver = "an old";
+ }
+ else if ((version & 0xFFFF00) > (FMOD_VERSION & 0xFFFF00))
+ {
+ wrongver = "a new";
+ }
+ if (wrongver != NULL)
+ {
+ Printf (" "TEXTCOLOR_ORANGE"Error! You are using %s version of FMOD (%x.%02x.%02x).\n"
" "TEXTCOLOR_ORANGE"This program requires version %x.%02x.%02x\n",
+ wrongver,
version >> 16, (version >> 8) & 255, version & 255,
FMOD_VERSION >> 16, (FMOD_VERSION >> 8) & 255, FMOD_VERSION & 255);
return false;
@@ -1487,8 +1497,11 @@ FSoundChan *FMODSoundRenderer::StartSound3D(sfxinfo_t *sfx, float vol, float dis
chan->setFrequency(freq);
}
chan->setVolume(vol);
- chan->set3DAttributes((FMOD_VECTOR *)pos, (FMOD_VECTOR *)vel);
- chan->set3DSpread(snd_3dspread);
+ if (mode & FMOD_3D)
+ {
+ chan->set3DAttributes((FMOD_VECTOR *)pos, (FMOD_VECTOR *)vel);
+ chan->set3DSpread(snd_3dspread);
+ }
chan->setDelay(FMOD_DELAYTYPE_DSPCLOCK_START, DSPClockHi, DSPClockLo);
chan->setPaused(false);
FSoundChan *schan = CommonChannelSetup(chan);
@@ -1707,11 +1720,6 @@ void FMODSoundRenderer::UpdateListener()
{
env = DefaultEnvironments[0];
}
-/* if (env == DefaultEnvironments[0] && underwater)
- {
- env = DefaultEnvironments[22];
- }
-*/
}
if (env != PrevEnvironment || env->Modified)
{
@@ -1721,7 +1729,7 @@ void FMODSoundRenderer::UpdateListener()
PrevEnvironment = env;
}
- if (underwater)
+ if (underwater || env->SoftwareWater)
{
//PausableSfx->setPitch(0.64171f); // This appears to be what Duke 3D uses
PausableSfx->setPitch(0.7937005f); // Approx. 4 semitones lower; what Nash suggesetd
diff --git a/zdoom.vcproj b/zdoom.vcproj
index 8dc02e5ef0..3f351d6cf5 100644
--- a/zdoom.vcproj
+++ b/zdoom.vcproj
@@ -1,7 +1,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
@@ -950,6 +940,16 @@
Outputs=""src/$(InputName).h""
/>
+
+
+
@@ -1544,16 +1544,6 @@
Outputs="$(IntDir)\$(InputName).obj"
/>
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
+
+
+
@@ -1924,14 +1932,6 @@
Outputs="$(IntDir)\$(InputName).obj"
/>
-
-
-
+
+
+
@@ -2810,14 +2818,6 @@
AdditionalIncludeDirectories="src\win32;$(NoInherit)"
/>
-
-
-
@@ -2832,6 +2832,10 @@
+
+
@@ -3088,7 +3092,7 @@
/>