- 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.


SVN r1286 (trunk)
This commit is contained in:
Randy Heit 2008-11-09 05:50:54 +00:00
parent fb1af415f5
commit c1cefee2f4
8 changed files with 68 additions and 34 deletions

View file

@ -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) November 2, 2008 (Changes by Graf Zahl)
- Fixed: The TEXTURES parser didn't report an error for invalid keywords. - Fixed: The TEXTURES parser didn't report an error for invalid keywords.
- Fixed: The DECORATE expression evaluator was too strict with missing jump labels. - Fixed: The DECORATE expression evaluator was too strict with missing jump labels.

View file

@ -87,7 +87,7 @@ DWORD LanguageIDs[4] =
int (*I_GetTime) (bool saveMS); int (*I_GetTime) (bool saveMS);
int (*I_WaitForTic) (int); int (*I_WaitForTic) (int);
void (*I_FreezTime) (bool frozen); void (*I_FreezeTime) (bool frozen);
void I_Tactile (int on, int off, int total) void I_Tactile (int on, int off, int total)
{ {
@ -117,6 +117,7 @@ unsigned int I_MSTime (void)
static DWORD TicStart; static DWORD TicStart;
static DWORD TicNext; static DWORD TicNext;
static DWORD BaseTime;
static int TicFrozen; static int TicFrozen;
// //
@ -131,13 +132,17 @@ int I_GetTimePolled (bool saveMS)
} }
DWORD tm = SDL_GetTicks (); DWORD tm = SDL_GetTicks ();
if (BaseTime == 0)
{
BaseTime = tm;
}
if (saveMS) if (saveMS)
{ {
TicStart = tm; TicStart = tm;
TicNext = Scale ((Scale (tm, TICRATE, 1000) + 1), 1000, TICRATE); 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) int I_WaitForTicPolled (int prevtic)
@ -151,22 +156,22 @@ int I_WaitForTicPolled (int prevtic)
return time; return time;
} }
void I_FreezeTimePolled (bool frozen) void I_FreezeTimePolled (bool frozen)
{ {
if (frozen) if (frozen)
{ {
assert(TicFrozen == 0); assert(TicFrozen == 0);
TicFrozen = I_GetTimePolled(false); TicFrozen = I_GetTimePolled(false);
} }
else else
{ {
assert(TicFrozen != 0); assert(TicFrozen != 0);
int froze = TicFrozen; int froze = TicFrozen;
TicFrozen = 0; TicFrozen = 0;
int now = I_GetTimePolled(false); int now = I_GetTimePolled(false);
basetime += (now - froze) * 1000 / TICRATE; BaseTime += (now - froze) * 1000 / TICRATE;
} }
} }
// Returns the fractional amount of a tic passed since the most recent tic // Returns the fractional amount of a tic passed since the most recent tic
fixed_t I_GetTimeFrac (uint32 *ms) fixed_t I_GetTimeFrac (uint32 *ms)

View file

