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());
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()));
} break;
@ -502,11 +508,11 @@ void CCharacter::FireWeapon()
case WEAPON_RIFLE:
{
int LaserReach;
float LaserReach;
if (!m_TuneZone)
LaserReach = (int)(Server()->TickSpeed()*GameServer()->Tuning()->m_LaserReach);
LaserReach = GameServer()->Tuning()->m_LaserReach;
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);
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);
DoBounce();
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;
if (!m_TuneZone)
if (m_TuneZone)
BounceNum = (GameServer()->TuningList()+m_TuneZone)->m_LaserBounceNum;
if(m_Bounces > BounceNum)
@ -165,17 +165,15 @@ void CLaser::Reset()
void CLaser::Tick()
{
if (!m_TuneZone)
{
if(Server()->Tick() > m_EvalTick+(Server()->TickSpeed()*GameServer()->Tuning()->m_LaserBounceDelay)/1000.0f)
DoBounce();
}
float Delay;
if (m_TuneZone)
Delay = (GameServer()->TuningList()+m_TuneZone)->m_LaserBounceDelay;
else
{
if(Server()->Tick() > m_EvalTick+(Server()->TickSpeed()*(GameServer()->TuningList()+m_TuneZone)->m_LaserBounceDelay)/1000.0f)
Delay = GameServer()->Tuning()->m_LaserBounceDelay;
if(Server()->Tick() > m_EvalTick+(Server()->TickSpeed()*Delay/1000.0f))
DoBounce();
}
}
void CLaser::TickPaused()
{

View file

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