mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
Merge pull request #7585 from ChillerDragon/pr_optional_tele
Make intersect TeleNr arg optional
This commit is contained in:
commit
0ffab44dea
|
@ -202,8 +202,7 @@ void CPlayers::RenderHookCollLine(
|
||||||
DoBreak = true;
|
DoBreak = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TeleNr = 0;
|
int Hit = Collision()->IntersectLineTeleHook(OldPos, NewPos, &FinishPos, 0x0);
|
||||||
int Hit = Collision()->IntersectLineTeleHook(OldPos, NewPos, &FinishPos, 0x0, &TeleNr);
|
|
||||||
|
|
||||||
if(!DoBreak && Hit)
|
if(!DoBreak && Hit)
|
||||||
{
|
{
|
||||||
|
|
|
@ -99,11 +99,9 @@ void CLaser::DoBounce()
|
||||||
vec2 Coltile;
|
vec2 Coltile;
|
||||||
|
|
||||||
int Res;
|
int Res;
|
||||||
int z;
|
|
||||||
|
|
||||||
vec2 To = m_Pos + m_Dir * m_Energy;
|
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)
|
if(Res)
|
||||||
{
|
{
|
||||||
|
|
|
@ -336,11 +336,14 @@ int CCollision::IntersectLineTeleHook(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision,
|
||||||
int iy = round_to_int(Pos.y);
|
int iy = round_to_int(Pos.y);
|
||||||
|
|
||||||
int Index = GetPureMapIndex(Pos);
|
int Index = GetPureMapIndex(Pos);
|
||||||
if(g_Config.m_SvOldTeleportHook)
|
if(pTeleNr)
|
||||||
*pTeleNr = IsTeleport(Index);
|
{
|
||||||
else
|
if(g_Config.m_SvOldTeleportHook)
|
||||||
*pTeleNr = IsTeleportHook(Index);
|
*pTeleNr = IsTeleport(Index);
|
||||||
if(*pTeleNr)
|
else
|
||||||
|
*pTeleNr = IsTeleportHook(Index);
|
||||||
|
}
|
||||||
|
if(pTeleNr && *pTeleNr)
|
||||||
{
|
{
|
||||||
if(pOutCollision)
|
if(pOutCollision)
|
||||||
*pOutCollision = Pos;
|
*pOutCollision = Pos;
|
||||||
|
@ -391,11 +394,14 @@ int CCollision::IntersectLineTeleWeapon(vec2 Pos0, vec2 Pos1, vec2 *pOutCollisio
|
||||||
int iy = round_to_int(Pos.y);
|
int iy = round_to_int(Pos.y);
|
||||||
|
|
||||||
int Index = GetPureMapIndex(Pos);
|
int Index = GetPureMapIndex(Pos);
|
||||||
if(g_Config.m_SvOldTeleportWeapons)
|
if(pTeleNr)
|
||||||
*pTeleNr = IsTeleport(Index);
|
{
|
||||||
else
|
if(g_Config.m_SvOldTeleportWeapons)
|
||||||
*pTeleNr = IsTeleportWeapon(Index);
|
*pTeleNr = IsTeleport(Index);
|
||||||
if(*pTeleNr)
|
else
|
||||||
|
*pTeleNr = IsTeleportWeapon(Index);
|
||||||
|
}
|
||||||
|
if(pTeleNr && *pTeleNr)
|
||||||
{
|
{
|
||||||
if(pOutCollision)
|
if(pOutCollision)
|
||||||
*pOutCollision = Pos;
|
*pOutCollision = Pos;
|
||||||
|
|
|
@ -39,8 +39,8 @@ public:
|
||||||
int GetWidth() const { return m_Width; }
|
int GetWidth() const { return m_Width; }
|
||||||
int GetHeight() const { return m_Height; }
|
int GetHeight() const { return m_Height; }
|
||||||
int IntersectLine(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision) const;
|
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 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) 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 MovePoint(vec2 *pInoutPos, vec2 *pInoutVel, float Elasticity, int *pBounces) const;
|
||||||
void MoveBox(vec2 *pInoutPos, vec2 *pInoutVel, vec2 Size, vec2 Elasticity, bool *pGrounded = nullptr) const;
|
void MoveBox(vec2 *pInoutPos, vec2 *pInoutVel, vec2 Size, vec2 Elasticity, bool *pGrounded = nullptr) const;
|
||||||
bool TestBox(vec2 Pos, vec2 Size) const;
|
bool TestBox(vec2 Pos, vec2 Size) const;
|
||||||
|
|
Loading…
Reference in a new issue