diff --git a/docs/rh-log.txt b/docs/rh-log.txt index c35c4ec64..8a72eafbd 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,9 @@ +November 8, 2008 +- Made sdl/i_system.cpp:I_GetTimePolled() functionally equivalent to the + Win32 version. +- Updated fmod_wrap.h and fmodsound.cpp for FMOD 4.20. +- GCC warning removal. + November 2, 2008 (Changes by Graf Zahl) - Fixed: The TEXTURES parser didn't report an error for invalid keywords. - Fixed: The DECORATE expression evaluator was too strict with missing jump labels. diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index fc2d50c8d..c79ceba39 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -87,7 +87,7 @@ DWORD LanguageIDs[4] = int (*I_GetTime) (bool saveMS); int (*I_WaitForTic) (int); -void (*I_FreezTime) (bool frozen); +void (*I_FreezeTime) (bool frozen); void I_Tactile (int on, int off, int total) { @@ -117,6 +117,7 @@ unsigned int I_MSTime (void) static DWORD TicStart; static DWORD TicNext; +static DWORD BaseTime; static int TicFrozen; // @@ -131,13 +132,17 @@ int I_GetTimePolled (bool saveMS) } DWORD tm = SDL_GetTicks (); + if (BaseTime == 0) + { + BaseTime = tm; + } if (saveMS) { TicStart = tm; TicNext = Scale ((Scale (tm, TICRATE, 1000) + 1), 1000, TICRATE); } - return Scale (tm, TICRATE, 1000); + return Scale (tm - BaseTime, TICRATE, 1000); } int I_WaitForTicPolled (int prevtic) @@ -151,22 +156,22 @@ int I_WaitForTicPolled (int prevtic) return time; } -void I_FreezeTimePolled (bool frozen) -{ - if (frozen) - { - assert(TicFrozen == 0); - TicFrozen = I_GetTimePolled(false); - } - else - { - assert(TicFrozen != 0); - int froze = TicFrozen; - TicFrozen = 0; - int now = I_GetTimePolled(false); - basetime += (now - froze) * 1000 / TICRATE; - } -} +void I_FreezeTimePolled (bool frozen) +{ + if (frozen) + { + assert(TicFrozen == 0); + TicFrozen = I_GetTimePolled(false); + } + else + { + assert(TicFrozen != 0); + int froze = TicFrozen; + TicFrozen = 0; + int now = I_GetTimePolled(false); + BaseTime += (now - froze) * 1000 / TICRATE; + } +} // Returns the fractional amount of a tic passed since the most recent tic fixed_t I_GetTimeFrac (uint32 *ms) diff --git a/src/sound/fmod_wrap.h b/src/sound/fmod_wrap.h index c20c784af..d2afc6ac6 100644 --- a/src/sound/fmod_wrap.h +++ b/src/sound/fmod_wrap.h @@ -193,6 +193,8 @@ namespace FMOD // Userdata set/get. FMOD_RESULT setUserData (void *userdata) { return FMOD_System_SetUserData(this, userdata); } FMOD_RESULT getUserData (void **userdata) { return FMOD_System_GetUserData(this, userdata); } + + FMOD_RESULT getMemoryInfo (unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, unsigned int *memoryused_array) { return FMOD_System_GetMemoryInfo(this, memorybits, event_memorybits, memoryused, memoryused_array); } }; /* @@ -256,6 +258,8 @@ namespace FMOD // Userdata set/get. FMOD_RESULT setUserData (void *userdata) { return FMOD_Sound_SetUserData(this, userdata); } FMOD_RESULT getUserData (void **userdata) { return FMOD_Sound_GetUserData(this, userdata); } + + FMOD_RESULT getMemoryInfo (unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, unsigned int *memoryused_array) { return FMOD_Sound_GetMemoryInfo(this, memorybits, event_memorybits, memoryused, memoryused_array); } }; /* @@ -299,7 +303,9 @@ namespace FMOD FMOD_RESULT setChannelGroup (ChannelGroup *channelgroup) { return FMOD_Channel_SetChannelGroup(this, (FMOD_CHANNELGROUP *)channelgroup); } FMOD_RESULT getChannelGroup (ChannelGroup **channelgroup) { return FMOD_Channel_GetChannelGroup(this, (FMOD_CHANNELGROUP **)channelgroup); } - FMOD_RESULT setCallback (FMOD_CHANNEL_CALLBACKTYPE type, FMOD_CHANNEL_CALLBACK callback, int command) { return FMOD_Channel_SetCallback(this, type, callback, command); } + FMOD_RESULT setCallback (FMOD_CHANNEL_CALLBACK callback) { return FMOD_Channel_SetCallback(this, callback); } + FMOD_RESULT setLowPassGain (float gain) { return FMOD_Channel_SetLowPassGain(this, gain); } + FMOD_RESULT getLowPassGain (float *gain) { return FMOD_Channel_GetLowPassGain(this, gain); } // 3D functionality. FMOD_RESULT set3DAttributes (const FMOD_VECTOR *pos, const FMOD_VECTOR *vel) { return FMOD_Channel_Set3DAttributes(this, pos, vel); } @@ -345,6 +351,8 @@ namespace FMOD // Userdata set/get. FMOD_RESULT setUserData (void *userdata) { return FMOD_Channel_SetUserData(this, userdata); } FMOD_RESULT getUserData (void **userdata) { return FMOD_Channel_GetUserData(this, userdata); } + + FMOD_RESULT getMemoryInfo (unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, unsigned int *memoryused_array) { return FMOD_Channel_GetMemoryInfo(this, memorybits, event_memorybits, memoryused, memoryused_array); } }; /* @@ -402,6 +410,8 @@ namespace FMOD // Userdata set/get. FMOD_RESULT setUserData (void *userdata) { return FMOD_ChannelGroup_SetUserData(this, userdata); } FMOD_RESULT getUserData (void **userdata) { return FMOD_ChannelGroup_GetUserData(this, userdata); } + + FMOD_RESULT getMemoryInfo (unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, unsigned int *memoryused_array) { return FMOD_ChannelGroup_GetMemoryInfo(this, memorybits, event_memorybits, memoryused, memoryused_array); } }; /* @@ -438,6 +448,8 @@ namespace FMOD // Userdata set/get. FMOD_RESULT setUserData (void *userdata) { return FMOD_SoundGroup_SetUserData(this, userdata); } FMOD_RESULT getUserData (void **userdata) { return FMOD_SoundGroup_GetUserData(this, userdata); } + + FMOD_RESULT getMemoryInfo (unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, unsigned int *memoryused_array) { return FMOD_SoundGroup_GetMemoryInfo(this, memorybits, event_memorybits, memoryused, memoryused_array); } }; /* @@ -489,6 +501,8 @@ namespace FMOD // Userdata set/get. FMOD_RESULT setUserData (void *userdata) { return FMOD_DSP_SetUserData(this, userdata); } FMOD_RESULT getUserData (void **userdata) { return FMOD_DSP_GetUserData(this, userdata); } + + FMOD_RESULT getMemoryInfo (unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, unsigned int *memoryused_array) { return FMOD_DSP_GetMemoryInfo(this, memorybits, event_memorybits, memoryused, memoryused_array); } }; @@ -514,6 +528,8 @@ namespace FMOD // Userdata set/get. FMOD_RESULT setUserData (void *userdata) { return FMOD_DSPConnection_SetUserData(this, userdata); } FMOD_RESULT getUserData (void **userdata) { return FMOD_DSPConnection_GetUserData(this, userdata); } + + FMOD_RESULT getMemoryInfo (unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, unsigned int *memoryused_array) { return FMOD_DSPConnection_GetMemoryInfo(this, memorybits, event_memorybits, memoryused, memoryused_array); } }; @@ -555,6 +571,8 @@ namespace FMOD // Userdata set/get. FMOD_RESULT setUserData (void *userdata) { return FMOD_Geometry_SetUserData(this, userdata); } FMOD_RESULT getUserData (void **userdata) { return FMOD_Geometry_GetUserData(this, userdata); } + + FMOD_RESULT getMemoryInfo (unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, unsigned int *memoryused_array) { return FMOD_Geometry_GetMemoryInfo(this, memorybits, event_memorybits, memoryused, memoryused_array); } }; @@ -583,6 +601,8 @@ namespace FMOD // Userdata set/get. FMOD_RESULT setUserData (void *userdata) { return FMOD_Reverb_SetUserData(this, userdata); } FMOD_RESULT getUserData (void **userdata) { return FMOD_Reverb_GetUserData(this, userdata); } + + FMOD_RESULT getMemoryInfo (unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, unsigned int *memoryused_array) { return FMOD_Reverb_GetMemoryInfo(this, memorybits, event_memorybits, memoryused, memoryused_array); } }; } diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index 9946edafa..2626e672c 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -1603,7 +1603,7 @@ FISoundChannel *FMODSoundRenderer::CommonChannelSetup(FMOD::Channel *chan, FISou chan->getDelay(FMOD_DELAYTYPE_DSPCLOCK_START, &schan->StartTime.Hi, &schan->StartTime.Lo); } chan->setUserData(schan); - chan->setCallback(FMOD_CHANNEL_CALLBACKTYPE_END, ChannelEndCallback, 0); + chan->setCallback(ChannelCallback); GRolloff = NULL; return schan; } @@ -2003,17 +2003,21 @@ unsigned int FMODSoundRenderer::GetSampleLength(SoundHandle sfx) //========================================================================== // -// FMODSoundRenderer :: ChannelEndCallback static +// FMODSoundRenderer :: ChannelCallback static // -// Called when the channel finishes playing. +// Handles when a channel finishes playing. This is only called when +// System::update is called and is therefore asynchronous with the actual +// end of the channel. // //========================================================================== -FMOD_RESULT F_CALLBACK FMODSoundRenderer::ChannelEndCallback - (FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, - int cmd, unsigned int data1, unsigned int data2) +FMOD_RESULT F_CALLBACK FMODSoundRenderer::ChannelCallback + (FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, void *data1, void *data2) { - assert(type == FMOD_CHANNEL_CALLBACKTYPE_END); + if (type != FMOD_CHANNEL_CALLBACKTYPE_END) + { + return FMOD_OK; + } FMOD::Channel *chan = (FMOD::Channel *)channel; FISoundChannel *schan; diff --git a/src/sound/fmodsound.h b/src/sound/fmodsound.h index db08885c2..96340869c 100644 --- a/src/sound/fmodsound.h +++ b/src/sound/fmodsound.h @@ -65,8 +65,7 @@ private: QWORD_UNION DSPClock; int OutputRate; - static FMOD_RESULT F_CALLBACK ChannelEndCallback - (FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, int cmd, unsigned int data1, unsigned int data2); + static FMOD_RESULT F_CALLBACK ChannelCallback(FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, void *data1, void *data2); static float F_CALLBACK RolloffCallback(FMOD_CHANNEL *channel, float distance); void HandleChannelDelay(FMOD::Channel *chan, FISoundChannel *reuse_chan, bool abstime, float freq) const; diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 3f610276e..e4c39310c 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -547,4 +547,4 @@ void InitThingdef() variables.ShrinkToFit(); qsort(&variables[0], variables.Size(), sizeof(variables[0]), varcmp); } -} \ No newline at end of file +} diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index a3cdee5b5..dc9c5f2d4 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -2666,7 +2666,7 @@ ExpVal FxMultiNameState::EvalExpression (AActor *self) { const char *dot=""; Printf("Jump target '"); - for (int i=0;i