@ -193,6 +193,8 @@ namespace FMOD
// Userdata set/get. // Userdata set/get.
FMOD_RESULT setUserData (void *userdata) { return FMOD_System_SetUserData(this, userdata); } FMOD_RESULT setUserData (void *userdata) { return FMOD_System_SetUserData(this, userdata); }
FMOD_RESULT getUserData (void **userdata) { return FMOD_System_GetUserData(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. // Userdata set/get.
FMOD_RESULT setUserData (void *userdata) { return FMOD_Sound_SetUserData(this, userdata); } FMOD_RESULT setUserData (void *userdata) { return FMOD_Sound_SetUserData(this, userdata); }
FMOD_RESULT getUserData (void **userdata) { return FMOD_Sound_GetUserData(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 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 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. // 3D functionality.
FMOD_RESULT set3DAttributes (const FMOD_VECTOR *pos, const FMOD_VECTOR *vel) { return FMOD_Channel_Set3DAttributes(this, pos, vel); } 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. // Userdata set/get.
FMOD_RESULT setUserData (void *userdata) { return FMOD_Channel_SetUserData(this, userdata); } FMOD_RESULT setUserData (void *userdata) { return FMOD_Channel_SetUserData(this, userdata); }
FMOD_RESULT getUserData (void **userdata) { return FMOD_Channel_GetUserData(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. // Userdata set/get.
FMOD_RESULT setUserData (void *userdata) { return FMOD_ChannelGroup_SetUserData(this, userdata); } FMOD_RESULT setUserData (void *userdata) { return FMOD_ChannelGroup_SetUserData(this, userdata); }
FMOD_RESULT getUserData (void **userdata) { return FMOD_ChannelGroup_GetUserData(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. // Userdata set/get.
FMOD_RESULT setUserData (void *userdata) { return FMOD_SoundGroup_SetUserData(this, userdata); } FMOD_RESULT setUserData (void *userdata) { return FMOD_SoundGroup_SetUserData(this, userdata); }
FMOD_RESULT getUserData (void **userdata) { return FMOD_SoundGroup_GetUserData(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. // Userdata set/get.
FMOD_RESULT setUserData (void *userdata) { return FMOD_DSP_SetUserData(this, userdata); } FMOD_RESULT setUserData (void *userdata) { return FMOD_DSP_SetUserData(this, userdata); }
FMOD_RESULT getUserData (void **userdata) { return FMOD_DSP_GetUserData(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. // Userdata set/get.
FMOD_RESULT setUserData (void *userdata) { return FMOD_DSPConnection_SetUserData(this, userdata); } FMOD_RESULT setUserData (void *userdata) { return FMOD_DSPConnection_SetUserData(this, userdata); }
FMOD_RESULT getUserData (void **userdata) { return FMOD_DSPConnection_GetUserData(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. // Userdata set/get.
FMOD_RESULT setUserData (void *userdata) { return FMOD_Geometry_SetUserData(this, userdata); } FMOD_RESULT setUserData (void *userdata) { return FMOD_Geometry_SetUserData(this, userdata); }
FMOD_RESULT getUserData (void **userdata) { return FMOD_Geometry_GetUserData(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. // Userdata set/get.
FMOD_RESULT setUserData (void *userdata) { return FMOD_Reverb_SetUserData(this, userdata); } FMOD_RESULT setUserData (void *userdata) { return FMOD_Reverb_SetUserData(this, userdata); }
FMOD_RESULT getUserData (void **userdata) { return FMOD_Reverb_GetUserData(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); }
}; };
} }

View file

@ -1603,7 +1603,7 @@ FISoundChannel *FMODSoundRenderer::CommonChannelSetup(FMOD::Channel *chan, FISou
chan->getDelay(FMOD_DELAYTYPE_DSPCLOCK_START, &schan->StartTime.Hi, &schan->StartTime.Lo); chan->getDelay(FMOD_DELAYTYPE_DSPCLOCK_START, &schan->StartTime.Hi, &schan->StartTime.Lo);
} }
chan->setUserData(schan); chan->setUserData(schan);
chan->setCallback(FMOD_CHANNEL_CALLBACKTYPE_END, ChannelEndCallback, 0); chan->setCallback(ChannelCallback);
GRolloff = NULL; GRolloff = NULL;
return schan; 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_RESULT F_CALLBACK FMODSoundRenderer::ChannelCallback
(FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, (FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, void *data1, void *data2)
int cmd, unsigned int data1, unsigned int data2)
{ {
assert(type == FMOD_CHANNEL_CALLBACKTYPE_END); if (type != FMOD_CHANNEL_CALLBACKTYPE_END)
{
return FMOD_OK;
}
FMOD::Channel *chan = (FMOD::Channel *)channel; FMOD::Channel *chan = (FMOD::Channel *)channel;
FISoundChannel *schan; FISoundChannel *schan;

View file

@ -65,8 +65,7 @@ private:
QWORD_UNION DSPClock; QWORD_UNION DSPClock;
int OutputRate; int OutputRate;
static FMOD_RESULT F_CALLBACK ChannelEndCallback static FMOD_RESULT F_CALLBACK ChannelCallback(FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, void *data1, void *data2);
(FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, int cmd, unsigned int data1, unsigned int data2);
static float F_CALLBACK RolloffCallback(FMOD_CHANNEL *channel, float distance); static float F_CALLBACK RolloffCallback(FMOD_CHANNEL *channel, float distance);
void HandleChannelDelay(FMOD::Channel *chan, FISoundChannel *reuse_chan, bool abstime, float freq) const; void HandleChannelDelay(FMOD::Channel *chan, FISoundChannel *reuse_chan, bool abstime, float freq) const;

View file

@ -547,4 +547,4 @@ void InitThingdef()
variables.ShrinkToFit(); variables.ShrinkToFit();
qsort(&variables[0], variables.Size(), sizeof(variables[0]), varcmp); qsort(&variables[0], variables.Size(), sizeof(variables[0]), varcmp);
} }
} }

View file

@ -2666,7 +2666,7 @@ ExpVal FxMultiNameState::EvalExpression (AActor *self)
{ {
const char *dot=""; const char *dot="";
Printf("Jump target '"); Printf("Jump target '");
for (int i=0;i<names.Size();i++) for (unsigned int i=0;i<names.Size();i++)
{ {
Printf("%s%s", dot, names[i].GetChars()); Printf("%s%s", dot, names[i].GetChars());
dot = "."; dot = ".";
@ -2695,7 +2695,7 @@ FStateExpressions StateParams;
FStateExpressions::~FStateExpressions() FStateExpressions::~FStateExpressions()
{ {
for(unsigned i=0; i<Size(); i++) for(int i=0; i<Size(); i++)
{ {
if (expressions[i].expr != NULL && !expressions[i].cloned) if (expressions[i].expr != NULL && !expressions[i].cloned)
{ {
@ -2785,7 +2785,7 @@ int FStateExpressions::ResolveAll()
FCompileContext ctx; FCompileContext ctx;
ctx.lax = true; ctx.lax = true;
for(unsigned i=0; i<Size(); i++) for(int i=0; i<Size(); i++)
{ {
if (expressions[i].cloned) if (expressions[i].cloned)
{ {
@ -2810,7 +2810,7 @@ int FStateExpressions::ResolveAll()
} }
} }
for(unsigned i=0; i<Size(); i++) for(int i=0; i<Size(); i++)
{ {
if (expressions[i].expr != NULL) if (expressions[i].expr != NULL)
{ {

View file

@ -93,4 +93,4 @@ struct FExpressionType
}; };
#endif #endif