- Fixed: The changecamera special should remove "past viewer" information

from the renderer in case the camera changed position or direction since
  the last time it was looked through. Otherwise, the renderer will
  interpolate from its previous view for one frame when it is switched to.
- Fixed non-POD parameter passing for GCC introduced in the previous commit.

SVN r476 (trunk)
This commit is contained in:
Randy Heit 2007-02-04 01:12:50 +00:00
parent 4a6fa7f2a3
commit 26b886b960
7 changed files with 60 additions and 16 deletions

View file

@ -1,4 +1,8 @@
February 3, 2007 February 3, 2007
- Fixed: The changecamera special should remove "past viewer" information
from the renderer in case the camera changed position or direction since
the last time it was looked through. Otherwise, the renderer will
interpolate from its previous view for one frame when it is switched to.
- Removed the 63-character limit on sound names. - Removed the 63-character limit on sound names.
- Reduced the rate at which drowning damage increases. - Reduced the rate at which drowning damage increases.
- Added more player water sounds: - Added more player water sounds:

View file

@ -2236,6 +2236,7 @@ FUNC(LS_ChangeCamera)
if (!playeringame[i]) if (!playeringame[i])
continue; continue;
AActor *oldcamera = players[i].camera;
if (camera) if (camera)
{ {
players[i].camera = camera; players[i].camera = camera;
@ -2247,10 +2248,15 @@ FUNC(LS_ChangeCamera)
players[i].camera = players[i].mo; players[i].camera = players[i].mo;
players[i].cheats &= ~CF_REVERTPLEASE; players[i].cheats &= ~CF_REVERTPLEASE;
} }
if (oldcamera != players[i].camera)
{
R_ClearPastViewer (players[i].camera);
}
} }
} }
else else
{ {
AActor *oldcamera = it->player->camera;
if (camera) if (camera)
{ {
it->player->camera = camera; it->player->camera = camera;
@ -2262,6 +2268,10 @@ FUNC(LS_ChangeCamera)
it->player->camera = it; it->player->camera = it;
it->player->cheats &= ~CF_REVERTPLEASE; it->player->cheats &= ~CF_REVERTPLEASE;
} }
if (oldcamera != it->player->camera)
{
R_ClearPastViewer (it->player->camera);
}
} }
return true; return true;

View file

@ -978,6 +978,33 @@ void R_FreePastViewers ()
PastViewers.Clear (); PastViewers.Clear ();
} }
//==========================================================================
//
// R_ClearPastViewer
//
// If the actor changed in a non-interpolatable way, remove it.
//
//==========================================================================
void R_ClearPastViewer (AActor *actor)
{
for (unsigned int i = 0; i < PastViewers.Size(); ++i)
{
if (PastViewers[i].ViewActor == actor)
{
// Found it, so remove it.
if (i == PastViewers.Size())
{
PastViewers.Delete (i);
}
else
{
PastViewers.Pop (PastViewers[i]);
}
}
}
}
//========================================================================== //==========================================================================
// //
// R_CopyStackedViewParameters // R_CopyStackedViewParameters

View file

@ -261,6 +261,7 @@ void clearinterpolations();
void SerializeInterpolations(FArchive &arc); void SerializeInterpolations(FArchive &arc);
extern void R_FreePastViewers (); extern void R_FreePastViewers ();
extern void R_ClearPastViewer (AActor *actor);
extern int stacked_extralight; extern int stacked_extralight;
extern float stacked_visibility; extern float stacked_visibility;

View file

