mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
i think i finally fixed the damn speeders with max speed
This commit is contained in:
parent
59406c83d3
commit
ee3f642fd5
|
@ -868,7 +868,7 @@ void CCharacter::HandleTiles(int Index)
|
|||
vec2 Direction, MaxVel, TempVel = m_Core.m_Vel;
|
||||
int Force, MaxSpeed = 0;
|
||||
GameServer()->Collision()->GetSpeedup(MapIndex, &Direction, &Force, &MaxSpeed);
|
||||
dbg_msg("speedup tile start","Direction %f %f, Force %d, Max Speed %d", (Direction).x,(Direction).y, Force, MaxSpeed);
|
||||
//dbg_msg("speedup tile start","Direction %f %f, Force %d, Max Speed %d", (Direction).x,(Direction).y, Force, MaxSpeed);
|
||||
if(
|
||||
((Direction.x < 0) && ((int)GameServer()->Collision()->GetPos(MapIndexL).x) && ((int)GameServer()->Collision()->GetPos(MapIndexL).x < (int)m_Core.m_Pos.x)) ||
|
||||
((Direction.x > 0) && ((int)GameServer()->Collision()->GetPos(MapIndexR).x) && ((int)GameServer()->Collision()->GetPos(MapIndexR).x > (int)m_Core.m_Pos.x)) ||
|
||||
|
@ -877,21 +877,12 @@ void CCharacter::HandleTiles(int Index)
|
|||
)
|
||||
m_Core.m_Pos = m_PrevPos;
|
||||
TempVel += Direction * Force;
|
||||
MaxVel = Direction*(MaxSpeed/5);
|
||||
if(absolute(TempVel.x) < absolute(MaxVel.x) || absolute(TempVel.y) < absolute(MaxVel.y) || !MaxSpeed)
|
||||
{
|
||||
if(absolute(Direction.x) > 0)
|
||||
m_Core.m_Vel.x = TempVel.x;
|
||||
if(absolute(Direction.y) > 0)
|
||||
m_Core.m_Vel.y = TempVel.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(absolute(Direction.x) > 0)
|
||||
m_Core.m_Vel.x = MaxVel.x + Direction.x;
|
||||
if(absolute(Direction.y) > 0)
|
||||
m_Core.m_Vel.y = MaxVel.y + Direction.y;
|
||||
}
|
||||
MaxVel = Direction*(MaxSpeed);
|
||||
if(MaxSpeed && Direction.x && (TempVel.x > MaxVel.x && MaxVel.x > 0 || TempVel.x < MaxVel.x && MaxVel.x < 0))
|
||||
TempVel.x = MaxVel.x;
|
||||
if(MaxSpeed && Direction.y && (TempVel.y > MaxVel.y && MaxVel.y > 0 || TempVel.y < MaxVel.y && MaxVel.y < 0))
|
||||
TempVel.y = MaxVel.y;
|
||||
m_Core.m_Vel = TempVel;
|
||||
//dbg_msg("speedup tile end","(Direction*Force) %f %f m_Core.m_Vel%f %f",(Direction*Force).x,(Direction*Force).y,m_Core.m_Vel.x,m_Core.m_Vel.y);
|
||||
//dbg_msg("speedup tile end","Direction %f %f, Force %d, Max Speed %d", (Direction).x,(Direction).y, Force, MaxSpeed);
|
||||
}
|
||||
|
@ -900,7 +891,6 @@ void CCharacter::HandleTiles(int Index)
|
|||
vec2 Direction;
|
||||
int Force;
|
||||
GameServer()->Collision()->GetSpeedup(MapIndex, &Direction, &Force, 0);
|
||||
Force/=5;
|
||||
if(
|
||||
((Direction.x < 0) && ((int)GameServer()->Collision()->GetPos(MapIndexL).x) && ((int)GameServer()->Collision()->GetPos(MapIndexL).x < (int)m_Core.m_Pos.x)) ||
|
||||
((Direction.x > 0) && ((int)GameServer()->Collision()->GetPos(MapIndexR).x) && ((int)GameServer()->Collision()->GetPos(MapIndexR).x > (int)m_Core.m_Pos.x)) ||
|
||||
|
@ -908,7 +898,7 @@ void CCharacter::HandleTiles(int Index)
|
|||
((Direction.y < 0) && ((int)GameServer()->Collision()->GetPos(MapIndexT).y) && ((int)GameServer()->Collision()->GetPos(MapIndexT).y < (int)m_Core.m_Pos.y))
|
||||
)
|
||||
m_Core.m_Pos = m_PrevPos;
|
||||
m_Core.m_Vel = Direction*Force + Direction;
|
||||
m_Core.m_Vel = Direction*Force;
|
||||
//dbg_msg("Direction","%f %f %f %f %f %f",Direction.x,Direction.y,(Direction*Force).x,(Direction*Force).y,m_Core.m_Vel.x,m_Core.m_Vel.y);
|
||||
}
|
||||
m_LastBooster = MapIndex;
|
||||
|
|
Loading…
Reference in a new issue