diff --git a/src/game/client/components/players.cpp b/src/game/client/components/players.cpp index 87cd222a0..e4ef6aec8 100644 --- a/src/game/client/components/players.cpp +++ b/src/game/client/components/players.cpp @@ -202,8 +202,7 @@ void CPlayers::RenderHookCollLine( DoBreak = true; } - int TeleNr = 0; - int Hit = Collision()->IntersectLineTeleHook(OldPos, NewPos, &FinishPos, 0x0, &TeleNr); + int Hit = Collision()->IntersectLineTeleHook(OldPos, NewPos, &FinishPos, 0x0); if(!DoBreak && Hit) { diff --git a/src/game/client/prediction/entities/laser.cpp b/src/game/client/prediction/entities/laser.cpp index 1f377192a..6b0fb9247 100644 --- a/src/game/client/prediction/entities/laser.cpp +++ b/src/game/client/prediction/entities/laser.cpp @@ -99,11 +99,9 @@ void CLaser::DoBounce() vec2 Coltile; int Res; - int z; - vec2 To = m_Pos + m_Dir * m_Energy; - Res = Collision()->IntersectLineTeleWeapon(m_Pos, To, &Coltile, &To, &z); + Res = Collision()->IntersectLineTeleWeapon(m_Pos, To, &Coltile, &To); if(Res) { diff --git a/src/game/collision.cpp b/src/game/collision.cpp index ef5edb117..5306d589b 100644 --- a/src/game/collision.cpp +++ b/src/game/collision.cpp @@ -336,11 +336,14 @@ int CCollision::IntersectLineTeleHook(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, int iy = round_to_int(Pos.y); int Index = GetPureMapIndex(Pos); - if(g_Config.m_SvOldTeleportHook) - *pTeleNr = IsTeleport(Index); - else - *pTeleNr = IsTeleportHook(Index); - if(*pTeleNr) + if(pTeleNr) + { + if(g_Config.m_SvOldTeleportHook) + *pTeleNr = IsTeleport(Index); + else + *pTeleNr = IsTeleportHook(Index); + } + if(pTeleNr && *pTeleNr) { if(pOutCollision) *pOutCollision = Pos; @@ -391,11 +394,14 @@ int CCollision::IntersectLineTeleWeapon(vec2 Pos0, vec2 Pos1, vec2 *pOutCollisio int iy = round_to_int(Pos.y); int Index = GetPureMapIndex(Pos); - if(g_Config.m_SvOldTeleportWeapons) - *pTeleNr = IsTeleport(Index); - else - *pTeleNr = IsTeleportWeapon(Index); - if(*pTeleNr) + if(pTeleNr) + { + if(g_Config.m_SvOldTeleportWeapons) + *pTeleNr = IsTeleport(Index); + else + *pTeleNr = IsTeleportWeapon(Index); + } + if(pTeleNr && *pTeleNr) { if(pOutCollision) *pOutCollision = Pos; diff --git a/src/game/collision.h b/src/game/collision.h index fa697f6ed..ceccc03d4 100644 --- a/src/game/collision.h +++ b/src/game/collision.h @@ -39,8 +39,8 @@ public: int GetWidth() const { return m_Width; } int GetHeight() const { return m_Height; } int IntersectLine(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision) const; - int IntersectLineTeleWeapon(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision, int *pTeleNr) const; - int IntersectLineTeleHook(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision, int *pTeleNr) const; + int IntersectLineTeleWeapon(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision, int *pTeleNr = nullptr) const; + int IntersectLineTeleHook(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision, int *pTeleNr = nullptr) const; void MovePoint(vec2 *pInoutPos, vec2 *pInoutVel, float Elasticity, int *pBounces) const; void MoveBox(vec2 *pInoutPos, vec2 *pInoutVel, vec2 Size, vec2 Elasticity, bool *pGrounded = nullptr) const; bool TestBox(vec2 Pos, vec2 Size) const;