diff --git a/docs/rh-log.txt b/docs/rh-log.txt index db53012cd..8580b0a51 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,8 @@ 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. - Reduced the rate at which drowning damage increases. - Added more player water sounds: diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 7ab3d0558..d5febfcc1 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -2236,6 +2236,7 @@ FUNC(LS_ChangeCamera) if (!playeringame[i]) continue; + AActor *oldcamera = players[i].camera; if (camera) { players[i].camera = camera; @@ -2247,10 +2248,15 @@ FUNC(LS_ChangeCamera) players[i].camera = players[i].mo; players[i].cheats &= ~CF_REVERTPLEASE; } + if (oldcamera != players[i].camera) + { + R_ClearPastViewer (players[i].camera); + } } } else { + AActor *oldcamera = it->player->camera; if (camera) { it->player->camera = camera; @@ -2262,6 +2268,10 @@ FUNC(LS_ChangeCamera) it->player->camera = it; it->player->cheats &= ~CF_REVERTPLEASE; } + if (oldcamera != it->player->camera) + { + R_ClearPastViewer (it->player->camera); + } } return true; diff --git a/src/r_main.cpp b/src/r_main.cpp index 837f00df7..9aad0b3dc 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -978,6 +978,33 @@ void R_FreePastViewers () 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 diff --git a/src/r_main.h b/src/r_main.h index 0ae0a8a04..4914a7bb3 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -261,6 +261,7 @@ void clearinterpolations(); void SerializeInterpolations(FArchive &arc); extern void R_FreePastViewers (); +extern void R_ClearPastViewer (AActor *actor); extern int stacked_extralight; extern float stacked_visibility; diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index 4b22a289f..ada2aaa43 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -1642,30 +1642,30 @@ CCMD (soundlist) const sfxinfo_t *sfx = &S_sfx[i]; 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]; 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"); } else if (sfx->bPlayerReserve) { - Printf ("%3d. %s <>\n", i, sfx->name, sfx->link); + Printf ("%3d. %s <>\n", i, sfx->name.GetChars(), sfx->link); } else if (S_sfx[i].lumpnum != -1) { 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) { - 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 { - 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->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) { - 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) { - 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()); } } } diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index 656ea1b5d..e10f33d82 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -701,7 +701,7 @@ long FMODSoundRenderer::StartSound (sfxinfo_t *sfx, int vol, int sep, int pitch, 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; } @@ -737,7 +737,7 @@ long FMODSoundRenderer::StartSound3D (sfxinfo_t *sfx, float vol, int pitch, int 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; } @@ -941,7 +941,7 @@ void FMODSoundRenderer::LoadSound (sfxinfo_t *sfx) { 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); } } @@ -965,7 +965,7 @@ void FMODSoundRenderer::UnloadSound (sfxinfo_t *sfx) 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 @@ -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) { - 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->ms = S_sfx[i].ms; return; diff --git a/src/tarray.h b/src/tarray.h index 0edf61333..21cb4d38b 100644 --- a/src/tarray.h +++ b/src/tarray.h @@ -130,8 +130,10 @@ public: if (index < Count) { Array[index].~T(); - memmove (&Array[index], &Array[index+1], sizeof(T)*(Count - index - 1)); - Count--; + if (index < --Count) + { + memmove (&Array[index], &Array[index+1], sizeof(T)*(Count - index)); + } } } // Inserts an item into the array, shifting elements as needed