mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Code cleanup
This commit is contained in:
parent
83201c9003
commit
6e33858cab
|
@ -396,7 +396,7 @@ void CCharacter::FireWeapon()
|
||||||
if (!m_TuneZone)
|
if (!m_TuneZone)
|
||||||
Strength = GameServer()->Tuning()->m_JetpackStrength;
|
Strength = GameServer()->Tuning()->m_JetpackStrength;
|
||||||
else
|
else
|
||||||
Strength = (GameServer()->TuningList()+m_TuneZone)->m_JetpackStrength;
|
Strength = GameServer()->TuningList()[m_TuneZone].m_JetpackStrength;
|
||||||
|
|
||||||
TakeDamage(Direction * -1.0f * (Strength / 100.0f), g_pData->m_Weapons.m_Hammer.m_pBase->m_Damage, m_pPlayer->GetCID(), m_ActiveWeapon);
|
TakeDamage(Direction * -1.0f * (Strength / 100.0f), g_pData->m_Weapons.m_Hammer.m_pBase->m_Damage, m_pPlayer->GetCID(), m_ActiveWeapon);
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,7 @@ void CCharacter::FireWeapon()
|
||||||
if (!m_TuneZone)
|
if (!m_TuneZone)
|
||||||
Lifetime = (int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GunLifetime);
|
Lifetime = (int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GunLifetime);
|
||||||
else
|
else
|
||||||
Lifetime = (int)(Server()->TickSpeed()*(GameServer()->TuningList()+m_TuneZone)->m_GunLifetime);
|
Lifetime = (int)(Server()->TickSpeed()*GameServer()->TuningList()[m_TuneZone].m_GunLifetime);
|
||||||
|
|
||||||
CProjectile *pProj = new CProjectile
|
CProjectile *pProj = new CProjectile
|
||||||
(
|
(
|
||||||
|
@ -473,7 +473,7 @@ void CCharacter::FireWeapon()
|
||||||
if (!m_TuneZone)
|
if (!m_TuneZone)
|
||||||
LaserReach = GameServer()->Tuning()->m_LaserReach;
|
LaserReach = GameServer()->Tuning()->m_LaserReach;
|
||||||
else
|
else
|
||||||
LaserReach = (GameServer()->TuningList()+m_TuneZone)->m_LaserReach;
|
LaserReach = GameServer()->TuningList()[m_TuneZone].m_LaserReach;
|
||||||
|
|
||||||
new CLaser(&GameServer()->m_World, m_Pos, Direction, LaserReach, m_pPlayer->GetCID(), WEAPON_SHOTGUN);
|
new CLaser(&GameServer()->m_World, m_Pos, Direction, LaserReach, m_pPlayer->GetCID(), WEAPON_SHOTGUN);
|
||||||
GameServer()->CreateSound(m_Pos, SOUND_SHOTGUN_FIRE, Teams()->TeamMask(Team(), -1, m_pPlayer->GetCID()));
|
GameServer()->CreateSound(m_Pos, SOUND_SHOTGUN_FIRE, Teams()->TeamMask(Team(), -1, m_pPlayer->GetCID()));
|
||||||
|
@ -485,7 +485,7 @@ void CCharacter::FireWeapon()
|
||||||
if (!m_TuneZone)
|
if (!m_TuneZone)
|
||||||
Lifetime = (int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GrenadeLifetime);
|
Lifetime = (int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GrenadeLifetime);
|
||||||
else
|
else
|
||||||
Lifetime = (int)(Server()->TickSpeed()*(GameServer()->TuningList()+m_TuneZone)->m_GrenadeLifetime);
|
Lifetime = (int)(Server()->TickSpeed()*GameServer()->TuningList()[m_TuneZone].m_GrenadeLifetime);
|
||||||
|
|
||||||
CProjectile *pProj = new CProjectile
|
CProjectile *pProj = new CProjectile
|
||||||
(
|
(
|
||||||
|
@ -521,7 +521,7 @@ void CCharacter::FireWeapon()
|
||||||
if (!m_TuneZone)
|
if (!m_TuneZone)
|
||||||
LaserReach = GameServer()->Tuning()->m_LaserReach;
|
LaserReach = GameServer()->Tuning()->m_LaserReach;
|
||||||
else
|
else
|
||||||
LaserReach = (GameServer()->TuningList()+m_TuneZone)->m_LaserReach;
|
LaserReach = GameServer()->TuningList()[m_TuneZone].m_LaserReach;
|
||||||
|
|
||||||
new CLaser(GameWorld(), m_Pos, Direction, LaserReach, m_pPlayer->GetCID(), WEAPON_RIFLE);
|
new CLaser(GameWorld(), m_Pos, Direction, LaserReach, m_pPlayer->GetCID(), WEAPON_RIFLE);
|
||||||
GameServer()->CreateSound(m_Pos, SOUND_RIFLE_FIRE, Teams()->TeamMask(Team(), -1, m_pPlayer->GetCID()));
|
GameServer()->CreateSound(m_Pos, SOUND_RIFLE_FIRE, Teams()->TeamMask(Team(), -1, m_pPlayer->GetCID()));
|
||||||
|
@ -1767,32 +1767,25 @@ void CCharacter::HandleTiles(int Index)
|
||||||
void CCharacter::HandleTuneLayer()
|
void CCharacter::HandleTuneLayer()
|
||||||
{
|
{
|
||||||
|
|
||||||
m_TuneZoneOld = m_TuneZone;
|
m_TuneZoneOld = m_TuneZone;
|
||||||
int CurrentIndex = GameServer()->Collision()->GetMapIndex(m_Pos);
|
int CurrentIndex = GameServer()->Collision()->GetMapIndex(m_Pos);
|
||||||
m_TuneZone = GameServer()->Collision()->IsTune(CurrentIndex);
|
m_TuneZone = GameServer()->Collision()->IsTune(CurrentIndex);
|
||||||
|
|
||||||
if(m_TuneZone)
|
if(m_TuneZone)
|
||||||
m_Core.m_pWorld->m_Tuning = *(GameServer()->TuningList()+m_TuneZone); // throw tunings from specific zone into gamecore
|
m_Core.m_pWorld->m_Tuning = GameServer()->TuningList()[m_TuneZone]; // throw tunings from specific zone into gamecore
|
||||||
else
|
else
|
||||||
m_Core.m_pWorld->m_Tuning = *GameServer()->Tuning();
|
m_Core.m_pWorld->m_Tuning = *GameServer()->Tuning();
|
||||||
|
|
||||||
if (m_TuneZone != m_TuneZoneOld) // dont send tunigs all the time
|
if (m_TuneZone != m_TuneZoneOld) // dont send tunigs all the time
|
||||||
{
|
{
|
||||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // send specific tunings
|
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // send specific tunings
|
||||||
|
|
||||||
|
|
||||||
// send zone leave msg
|
// send zone leave msg
|
||||||
|
|
||||||
if (GameServer()->m_ZoneLeaveMsg[m_TuneZoneOld])
|
if (GameServer()->m_ZoneLeaveMsg[m_TuneZoneOld])
|
||||||
GameServer()->SendChatTarget(m_pPlayer->GetCID(), GameServer()->m_ZoneLeaveMsg[m_TuneZoneOld]);
|
GameServer()->SendChatTarget(m_pPlayer->GetCID(), GameServer()->m_ZoneLeaveMsg[m_TuneZoneOld]);
|
||||||
|
|
||||||
// send zone enter msg
|
// send zone enter msg
|
||||||
if (GameServer()->m_ZoneEnterMsg[m_TuneZone])
|
if (GameServer()->m_ZoneEnterMsg[m_TuneZone])
|
||||||
GameServer()->SendChatTarget(m_pPlayer->GetCID(), GameServer()->m_ZoneEnterMsg[m_TuneZone]);
|
GameServer()->SendChatTarget(m_pPlayer->GetCID(), GameServer()->m_ZoneEnterMsg[m_TuneZone]);
|
||||||
|
|
||||||
//dbg_msg("Tunelayer", "zone %d", m_TuneZone);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacter::DDRaceTick()
|
void CCharacter::DDRaceTick()
|
||||||
|
|
|
@ -52,7 +52,7 @@ bool CLaser::HitCharacter(vec2 From, vec2 To)
|
||||||
if (!m_TuneZone)
|
if (!m_TuneZone)
|
||||||
Strength = GameServer()->Tuning()->m_ShotgunStrength;
|
Strength = GameServer()->Tuning()->m_ShotgunStrength;
|
||||||
else
|
else
|
||||||
Strength = (GameServer()->TuningList()+m_TuneZone)->m_ShotgunStrength;
|
Strength = GameServer()->TuningList()[m_TuneZone].m_ShotgunStrength;
|
||||||
|
|
||||||
if(!g_Config.m_SvOldLaser)
|
if(!g_Config.m_SvOldLaser)
|
||||||
Temp = pHit->Core()->m_Vel + normalize(m_PrevPos - pHit->Core()->m_Pos) * Strength;
|
Temp = pHit->Core()->m_Vel + normalize(m_PrevPos - pHit->Core()->m_Pos) * Strength;
|
||||||
|
@ -129,7 +129,7 @@ void CLaser::DoBounce()
|
||||||
if (!m_TuneZone)
|
if (!m_TuneZone)
|
||||||
m_Energy -= distance(m_From, m_Pos) + GameServer()->Tuning()->m_LaserBounceCost;
|
m_Energy -= distance(m_From, m_Pos) + GameServer()->Tuning()->m_LaserBounceCost;
|
||||||
else
|
else
|
||||||
m_Energy -= distance(m_From, m_Pos) + (GameServer()->TuningList()+m_TuneZone)->m_LaserBounceCost;
|
m_Energy -= distance(m_From, m_Pos) + GameServer()->TuningList()[m_TuneZone].m_LaserBounceCost;
|
||||||
|
|
||||||
if (Res&CCollision::COLFLAG_TELE && ((CGameControllerDDRace*)GameServer()->m_pController)->m_TeleOuts[z-1].size())
|
if (Res&CCollision::COLFLAG_TELE && ((CGameControllerDDRace*)GameServer()->m_pController)->m_TeleOuts[z-1].size())
|
||||||
{
|
{
|
||||||
|
@ -145,7 +145,7 @@ void CLaser::DoBounce()
|
||||||
|
|
||||||
int BounceNum = GameServer()->Tuning()->m_LaserBounceNum;
|
int BounceNum = GameServer()->Tuning()->m_LaserBounceNum;
|
||||||
if (m_TuneZone)
|
if (m_TuneZone)
|
||||||
BounceNum = (GameServer()->TuningList()+m_TuneZone)->m_LaserBounceNum;
|
BounceNum = GameServer()->TuningList()[m_TuneZone].m_LaserBounceNum;
|
||||||
|
|
||||||
if(m_Bounces > BounceNum)
|
if(m_Bounces > BounceNum)
|
||||||
m_Energy = -1;
|
m_Energy = -1;
|
||||||
|
@ -174,7 +174,7 @@ void CLaser::Tick()
|
||||||
{
|
{
|
||||||
float Delay;
|
float Delay;
|
||||||
if (m_TuneZone)
|
if (m_TuneZone)
|
||||||
Delay = (GameServer()->TuningList()+m_TuneZone)->m_LaserBounceDelay;
|
Delay = GameServer()->TuningList()[m_TuneZone].m_LaserBounceDelay;
|
||||||
else
|
else
|
||||||
Delay = GameServer()->Tuning()->m_LaserBounceDelay;
|
Delay = GameServer()->Tuning()->m_LaserBounceDelay;
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,8 @@ vec2 CProjectile::GetPos(float Time)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Curvature = (GameServer()->TuningList()+m_TuneZone)->m_GrenadeCurvature;
|
Curvature = GameServer()->TuningList()[m_TuneZone].m_GrenadeCurvature;
|
||||||
Speed = (GameServer()->TuningList()+m_TuneZone)->m_GrenadeSpeed;
|
Speed = GameServer()->TuningList()[m_TuneZone].m_GrenadeSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -82,8 +82,8 @@ vec2 CProjectile::GetPos(float Time)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Curvature = (GameServer()->TuningList()+m_TuneZone)->m_ShotgunCurvature;
|
Curvature = GameServer()->TuningList()[m_TuneZone].m_ShotgunCurvature;
|
||||||
Speed = (GameServer()->TuningList()+m_TuneZone)->m_ShotgunSpeed;
|
Speed = GameServer()->TuningList()[m_TuneZone].m_ShotgunSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -96,8 +96,8 @@ vec2 CProjectile::GetPos(float Time)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Curvature = (GameServer()->TuningList()+m_TuneZone)->m_GunCurvature;
|
Curvature = GameServer()->TuningList()[m_TuneZone].m_GunCurvature;
|
||||||
Speed = (GameServer()->TuningList()+m_TuneZone)->m_GunSpeed;
|
Speed = GameServer()->TuningList()[m_TuneZone].m_GunSpeed;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamag
|
||||||
if (Owner == -1 || !m_apPlayers[Owner]->m_TuneZone)
|
if (Owner == -1 || !m_apPlayers[Owner]->m_TuneZone)
|
||||||
Strength = Tuning()->m_ExplosionStrength;
|
Strength = Tuning()->m_ExplosionStrength;
|
||||||
else
|
else
|
||||||
Strength = (TuningList()+m_apPlayers[Owner]->m_TuneZone)->m_ExplosionStrength;
|
Strength = TuningList()[m_apPlayers[Owner]->m_TuneZone].m_ExplosionStrength;
|
||||||
|
|
||||||
float Dmg = Strength * l;
|
float Dmg = Strength * l;
|
||||||
if((int)Dmg)
|
if((int)Dmg)
|
||||||
|
|
Loading…
Reference in a new issue