Warzone2100 / warzone2100

Command the forces of The Project in a battle to rebuild the world after mankind has been nearly destroyed by nuclear missiles. A 100% free and open source real-time strategy game for Windows, macOS, Linux, BSD+
https://wz2100.net
GNU General Public License v2.0
3.22k stars 532 forks source link

Inconsistent Set View Distance behavior #4043

Open aco4 opened 2 months ago

aco4 commented 2 months ago

Keypad 5 is the keybind for "Reset Pitch". For some reason, it also resets the view distance (zoom).

keybind.cpp:

void    kf_ResetPitch()
{
    playerPos.r.x = DEG(360 + INITIAL_STARTING_PITCH);
    setViewDistance(STARTDISTANCE);
}

display3d.cpp:

void setViewDistance(float dist)
{
    distance = dist;
    debug(LOG_WZ, _("Setting zoom to %.0f"), distance);
}

This works fine UNLESS the camera is zoomed out to it's maximum distance. When fully zoomed out, Keypad 5 causes the camera to zoom in for a split-second, only to return to it's original zoom. If holding down Keypad 5, the camera will stay zoomed in until the key is released.

https://github.com/user-attachments/assets/ab4326ee-63ed-408e-b56e-b6a6fa1c6046

Expected Behavior

Keypad 5 resets the view distance and keeps it there, regardless of original view distance.

System

mirror176 commented 2 months ago

it also doesn't reset view to the same state the game starts at.

aco4 commented 2 months ago

@mirror176 What version are you playing? This should have been fixed in 4.5.2

mirror176 commented 2 months ago

Seems 4.4.2 was my last played version. If fixed that's great news that I'll look forward to seeing in the update.