@ -1642,30 +1642,30 @@ CCMD (soundlist)
const sfxinfo_t *sfx = &S_sfx[i]; const sfxinfo_t *sfx = &S_sfx[i];
if (sfx->bRandomHeader) if (sfx->bRandomHeader)
{ {
Printf ("%3d. %s -> #%d {", i, sfx->name, sfx->link); Printf ("%3d. %s -> #%d {", i, sfx->name.GetChars(), sfx->link);
const FRandomSoundList *list = &S_rnd[sfx->link]; const FRandomSoundList *list = &S_rnd[sfx->link];
for (size_t j = 0; j < list->NumSounds; ++j) for (size_t j = 0; j < list->NumSounds; ++j)
{ {
Printf (" %s ", S_sfx[list->Sounds[j]].name); Printf (" %s ", S_sfx[list->Sounds[j]].name.GetChars());
} }
Printf ("}\n"); Printf ("}\n");
} }
else if (sfx->bPlayerReserve) else if (sfx->bPlayerReserve)
{ {
Printf ("%3d. %s <<player sound %d>>\n", i, sfx->name, sfx->link); Printf ("%3d. %s <<player sound %d>>\n", i, sfx->name.GetChars(), sfx->link);
} }
else if (S_sfx[i].lumpnum != -1) else if (S_sfx[i].lumpnum != -1)
{ {
Wads.GetLumpName (lumpname, sfx->lumpnum); Wads.GetLumpName (lumpname, sfx->lumpnum);
Printf ("%3d. %s (%s)\n", i, sfx->name, lumpname); Printf ("%3d. %s (%s)\n", i, sfx->name.GetChars(), lumpname);
} }
else if (S_sfx[i].link != sfxinfo_t::NO_LINK) else if (S_sfx[i].link != sfxinfo_t::NO_LINK)
{ {
Printf ("%3d. %s -> %s\n", i, sfx->name, S_sfx[sfx->link].name); Printf ("%3d. %s -> %s\n", i, sfx->name.GetChars(), S_sfx[sfx->link].name.GetChars());
} }
else else
{ {
Printf ("%3d. %s **not present**\n", i, sfx->name); Printf ("%3d. %s **not present**\n", i, sfx->name.GetChars());
} }
} }
} }
@ -1688,7 +1688,7 @@ CCMD (soundlinks)
!sfx->bRandomHeader && !sfx->bRandomHeader &&
!sfx->bPlayerReserve) !sfx->bPlayerReserve)
{ {
Printf ("%s -> %s\n", sfx->name, S_sfx[sfx->link].name); Printf ("%s -> %s\n", sfx->name.GetChars(), S_sfx[sfx->link].name.GetChars());
} }
} }
} }
@ -1722,10 +1722,10 @@ CCMD (playersounds)
{ {
if ((l = PlayerClassLookups[i].ListIndex[j]) != 0xffff) if ((l = PlayerClassLookups[i].ListIndex[j]) != 0xffff)
{ {
Printf ("\n%s, %s:\n", PlayerClassLookups[i].Name, GenderNames[j]); Printf ("\n%s, %s:\n", PlayerClassLookups[i].Name.GetChars(), GenderNames[j]);
for (k = 0; k < NumPlayerReserves; ++k) for (k = 0; k < NumPlayerReserves; ++k)
{ {
Printf (" %-16s%s\n", reserveNames[k], S_sfx[PlayerSounds[l].LookupSound (k)].name); Printf (" %-16s%s\n", reserveNames[k], S_sfx[PlayerSounds[l].LookupSound (k)].name.GetChars());
} }
} }
} }

View file

@ -701,7 +701,7 @@ long FMODSoundRenderer::StartSound (sfxinfo_t *sfx, int vol, int sep, int pitch,
return channel + 1; return channel + 1;
} }
DPrintf ("Sound %s failed to play: %d\n", sfx->name, FSOUND_GetError ()); DPrintf ("Sound %s failed to play: %d\n", sfx->name.GetChars(), FSOUND_GetError ());
return 0; return 0;
} }
@ -737,7 +737,7 @@ long FMODSoundRenderer::StartSound3D (sfxinfo_t *sfx, float vol, int pitch, int
return channel + 1; return channel + 1;
} }
DPrintf ("Sound %s failed to play: %d (%d)\n", sfx->name, FSOUND_GetError (), FSOUND_GetChannelsPlaying ()); DPrintf ("Sound %s failed to play: %d (%d)\n", sfx->name.GetChars(), FSOUND_GetError (), FSOUND_GetChannelsPlaying ());
return 0; return 0;
} }
@ -941,7 +941,7 @@ void FMODSoundRenderer::LoadSound (sfxinfo_t *sfx)
{ {
if (!sfx->data) if (!sfx->data)
{ {
DPrintf ("loading sound \"%s\" (%d) ", sfx->name, sfx - &S_sfx[0]); DPrintf ("loading sound \"%s\" (%d) ", sfx->name.GetChars(), sfx - &S_sfx[0]);
getsfx (sfx); getsfx (sfx);
} }
} }
@ -965,7 +965,7 @@ void FMODSoundRenderer::UnloadSound (sfxinfo_t *sfx)
sfx->data = NULL; sfx->data = NULL;
} }
DPrintf ("Unloaded sound \"%s\" (%d)\n", sfx->name, sfx - &S_sfx[0]); DPrintf ("Unloaded sound \"%s\" (%d)\n", sfx->name.GetChars(), sfx - &S_sfx[0]);
} }
// FSOUND_Sample_Upload seems to mess up the signedness of sound data when // FSOUND_Sample_Upload seems to mess up the signedness of sound data when
@ -1203,7 +1203,7 @@ void FMODSoundRenderer::getsfx (sfxinfo_t *sfx)
{ {
if (S_sfx[i].data && S_sfx[i].link == sfxinfo_t::NO_LINK && S_sfx[i].lumpnum == sfx->lumpnum) if (S_sfx[i].data && S_sfx[i].link == sfxinfo_t::NO_LINK && S_sfx[i].lumpnum == sfx->lumpnum)
{ {
DPrintf ("Linked to %s (%d)\n", S_sfx[i].name, i); DPrintf ("Linked to %s (%d)\n", S_sfx[i].name.GetChars(), i);
sfx->link = i; sfx->link = i;
sfx->ms = S_sfx[i].ms; sfx->ms = S_sfx[i].ms;
return; return;

View file

@ -130,8 +130,10 @@ public:
if (index < Count) if (index < Count)
{ {
Array[index].~T(); Array[index].~T();
memmove (&Array[index], &Array[index+1], sizeof(T)*(Count - index - 1)); if (index < --Count)
Count--; {
memmove (&Array[index], &Array[index+1], sizeof(T)*(Count - index));
}
} }
} }
// Inserts an item into the array, shifting elements as needed // Inserts an item into the array, shifting elements as needed