4149: Always send correct zoom dimensions r=heinrich5991 a=fokkonaut

It is required to reset the Target after it being used, in order to not trigger [this code](https://github.com/ddnet/ddnet/blob/master/src/game/client/gameclient.cpp#L1599-L1605), which would always send the m_LastZoom. This fixes it and always sends the correct zooming dimensions.

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: fokkonaut <35420825+fokkonaut@users.noreply.github.com>
This commit is contained in:
bors[bot] 2021-09-10 23:10:56 +00:00 committed by GitHub
commit 1feea5f25c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -21,7 +21,6 @@ class CCamera : public CComponent
vec2 m_LastPos[NUM_DUMMIES];
vec2 m_PrevCenter;
bool m_Zooming;
CCubicBezier m_ZoomSmoothing;
float m_ZoomSmoothingStart;
float m_ZoomSmoothingEnd;
@ -36,6 +35,7 @@ class CCamera : public CComponent
public:
vec2 m_Center;
bool m_ZoomSet;
bool m_Zooming;
float m_Zoom;
float m_ZoomSmoothingTarget;

View file

@ -1596,7 +1596,7 @@ void CGameClient::OnNewSnapshot()
}
float ZoomToSend = m_Camera.m_Zoom;
if(m_Camera.m_ZoomSmoothingTarget != .0)
if(m_Camera.m_Zooming)
{
if(m_Camera.m_ZoomSmoothingTarget > m_Camera.m_Zoom) // Zooming out
ZoomToSend = m_Camera.m_ZoomSmoothingTarget;