fix timakro review

This commit is contained in:
Ryozuki 2018-07-16 00:43:54 +02:00
parent b1ad69633f
commit 97ecd62214
2 changed files with 26 additions and 30 deletions

View file

@ -166,39 +166,36 @@ void CLaser::DoBounce()
}
}
if (m_Owner >= 0 && m_Energy <= 0 && m_Pos && !m_TeleportCancelled)
CCharacter *pOwnerChar = GameServer()->GetPlayerChar(m_Owner);
if (m_Owner >= 0 && m_Energy <= 0 && m_Pos && !m_TeleportCancelled && pOwnerChar &&
pOwnerChar->IsAlive() && pOwnerChar->m_HasTeleLaser && m_Type == WEAPON_RIFLE)
{
CCharacter *pOwnerChar = GameServer()->GetPlayerChar(m_Owner);
vec2 PossiblePos;
bool Found = false;
if (pOwnerChar && pOwnerChar->IsAlive() && pOwnerChar->m_HasTeleLaser && m_Type == WEAPON_RIFLE)
// Check if the laser hits a player.
bool pDontHitSelf = g_Config.m_SvOldLaser || (m_Bounces == 0 && !m_WasTele);
vec2 At;
CCharacter *pHit;
if (pOwnerChar ? (!(pOwnerChar->m_Hit&CCharacter::DISABLE_HIT_RIFLE) && m_Type == WEAPON_RIFLE) : g_Config.m_SvHit)
pHit = GameServer()->m_World.IntersectCharacter(m_Pos, To, 0.f, At, pDontHitSelf ? pOwnerChar : 0, m_Owner);
else
pHit = GameServer()->m_World.IntersectCharacter(m_Pos, To, 0.f, At, pDontHitSelf ? pOwnerChar : 0, m_Owner, pOwnerChar);
if (pHit)
Found = GetNearestAirPosPlayer(pHit->m_Pos, &PossiblePos);
else
Found = GetNearestAirPos(m_Pos, m_From, &PossiblePos);
if (Found && PossiblePos)
{
vec2 PossiblePos;
bool Found = false;
// Check if the laser hits a player.
bool pDontHitSelf = g_Config.m_SvOldLaser || (m_Bounces == 0 && !m_WasTele);
vec2 At;
CCharacter *pHit;
if(pOwnerChar ? (!(pOwnerChar->m_Hit&CCharacter::DISABLE_HIT_RIFLE) && m_Type == WEAPON_RIFLE) : g_Config.m_SvHit)
pHit = GameServer()->m_World.IntersectCharacter(m_Pos, To, 0.f, At, pDontHitSelf ? pOwnerChar : 0, m_Owner);
else
pHit = GameServer()->m_World.IntersectCharacter(m_Pos, To, 0.f, At, pDontHitSelf ? pOwnerChar : 0, m_Owner, pOwnerChar);
if(pHit)
Found = GetNearestAirPosPlayer(pHit->m_Pos, &PossiblePos);
else
Found = GetNearestAirPos(m_Pos, m_From, &PossiblePos);
if (Found && PossiblePos)
{
pOwnerChar->m_TeleGunPos = PossiblePos;
pOwnerChar->m_TeleGunTeleport = true;
}
pOwnerChar->m_TeleGunPos = PossiblePos;
pOwnerChar->m_TeleGunTeleport = true;
}
}
else if(m_Owner >= 0 && m_Pos)
{
int MapIndex = GameServer()->Collision()->GetPureMapIndex(round_to_int(Coltile.x), round_to_int(Coltile.y));
int MapIndex = GameServer()->Collision()->GetPureMapIndex(Coltile);
int TileIndex = GameServer()->Collision()->GetTileIndex(MapIndex);
int TileFIndex = GameServer()->Collision()->GetFTileIndex(MapIndex);

View file

@ -122,7 +122,7 @@ void CProjectile::Tick()
CCharacter *pTargetChr = nullptr;
if(!(pOwnerChar ? (pOwnerChar->m_Hit&CCharacter::DISABLE_HIT_GRENADE) : g_Config.m_SvHit))
if((pOwnerChar ? !(pOwnerChar->m_Hit&CCharacter::DISABLE_HIT_GRENADE) : g_Config.m_SvHit))
pTargetChr = GameServer()->m_World.IntersectCharacter(PrevPos, ColPos, m_Freeze ? 1.0f : 6.0f, ColPos, pOwnerChar, m_Owner);
if(m_LifeSpan > -1)
@ -174,12 +174,11 @@ void CProjectile::Tick()
if (pOwnerChar && ColPos && !GameLayerClipped(ColPos) &&
((m_Type == WEAPON_GRENADE && pOwnerChar->m_HasTeleGrenade) || (m_Type == WEAPON_GUN && pOwnerChar->m_HasTeleGun)))
{
int MapIndex = GameServer()->Collision()->GetPureMapIndex(pTargetChr ? pTargetChr->m_Pos.x : ColPos.x,
pTargetChr ? pTargetChr->m_Pos.y : ColPos.y);
int MapIndex = GameServer()->Collision()->GetPureMapIndex(pTargetChr ? pTargetChr->m_Pos : ColPos);
int TileIndex = GameServer()->Collision()->GetTileIndex(MapIndex);
int TileFIndex = GameServer()->Collision()->GetFTileIndex(MapIndex);
if ((m_Type == WEAPON_GUN || m_Type == WEAPON_GRENADE) && (TileIndex != TILE_NO_TELE_GUN && TileFIndex != TILE_NO_TELE_GUN))
if (TileIndex != TILE_NO_TELE_GUN && TileFIndex != TILE_NO_TELE_GUN)
{
bool Found;
vec2 PossiblePos;