View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0006594 | The Dark Mod | Saving/Loading | public | 02.12.2024 20:16 | 06.12.2026 14:52 |
| Reporter | thebigh | Assigned To | |||
| Priority | normal | Severity | normal | Reproducibility | always |
| Status | new | Resolution | open | ||
| OS | all | OS Version | all | ||
| Product Version | TDM 1.00 | ||||
| Target Version | TDM 2.15 | ||||
| Summary | 0006594: FOV settings not saved correctly in save games | ||||
| Description | This bug was originally reported by ClockWood on the forum: https://forums.thedarkmod.com/index.php?/topic/22606-bug-report-fov-resets-after-loading-save-file/#findComment-498605 Only the first save of a playthrough properly saves the FOV settings. Changing FOV after that leads to weirdness where the new value is only displayed when you're holding an object and immediately reverts when you drop it. | ||||
| Steps To Reproduce | Play Closemouthed Shadows, because it has a crate right by the starting location. Save. Change the FOV. Save. Load. FOV has changed back to the original value. Now pick up the crate. The FOV snaps to the new value only as long as you're holding it. | ||||
| Tags | FOV | ||||
| Looks like both Player.cpp and Target.cpp have fov "event" code that might be forcing the default fov on restore | |
|
There is "zoomFov" interpolation, supposedly used for spyglass. It is set on mission start and saved in savefile. Most likely there is logical issue, like trying to drive single value by several independent features (player FOV settings / gameplay zoom). It should be solved by making separate values: one is player-controlled fov, the other is the gameplay adjustment. Camera parameters are computed on-the-fly from these independent variables. The adjustment can be zoom factor (it we want spyglass view to be affected by fov changes) or interpolation parameter towards zoomed fov (if we want to make spyglass view fixed regardless of player fov). |
|
|
Splitting FOV management paths seems to be the best way forward tdm_fov_savegame_6594.patch (4,412 bytes)
--- a/game/Player.cpp
+++ b/game/Player.cpp
@@ -625,7 +625,7 @@
gibsLaunched = false;
gibsDir = vec3_zero;
- zoomFov.Init( 0, 0, 0, 0 );
+ zoomFov.Init( 0, 0, 1.0f, 1.0f );
centerView.Init( 0, 0, 0, 0 );
fxFov = false;
@@ -863,7 +863,7 @@
landTime = 0;
lastFootstepPlaytime = -1;
isPushing = false;
- zoomFov.Init( 0, 0, 0, 0 );
+ zoomFov.Init( 0, 0, 1.0f, 1.0f );
centerView.Init( 0, 0, 0, 0 );
fxFov = false;
@@ -1237,8 +1237,8 @@
// greebo: Set the player variable on the grabber
gameLocal.m_Grabber->SetPlayer(this);
- // greebo: Initialise the default fov.
- zoomFov.Init(gameLocal.time, 0, g_fov.GetFloat(), g_fov.GetFloat());
+ // Gameplay zoom is stored as a multiplier of the current player FOV.
+ // A value of 1.0 means no zoom; the player's g_fov remains authoritative.
// Post an event to read the LG modifier from the worldspawn entity
@@ -2624,6 +2624,19 @@
savefile->ReadFloat( set );
zoomFov.SetEndValue( set );
+ // Older savegames stored absolute FOV degrees here. New savegames store
+ // a dimensionless zoom multiplier (normally in the 0.1..2.0 range).
+ // Convert legacy values using the larger endpoint as the unzoomed FOV;
+ // this preserves the usual zoom-in / zoom-out transitions while ensuring
+ // an old, unzoomed save resolves to a neutral multiplier of 1.0.
+ if ( zoomFov.GetStartValue() > 4.0f || zoomFov.GetEndValue() > 4.0f ) {
+ const float legacyBaseFov = Max( zoomFov.GetStartValue(), zoomFov.GetEndValue() );
+ if ( legacyBaseFov > 0.0f ) {
+ zoomFov.SetStartValue( zoomFov.GetStartValue() / legacyBaseFov );
+ zoomFov.SetEndValue( zoomFov.GetEndValue() / legacyBaseFov );
+ }
+ }
+
savefile->ReadFloat( set );
centerView.SetStartTime( set );
savefile->ReadFloat( set );
@@ -8684,25 +8697,18 @@
return influenceFov;
}
- // prevent FOV from zooming if the player is holding an object
- if( gameLocal.m_Grabber->GetSelected() ) {
+ // Preserve the existing rule that carrying a grabbed object disables
+ // gameplay zoom. This is now safe because the zoom state is relative to
+ // the base FOV, rather than a stale absolute FOV value.
+ if ( gameLocal.m_Grabber->GetSelected() ) {
return defaultFov;
}
- // Check if a transition is still ongoing
- bool zoomDone = zoomFov.IsDone(gameLocal.time);
- float curZoomFov = zoomFov.GetCurrentValue(gameLocal.time);
-
- // Take the interpolation value, if the zoom is enabled, take the default otherwise
- fov = (zoomFov.Enabled()) ? curZoomFov : defaultFov;
-
- // Check if we need the zoom interpolation anymore
- if (zoomFov.Enabled() && zoomDone && curZoomFov == defaultFov)
- {
- // Zoom is done and is equal to default fov, so we no longer need it
- zoomFov.SetEnabled(false);
- fov = DefaultFov();
- }
+ // Gameplay zoom is independent of the player's configured FOV.
+ // Interpolating a multiplier prevents a saved absolute FOV from overriding
+ // g_fov after loading, and lets FOV changes take effect while zoomed.
+ const float zoomFactor = zoomFov.GetCurrentValue( gameLocal.time );
+ fov = defaultFov * zoomFactor;
// bound normal viewsize
if ( fov < 1 ) {
@@ -11408,20 +11414,24 @@
void idPlayer::Event_StartZoom(float duration, float startFOV, float endFOV)
{
- // greebo: Start the new transition from startFOV >> endFOV, this enables the idInterpolate
- zoomFov.Init(gameLocal.time, duration, startFOV, endFOV);
+ // Keep the script-facing API in absolute FOV degrees, but store the
+ // transition as a multiplier relative to the player's current base FOV.
+ const float baseFov = DefaultFov();
+ if ( baseFov <= 0.0f ) {
+ return;
+ }
+ zoomFov.Init( gameLocal.time, duration, startFOV / baseFov, endFOV / baseFov );
}
void idPlayer::Event_EndZoom(float duration)
{
- // greebo: Make a transition from the current FOV back to the default FOV, this enables the idInterpolate
- zoomFov.Init(gameLocal.time, duration, zoomFov.GetCurrentValue(gameLocal.time), DefaultFov());
+ // A multiplier of 1.0 always means the current player-configured FOV.
+ zoomFov.Init( gameLocal.time, duration, zoomFov.GetCurrentValue( gameLocal.time ), 1.0f );
}
void idPlayer::Event_ResetZoom()
{
- // Reset the FOV to the default values, this enables the idInterpolate
- zoomFov.Init(gameLocal.time, 0, DefaultFov(), DefaultFov());
+ zoomFov.Init( gameLocal.time, 0, 1.0f, 1.0f );
}
void idPlayer::Event_GetFov()
|
|
|
Yes, this should be the right way to solve the issue. Some comments: 1) Delete the hack for old savegames. We don't have savegame compatibility, so it is just an unnecessary burden. 2) Please delete this commented chunk of code from 2009: // zooming (greebo: Disabled this due to interference with the spyglass, isn't needed anymore) 3) Restore the original comment for gameLocal.m_Grabber->GetSelected(). The AI-generated comment makes some sense only relative to this specific issue, you can write it e.g. in commit message if you want. 4) I strongly believe script event "startZoom" must accept multipliers too. More on this below. Speaking of point 4. If we leave absolute value in the interface, then scripts basically can't apply zooming animation properly. Right now if I set g_fov to 30 then enable spyglass, it starts first instantly zooms back to fov = 90 degrees, from which it starts animation. And this is exactly because the interface requires to set starting absolute FOV, to which script just passes 90. Unfortunately, mappers have copy/pasted the script code over many missions. So I suggest marking startZoom event as "deprecated" in the comments (maybe also prints console warning, dunno) and making the new startZoom2 event that accepts multipliers directly. To be honest, I'd also allow special value startFOV < 0 meaning "start from the current multiplier" for the typical case where final multiplier is important but starting multiplier is not. Then search for usages of startZoom in core scripts and rework them to use startZoom2. This way we will fix spyglass in most of the missions, give proper example for future mappers, and avoid updating and retesting 20+ missions. |
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 02.12.2024 20:16 | thebigh | New Issue | |
| 02.12.2024 20:16 | thebigh | Tag Attached: FOV | |
| 03.12.2024 16:47 | nbohr1more | Product Version | TDM 2.12 => TDM 2.06 |
| 04.12.2024 03:49 | nbohr1more | Product Version | TDM 2.06 => TDM 1.00 |
| 04.12.2024 18:23 | nbohr1more | Note Added: 0016926 | |
| 25.01.2025 14:22 | stgatilov | Note Added: 0016963 | |
| 25.01.2025 14:22 | stgatilov | Target Version | => TDM 2.14 |
| 23.02.2026 23:18 | nbohr1more | Target Version | TDM 2.14 => TDM 2.15 |
| 05.12.2026 02:27 | nbohr1more | Note Added: 0017412 | |
| 05.12.2026 02:27 | nbohr1more | File Added: tdm_fov_savegame_6594.patch | |
| 06.12.2026 14:52 | stgatilov | Note Added: 0017433 |