mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
minor changes
This commit is contained in:
parent
0a08e1ca06
commit
e0bb8731a7
|
@ -404,14 +404,14 @@ int CCollision::IsSpeedup(int Index)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(m_pSpeedup[Index].m_Force > 0)
|
if(m_pSpeedup[Index].m_Force > 0)
|
||||||
return m_pSpeedup[Index].m_Type;
|
return Index;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCollision::GetSpeedup(int Index, vec2 *Dir, int *Force, int *MaxSpeed)
|
void CCollision::GetSpeedup(int Index, vec2 *Dir, int *Force, int *MaxSpeed)
|
||||||
{
|
{
|
||||||
if(Index < 0)
|
if(Index < 0 || !m_pSpeedup)
|
||||||
return;
|
return;
|
||||||
vec2 Direction = vec2(1, 0);
|
vec2 Direction = vec2(1, 0);
|
||||||
float Angle = m_pSpeedup[Index].m_Angle * (pi / 180.0f);
|
float Angle = m_pSpeedup[Index].m_Angle * (pi / 180.0f);
|
||||||
|
|
|
@ -95,7 +95,8 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos)
|
||||||
if(m_pPlayer->m_RconFreeze) Freeze(-1);
|
if(m_pPlayer->m_RconFreeze) Freeze(-1);
|
||||||
GameServer()->m_pController->OnCharacterSpawn(this);
|
GameServer()->m_pController->OnCharacterSpawn(this);
|
||||||
|
|
||||||
if(GetPlayer()->m_IsUsingDDRaceClient) {
|
if(GetPlayer()->m_IsUsingDDRaceClient)
|
||||||
|
{
|
||||||
Controller->m_Teams.SendTeamsState(GetPlayer()->GetCID());
|
Controller->m_Teams.SendTeamsState(GetPlayer()->GetCID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -839,19 +840,20 @@ void CCharacter::Tick()
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle tiles
|
// handle tiles
|
||||||
|
int CurrentIndex = GameServer()->Collision()->GetPureMapIndex(m_Pos);
|
||||||
std::list < int > Indices = GameServer()->Collision()->GetMapIndices(m_PrevPos, m_Pos);
|
std::list < int > Indices = GameServer()->Collision()->GetMapIndices(m_PrevPos, m_Pos);
|
||||||
if(!Indices.empty())
|
if(!Indices.empty())
|
||||||
for(std::list < int >::iterator i = Indices.begin(); i != Indices.end(); i++)
|
for(std::list < int >::iterator i = Indices.begin(); i != Indices.end(); i++)
|
||||||
HandleTiles(*i);
|
HandleTiles(*i);
|
||||||
else
|
else
|
||||||
HandleTiles(GameServer()->Collision()->GetPureMapIndex(m_Pos));
|
HandleTiles(CurrentIndex);
|
||||||
// handle speedup tiles
|
// handle speedup tiles
|
||||||
if(GameServer()->Collision()->IsSpeedup(GameServer()->Collision()->GetPureMapIndex(m_Pos)) == TILE_BOOST)
|
if(GameServer()->Collision()->IsSpeedup(CurrentIndex))
|
||||||
{
|
{
|
||||||
vec2 Direction, MaxVel, TempVel = m_Core.m_Vel;
|
vec2 Direction, MaxVel, TempVel = m_Core.m_Vel;
|
||||||
int Force, MaxSpeed = 0;
|
int Force, MaxSpeed = 0;
|
||||||
float TeeAngle, SpeederAngle, DiffAngle, SpeedLeft, TeeSpeed;
|
float TeeAngle, SpeederAngle, DiffAngle, SpeedLeft, TeeSpeed;
|
||||||
GameServer()->Collision()->GetSpeedup(GameServer()->Collision()->GetPureMapIndex(m_Pos), &Direction, &Force, &MaxSpeed);
|
GameServer()->Collision()->GetSpeedup(CurrentIndex, &Direction, &Force, &MaxSpeed);
|
||||||
if(Force == 255 && MaxSpeed)
|
if(Force == 255 && MaxSpeed)
|
||||||
{
|
{
|
||||||
m_Core.m_Vel = Direction * (MaxSpeed/5);
|
m_Core.m_Vel = Direction * (MaxSpeed/5);
|
||||||
|
@ -916,7 +918,6 @@ void CCharacter::Tick()
|
||||||
//dbg_msg("speedup tile end","Direction %f %f, Force %d, Max Speed %d", (Direction).x,(Direction).y, Force, MaxSpeed);
|
//dbg_msg("speedup tile end","Direction %f %f, Force %d, Max Speed %d", (Direction).x,(Direction).y, Force, MaxSpeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle Weapons
|
// handle Weapons
|
||||||
HandleWeapons();
|
HandleWeapons();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue