fix: stupid laser tunings + projectile security fix

This commit is contained in:
HMH 2014-03-15 17:48:25 +01:00 committed by def
parent e8a7e28f69
commit 0177b8a4b5
3 changed files with 21 additions and 17 deletions

View file

@ -460,7 +460,13 @@ void CCharacter::FireWeapon()
Server()->SendMsg(&Msg, 0,m_pPlayer->GetCID()); Server()->SendMsg(&Msg, 0,m_pPlayer->GetCID());
GameServer()->CreateSound(m_Pos, SOUND_SHOTGUN_FIRE);*/ GameServer()->CreateSound(m_Pos, SOUND_SHOTGUN_FIRE);*/
new CLaser(&GameServer()->m_World, m_Pos, Direction, GameServer()->Tuning()->m_LaserReach, m_pPlayer->GetCID(), WEAPON_SHOTGUN); float LaserReach;
if (!m_TuneZone)
LaserReach = GameServer()->Tuning()->m_LaserReach;
else
LaserReach = (GameServer()->TuningList()+m_TuneZone)->m_LaserReach;
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()));
} break; } break;
@ -470,7 +476,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
( (
@ -502,11 +508,11 @@ void CCharacter::FireWeapon()
case WEAPON_RIFLE: case WEAPON_RIFLE:
{ {
int LaserReach; float LaserReach;
if (!m_TuneZone) if (!m_TuneZone)
LaserReach = (int)(Server()->TickSpeed()*GameServer()->Tuning()->m_LaserReach); LaserReach = GameServer()->Tuning()->m_LaserReach;
else else
LaserReach = (int)(Server()->TickSpeed()*(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()));

View file

@ -23,7 +23,7 @@ CLaser::CLaser(CGameWorld *pGameWorld, vec2 Pos, vec2 Direction, float StartEner
GameWorld()->InsertEntity(this); GameWorld()->InsertEntity(this);
DoBounce(); DoBounce();
m_TeamMask = GameServer()->GetPlayerChar(Owner) ? GameServer()->GetPlayerChar(Owner)->Teams()->TeamMask(GameServer()->GetPlayerChar(Owner)->Team(), -1, m_Owner) : 0; m_TeamMask = GameServer()->GetPlayerChar(Owner) ? GameServer()->GetPlayerChar(Owner)->Teams()->TeamMask(GameServer()->GetPlayerChar(Owner)->Team(), -1, m_Owner) : 0;
m_TuneZone = GameServer()->GetPlayerChar(m_Owner)->m_TuneZone; m_TuneZone = GameServer()->Collision()->IsTune(GameServer()->Collision()->GetMapIndex(m_Pos));
} }
@ -137,7 +137,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)
@ -165,16 +165,14 @@ void CLaser::Reset()
void CLaser::Tick() void CLaser::Tick()
{ {
if (!m_TuneZone) float Delay;
{ if (m_TuneZone)
if(Server()->Tick() > m_EvalTick+(Server()->TickSpeed()*GameServer()->Tuning()->m_LaserBounceDelay)/1000.0f) Delay = (GameServer()->TuningList()+m_TuneZone)->m_LaserBounceDelay;
DoBounce();
}
else else
{ Delay = GameServer()->Tuning()->m_LaserBounceDelay;
if(Server()->Tick() > m_EvalTick+(Server()->TickSpeed()*(GameServer()->TuningList()+m_TuneZone)->m_LaserBounceDelay)/1000.0f)
DoBounce(); if(Server()->Tick() > m_EvalTick+(Server()->TickSpeed()*Delay/1000.0f))
} DoBounce();
} }
void CLaser::TickPaused() void CLaser::TickPaused()

View file

@ -42,7 +42,7 @@ CProjectile::CProjectile
m_Number = Number; m_Number = Number;
m_Freeze = Freeze; m_Freeze = Freeze;
m_TuneZone = GameServer()->GetPlayerChar(m_Owner)->m_TuneZone; m_TuneZone = GameServer()->Collision()->IsTune(GameServer()->Collision()->GetMapIndex(m_Pos));
GameWorld()->InsertEntity(this); GameWorld()->InsertEntity(this);
} }