mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Better Stoppers System
Signed-off-by: GreYFoXGTi <GreYFoXGTi@GMaiL.CoM>
This commit is contained in:
parent
9a5acbbba6
commit
fe20420666
|
@ -563,10 +563,10 @@ void CCharacter::OnDirectInput(CNetObj_PlayerInput *pNewInput)
|
|||
void CCharacter::Tick()
|
||||
{
|
||||
int MapIndex = GameServer()->Collision()->GetMapIndex(m_PrevPos, m_Pos);
|
||||
int MapIndexL = GameServer()->Collision()->GetMapIndex(m_PrevPos, vec2(m_Pos.x + m_ProximityRadius/2,m_Pos.y));
|
||||
int MapIndexR = GameServer()->Collision()->GetMapIndex(m_PrevPos, vec2(m_Pos.x - m_ProximityRadius/2,m_Pos.y));
|
||||
int MapIndexT = GameServer()->Collision()->GetMapIndex(m_PrevPos, vec2(m_Pos.x,m_Pos.y + m_ProximityRadius/2+5));
|
||||
int MapIndexB = GameServer()->Collision()->GetMapIndex(m_PrevPos, vec2(m_Pos.x,m_Pos.y - m_ProximityRadius/2-5));
|
||||
int MapIndexL = GameServer()->Collision()->GetMapIndex(m_PrevPos, vec2(m_Pos.x + m_ProximityRadius/2+1,m_Pos.y));
|
||||
int MapIndexR = GameServer()->Collision()->GetMapIndex(m_PrevPos, vec2(m_Pos.x - m_ProximityRadius/2+1,m_Pos.y));
|
||||
int MapIndexT = GameServer()->Collision()->GetMapIndex(m_PrevPos, vec2(m_Pos.x,m_Pos.y + m_ProximityRadius/2+6));
|
||||
int MapIndexB = GameServer()->Collision()->GetMapIndex(m_PrevPos, vec2(m_Pos.x,m_Pos.y - m_ProximityRadius/2-4));
|
||||
int TileIndex = GameServer()->Collision()->GetCollisionDDRace(MapIndex);
|
||||
int TileFIndex = GameServer()->Collision()->GetFCollisionDDRace(MapIndex);
|
||||
int TileIndexL = GameServer()->Collision()->GetCollisionDDRace(MapIndexL);
|
||||
|
@ -702,7 +702,7 @@ void CCharacter::Tick()
|
|||
m_RefreshTime = Server()->Tick();
|
||||
m_RaceState = RACE_STARTED;
|
||||
}
|
||||
|
||||
|
||||
if(((TileIndex == TILE_END) || (TileFIndex == TILE_END)) && m_RaceState == RACE_STARTED)
|
||||
{
|
||||
char aBuf[128];
|
||||
|
@ -783,101 +783,26 @@ void CCharacter::Tick()
|
|||
{
|
||||
UnFreeze();
|
||||
}
|
||||
|
||||
if(TileIndex == TILE_STOPL || TileIndexL == TILE_STOPL || TileFIndex == TILE_STOPL || TileFIndexL == TILE_STOPL)
|
||||
if((TileIndexT == TILE_STOPA || TileFIndexT == TILE_STOPA || TileIndex == TILE_STOPT || TileIndexT == TILE_STOPT || TileFIndex == TILE_STOPT || TileFIndexT == TILE_STOPT || TileIndexT == TILE_STOPV || TileFIndexT == TILE_STOPV) && m_Core.m_Vel.y > 0)
|
||||
{
|
||||
if(m_Core.m_Vel.x > 0)
|
||||
{
|
||||
m_Core.m_Pos.x = m_PrevPos.x;
|
||||
m_Core.m_Vel.x = 0;
|
||||
}
|
||||
}
|
||||
if(TileIndex == TILE_STOPR || TileIndexR == TILE_STOPR || TileFIndex == TILE_STOPR || TileFIndexR == TILE_STOPR)
|
||||
{
|
||||
if(m_Core.m_Vel.x < 0)
|
||||
{
|
||||
m_Core.m_Pos.x = m_PrevPos.x;
|
||||
m_Core.m_Vel.x = 0;
|
||||
}
|
||||
}
|
||||
if(TileIndex == TILE_STOPB || TileIndexB == TILE_STOPB || TileFIndex == TILE_STOPB || TileFIndexB == TILE_STOPB)
|
||||
{
|
||||
if(m_Core.m_Vel.y < 0)
|
||||
{
|
||||
m_Core.m_Pos.y = m_PrevPos.y;
|
||||
m_Core.m_Vel.y = 0;
|
||||
}
|
||||
}
|
||||
if(TileIndex == TILE_STOPT || TileIndexT == TILE_STOPT || TileFIndex == TILE_STOPT || TileFIndexT == TILE_STOPT)
|
||||
{
|
||||
if(m_Core.m_Vel.y > 0)
|
||||
{
|
||||
m_Core.m_Pos.y = m_PrevPos.y;
|
||||
m_Core.m_Vel.y = 0;
|
||||
}
|
||||
m_Core.m_Pos.y = m_PrevPos.y;
|
||||
m_Core.m_Vel.y = 0;
|
||||
m_Core.m_Jumped = 0;
|
||||
}
|
||||
if(TileIndex == TILE_STOPH || TileIndexR == TILE_STOPH || TileIndexL == TILE_STOPH || TileFIndex == TILE_STOPH || TileFIndexR == TILE_STOPH || TileFIndexL == TILE_STOPH)
|
||||
if((TileIndexB == TILE_STOPA || TileFIndexB == TILE_STOPA || TileIndex == TILE_STOPB || TileIndexB == TILE_STOPB || TileFIndex == TILE_STOPB || TileFIndexB == TILE_STOPB|| TileIndexB == TILE_STOPV || TileFIndexB == TILE_STOPV) && m_Core.m_Vel.y < 0)
|
||||
{
|
||||
if(m_Core.m_Vel.x)
|
||||
m_Core.m_Pos.x = m_PrevPos.x;
|
||||
m_Core.m_Vel.x = 0;
|
||||
}
|
||||
if(TileIndex == TILE_STOPV || TileIndexT == TILE_STOPV || TileIndexB == TILE_STOPV || TileFIndex == TILE_STOPV || TileFIndexT == TILE_STOPV || TileFIndexB == TILE_STOPV)
|
||||
{
|
||||
if(m_Core.m_Vel.y)
|
||||
m_Core.m_Pos.y = m_PrevPos.y;
|
||||
if(m_Pos.y > m_Core.m_Pos.y)
|
||||
m_Core.m_Jumped = 0;
|
||||
m_Core.m_Pos.y = m_PrevPos.y;
|
||||
m_Core.m_Vel.y = 0;
|
||||
}
|
||||
if(TileIndex == TILE_STOPA || TileFIndex == TILE_STOPA)
|
||||
if((TileIndexR == TILE_STOPA || TileFIndexR == TILE_STOPA || TileIndex == TILE_STOPR || TileIndexR == TILE_STOPR || TileFIndex == TILE_STOPR || TileFIndexR == TILE_STOPR || TileIndexR == TILE_STOPH || TileFIndexR == TILE_STOPH) && m_Core.m_Vel.x < 0)
|
||||
{
|
||||
if(m_Core.m_Vel.y)
|
||||
{
|
||||
m_Core.m_Pos.y = m_PrevPos.y;
|
||||
m_Core.m_Vel.y = 0;
|
||||
}
|
||||
if(m_Pos.y > m_Core.m_Pos.y)
|
||||
m_Core.m_Jumped = 0;
|
||||
if(m_Core.m_Vel.x)
|
||||
{
|
||||
m_Core.m_Pos.x = m_PrevPos.x;
|
||||
m_Core.m_Vel.x = 0;
|
||||
}
|
||||
m_Core.m_Pos.x = m_PrevPos.x;
|
||||
m_Core.m_Vel.x = 0;
|
||||
}
|
||||
if(TileIndexT == TILE_STOPA || TileFIndexT == TILE_STOPA)
|
||||
if((TileIndexL == TILE_STOPA || TileFIndexL == TILE_STOPA || TileIndex == TILE_STOPL || TileIndexL == TILE_STOPL || TileFIndex == TILE_STOPL || TileFIndexL == TILE_STOPL || TileIndexL == TILE_STOPH || TileFIndexL == TILE_STOPH) && m_Core.m_Vel.x > 0)
|
||||
{
|
||||
if(m_Core.m_Vel.y > 0)
|
||||
{
|
||||
m_Core.m_Pos.y = m_PrevPos.y;
|
||||
m_Core.m_Vel.y = 0;
|
||||
}
|
||||
m_Core.m_Jumped = 0;
|
||||
}
|
||||
if(TileIndexB == TILE_STOPA || TileFIndexB == TILE_STOPA)
|
||||
{
|
||||
if(m_Core.m_Vel.y < 0)
|
||||
{
|
||||
m_Core.m_Pos.y = m_PrevPos.y;
|
||||
m_Core.m_Vel.y = 0;
|
||||
}
|
||||
}
|
||||
if(TileIndexR == TILE_STOPA || TileFIndexR == TILE_STOPA)
|
||||
{
|
||||
if(m_Core.m_Vel.x < 0)
|
||||
{
|
||||
m_Core.m_Pos.x = m_PrevPos.x;
|
||||
m_Core.m_Vel.x = 0;
|
||||
}
|
||||
}
|
||||
if(TileIndexL == TILE_STOPA || TileFIndexL == TILE_STOPA)
|
||||
{
|
||||
if(m_Core.m_Vel.x > 0)
|
||||
{
|
||||
m_Core.m_Pos.x = m_PrevPos.x;
|
||||
m_Core.m_Vel.x = 0;
|
||||
}
|
||||
m_Core.m_Pos.x = m_PrevPos.x;
|
||||
m_Core.m_Vel.x = 0;
|
||||
}
|
||||
if (TileIndex == TILE_BOOST_L || TileFIndex == TILE_BOOST_L)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue