diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index e9a76bdfd..e374cae5f 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -65,7 +65,7 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos) Antibot()->OnSpawn(m_pPlayer->GetCID()); m_Core.Reset(); - m_Core.Init(&GameServer()->m_World.m_Core, GameServer()->Collision()); + m_Core.Init(&GameServer()->m_World.m_Core, Collision()); m_Core.m_ActiveWeapon = WEAPON_GUN; m_Core.m_Pos = m_Pos; m_Core.m_Id = m_pPlayer->GetCID(); @@ -82,7 +82,7 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos) DDRaceInit(); - m_TuneZone = GameServer()->Collision()->IsTune(GameServer()->Collision()->GetMapIndex(Pos)); + m_TuneZone = Collision()->IsTune(Collision()->GetMapIndex(Pos)); m_TuneZoneOld = -1; // no zone leave msg on spawn m_NeededFaketuning = 0; // reset fake tunings on respawn and send the client SendZoneMsgs(); // we want a entermessage also on spawn @@ -136,12 +136,12 @@ void CCharacter::SetLiveFrozen(bool Active) bool CCharacter::IsGrounded() { - if(GameServer()->Collision()->CheckPoint(m_Pos.x + GetProximityRadius() / 2, m_Pos.y + GetProximityRadius() / 2 + 5)) + if(Collision()->CheckPoint(m_Pos.x + GetProximityRadius() / 2, m_Pos.y + GetProximityRadius() / 2 + 5)) return true; - if(GameServer()->Collision()->CheckPoint(m_Pos.x - GetProximityRadius() / 2, m_Pos.y + GetProximityRadius() / 2 + 5)) + if(Collision()->CheckPoint(m_Pos.x - GetProximityRadius() / 2, m_Pos.y + GetProximityRadius() / 2 + 5)) return true; - int MoveRestrictionsBelow = GameServer()->Collision()->GetMoveRestrictions(m_Pos + vec2(0, GetProximityRadius() / 2 + 4), 0.0f); + int MoveRestrictionsBelow = Collision()->GetMoveRestrictions(m_Pos + vec2(0, GetProximityRadius() / 2 + 4), 0.0f); return (MoveRestrictionsBelow & CANTMOVE_DOWN) != 0; } @@ -226,7 +226,7 @@ void CCharacter::HandleNinja() // Set velocity m_Core.m_Vel = m_Core.m_Ninja.m_ActivationDir * g_pData->m_Weapons.m_Ninja.m_Velocity; vec2 OldPos = m_Pos; - GameServer()->Collision()->MoveBox(&m_Core.m_Pos, &m_Core.m_Vel, vec2(GetProximityRadius(), GetProximityRadius()), 0.f); + Collision()->MoveBox(&m_Core.m_Pos, &m_Core.m_Vel, vec2(GetProximityRadius(), GetProximityRadius()), 0.f); // reset velocity so the client doesn't predict stuff m_Core.m_Vel = vec2(0.f, 0.f); @@ -424,7 +424,7 @@ void CCharacter::FireWeapon() { CCharacter *pTarget = apEnts[i]; - //if ((pTarget == this) || GameServer()->Collision()->IntersectLine(ProjStartPos, pTarget->m_Pos, NULL, NULL)) + //if ((pTarget == this) || Collision()->IntersectLine(ProjStartPos, pTarget->m_Pos, NULL, NULL)) if((pTarget == this || (pTarget->IsAlive() && !CanCollide(pTarget->GetPlayer()->GetCID())))) continue; @@ -766,7 +766,7 @@ void CCharacter::TickDefered() // advance the dummy { CWorldCore TempWorld; - m_ReckoningCore.Init(&TempWorld, GameServer()->Collision(), &Teams()->m_Core, m_pTeleOuts); + m_ReckoningCore.Init(&TempWorld, Collision(), &Teams()->m_Core, m_pTeleOuts); m_ReckoningCore.m_Id = m_pPlayer->GetCID(); m_ReckoningCore.Tick(false); m_ReckoningCore.Move(); @@ -776,13 +776,13 @@ void CCharacter::TickDefered() //lastsentcore vec2 StartPos = m_Core.m_Pos; vec2 StartVel = m_Core.m_Vel; - bool StuckBefore = GameServer()->Collision()->TestBox(m_Core.m_Pos, vec2(28.0f, 28.0f)); + bool StuckBefore = Collision()->TestBox(m_Core.m_Pos, vec2(28.0f, 28.0f)); m_Core.m_Id = m_pPlayer->GetCID(); m_Core.Move(); - bool StuckAfterMove = GameServer()->Collision()->TestBox(m_Core.m_Pos, vec2(28.0f, 28.0f)); + bool StuckAfterMove = Collision()->TestBox(m_Core.m_Pos, vec2(28.0f, 28.0f)); m_Core.Quantize(); - bool StuckAfterQuant = GameServer()->Collision()->TestBox(m_Core.m_Pos, vec2(28.0f, 28.0f)); + bool StuckAfterQuant = Collision()->TestBox(m_Core.m_Pos, vec2(28.0f, 28.0f)); m_Pos = m_Core.m_Pos; if(!StuckBefore && (StuckAfterMove || StuckAfterQuant)) @@ -1358,14 +1358,14 @@ void CCharacter::HandleBroadcast() void CCharacter::HandleSkippableTiles(int Index) { // handle death-tiles and leaving gamelayer - if((GameServer()->Collision()->GetCollisionAt(m_Pos.x + GetProximityRadius() / 3.f, m_Pos.y - GetProximityRadius() / 3.f) == TILE_DEATH || - GameServer()->Collision()->GetCollisionAt(m_Pos.x + GetProximityRadius() / 3.f, m_Pos.y + GetProximityRadius() / 3.f) == TILE_DEATH || - GameServer()->Collision()->GetCollisionAt(m_Pos.x - GetProximityRadius() / 3.f, m_Pos.y - GetProximityRadius() / 3.f) == TILE_DEATH || - GameServer()->Collision()->GetCollisionAt(m_Pos.x - GetProximityRadius() / 3.f, m_Pos.y + GetProximityRadius() / 3.f) == TILE_DEATH || - GameServer()->Collision()->GetFCollisionAt(m_Pos.x + GetProximityRadius() / 3.f, m_Pos.y - GetProximityRadius() / 3.f) == TILE_DEATH || - GameServer()->Collision()->GetFCollisionAt(m_Pos.x + GetProximityRadius() / 3.f, m_Pos.y + GetProximityRadius() / 3.f) == TILE_DEATH || - GameServer()->Collision()->GetFCollisionAt(m_Pos.x - GetProximityRadius() / 3.f, m_Pos.y - GetProximityRadius() / 3.f) == TILE_DEATH || - GameServer()->Collision()->GetFCollisionAt(m_Pos.x - GetProximityRadius() / 3.f, m_Pos.y + GetProximityRadius() / 3.f) == TILE_DEATH) && + if((Collision()->GetCollisionAt(m_Pos.x + GetProximityRadius() / 3.f, m_Pos.y - GetProximityRadius() / 3.f) == TILE_DEATH || + Collision()->GetCollisionAt(m_Pos.x + GetProximityRadius() / 3.f, m_Pos.y + GetProximityRadius() / 3.f) == TILE_DEATH || + Collision()->GetCollisionAt(m_Pos.x - GetProximityRadius() / 3.f, m_Pos.y - GetProximityRadius() / 3.f) == TILE_DEATH || + Collision()->GetCollisionAt(m_Pos.x - GetProximityRadius() / 3.f, m_Pos.y + GetProximityRadius() / 3.f) == TILE_DEATH || + Collision()->GetFCollisionAt(m_Pos.x + GetProximityRadius() / 3.f, m_Pos.y - GetProximityRadius() / 3.f) == TILE_DEATH || + Collision()->GetFCollisionAt(m_Pos.x + GetProximityRadius() / 3.f, m_Pos.y + GetProximityRadius() / 3.f) == TILE_DEATH || + Collision()->GetFCollisionAt(m_Pos.x - GetProximityRadius() / 3.f, m_Pos.y - GetProximityRadius() / 3.f) == TILE_DEATH || + Collision()->GetFCollisionAt(m_Pos.x - GetProximityRadius() / 3.f, m_Pos.y + GetProximityRadius() / 3.f) == TILE_DEATH) && !m_Super && !(Team() && Teams()->TeeFinished(m_pPlayer->GetCID()))) { Die(m_pPlayer->GetCID(), WEAPON_WORLD); @@ -1382,12 +1382,12 @@ void CCharacter::HandleSkippableTiles(int Index) return; // handle speedup tiles - if(GameServer()->Collision()->IsSpeedup(Index)) + if(Collision()->IsSpeedup(Index)) { vec2 Direction, TempVel = m_Core.m_Vel; int Force, MaxSpeed = 0; float TeeAngle, SpeederAngle, DiffAngle, SpeedLeft, TeeSpeed; - GameServer()->Collision()->GetSpeedup(Index, &Direction, &Force, &MaxSpeed); + Collision()->GetSpeedup(Index, &Direction, &Force, &MaxSpeed); if(Force == 255 && MaxSpeed) { m_Core.m_Vel = Direction * (MaxSpeed / 5); @@ -1444,17 +1444,17 @@ void CCharacter::HandleSkippableTiles(int Index) bool CCharacter::IsSwitchActiveCb(int Number, void *pUser) { CCharacter *pThis = (CCharacter *)pUser; - CCollision *pCollision = pThis->GameServer()->Collision(); + CCollision *pCollision = pThis->Collision(); return pCollision->m_pSwitchers && pThis->Team() != TEAM_SUPER && pCollision->m_pSwitchers[Number].m_Status[pThis->Team()]; } void CCharacter::HandleTiles(int Index) { int MapIndex = Index; - //int PureMapIndex = GameServer()->Collision()->GetPureMapIndex(m_Pos); - m_TileIndex = GameServer()->Collision()->GetTileIndex(MapIndex); - m_TileFIndex = GameServer()->Collision()->GetFTileIndex(MapIndex); - m_MoveRestrictions = GameServer()->Collision()->GetMoveRestrictions(IsSwitchActiveCb, this, m_Pos, 18.0f, MapIndex); + //int PureMapIndex = Collision()->GetPureMapIndex(m_Pos); + m_TileIndex = Collision()->GetTileIndex(MapIndex); + m_TileFIndex = Collision()->GetFTileIndex(MapIndex); + m_MoveRestrictions = Collision()->GetMoveRestrictions(IsSwitchActiveCb, this, m_Pos, 18.0f, MapIndex); if(Index < 0) { m_LastRefillJumps = false; @@ -1462,7 +1462,7 @@ void CCharacter::HandleTiles(int Index) m_LastBonus = false; return; } - int cp = GameServer()->Collision()->IsCheckpoint(MapIndex); + int cp = Collision()->IsCheckpoint(MapIndex); if(cp != -1 && m_DDRaceState == DDRACE_STARTED && cp > m_CpActive) { m_CpActive = cp; @@ -1488,7 +1488,7 @@ void CCharacter::HandleTiles(int Index) Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, m_pPlayer->GetCID()); } } - int cpf = GameServer()->Collision()->IsFCheckpoint(MapIndex); + int cpf = Collision()->IsFCheckpoint(MapIndex); if(cpf != -1 && m_DDRaceState == DDRACE_STARTED && cpf > m_CpActive) { m_CpActive = cpf; @@ -1514,7 +1514,7 @@ void CCharacter::HandleTiles(int Index) Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, m_pPlayer->GetCID()); } } - int tcp = GameServer()->Collision()->IsTCheckpoint(MapIndex); + int tcp = Collision()->IsTCheckpoint(MapIndex); if(tcp) m_TeleCheckpoint = tcp; @@ -1718,64 +1718,64 @@ void CCharacter::HandleTiles(int Index) m_Core.m_Vel = ClampVel(m_MoveRestrictions, m_Core.m_Vel); // handle switch tiles - if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_SWITCHOPEN && Team() != TEAM_SUPER && GameServer()->Collision()->GetSwitchNumber(MapIndex) > 0) + if(Collision()->GetSwitchType(MapIndex) == TILE_SWITCHOPEN && Team() != TEAM_SUPER && Collision()->GetSwitchNumber(MapIndex) > 0) { - GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()] = true; - GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_EndTick[Team()] = 0; - GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_Type[Team()] = TILE_SWITCHOPEN; + Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()] = true; + Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_EndTick[Team()] = 0; + Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Type[Team()] = TILE_SWITCHOPEN; } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_SWITCHTIMEDOPEN && Team() != TEAM_SUPER && GameServer()->Collision()->GetSwitchNumber(MapIndex) > 0) + else if(Collision()->GetSwitchType(MapIndex) == TILE_SWITCHTIMEDOPEN && Team() != TEAM_SUPER && Collision()->GetSwitchNumber(MapIndex) > 0) { - GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()] = true; - GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_EndTick[Team()] = Server()->Tick() + 1 + GameServer()->Collision()->GetSwitchDelay(MapIndex) * Server()->TickSpeed(); - GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_Type[Team()] = TILE_SWITCHTIMEDOPEN; + Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()] = true; + Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_EndTick[Team()] = Server()->Tick() + 1 + Collision()->GetSwitchDelay(MapIndex) * Server()->TickSpeed(); + Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Type[Team()] = TILE_SWITCHTIMEDOPEN; } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_SWITCHTIMEDCLOSE && Team() != TEAM_SUPER && GameServer()->Collision()->GetSwitchNumber(MapIndex) > 0) + else if(Collision()->GetSwitchType(MapIndex) == TILE_SWITCHTIMEDCLOSE && Team() != TEAM_SUPER && Collision()->GetSwitchNumber(MapIndex) > 0) { - GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()] = false; - GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_EndTick[Team()] = Server()->Tick() + 1 + GameServer()->Collision()->GetSwitchDelay(MapIndex) * Server()->TickSpeed(); - GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_Type[Team()] = TILE_SWITCHTIMEDCLOSE; + Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()] = false; + Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_EndTick[Team()] = Server()->Tick() + 1 + Collision()->GetSwitchDelay(MapIndex) * Server()->TickSpeed(); + Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Type[Team()] = TILE_SWITCHTIMEDCLOSE; } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_SWITCHCLOSE && Team() != TEAM_SUPER && GameServer()->Collision()->GetSwitchNumber(MapIndex) > 0) + else if(Collision()->GetSwitchType(MapIndex) == TILE_SWITCHCLOSE && Team() != TEAM_SUPER && Collision()->GetSwitchNumber(MapIndex) > 0) { - GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()] = false; - GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_EndTick[Team()] = 0; - GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_Type[Team()] = TILE_SWITCHCLOSE; + Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()] = false; + Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_EndTick[Team()] = 0; + Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Type[Team()] = TILE_SWITCHCLOSE; } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_FREEZE && Team() != TEAM_SUPER) + else if(Collision()->GetSwitchType(MapIndex) == TILE_FREEZE && Team() != TEAM_SUPER) { - if(GameServer()->Collision()->GetSwitchNumber(MapIndex) == 0 || GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()]) + if(Collision()->GetSwitchNumber(MapIndex) == 0 || Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()]) { - Freeze(GameServer()->Collision()->GetSwitchDelay(MapIndex)); + Freeze(Collision()->GetSwitchDelay(MapIndex)); } } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_DFREEZE && Team() != TEAM_SUPER) + else if(Collision()->GetSwitchType(MapIndex) == TILE_DFREEZE && Team() != TEAM_SUPER) { - if(GameServer()->Collision()->GetSwitchNumber(MapIndex) == 0 || GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()]) + if(Collision()->GetSwitchNumber(MapIndex) == 0 || Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()]) m_DeepFreeze = true; } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_DUNFREEZE && Team() != TEAM_SUPER) + else if(Collision()->GetSwitchType(MapIndex) == TILE_DUNFREEZE && Team() != TEAM_SUPER) { - if(GameServer()->Collision()->GetSwitchNumber(MapIndex) == 0 || GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()]) + if(Collision()->GetSwitchNumber(MapIndex) == 0 || Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()]) m_DeepFreeze = false; } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_LFREEZE && Team() != TEAM_SUPER) + else if(Collision()->GetSwitchType(MapIndex) == TILE_LFREEZE && Team() != TEAM_SUPER) { - if(GameServer()->Collision()->GetSwitchNumber(MapIndex) == 0 || GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()]) + if(Collision()->GetSwitchNumber(MapIndex) == 0 || Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()]) { m_LiveFreeze = true; m_Core.m_LiveFrozen = true; } } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_LUNFREEZE && Team() != TEAM_SUPER) + else if(Collision()->GetSwitchType(MapIndex) == TILE_LUNFREEZE && Team() != TEAM_SUPER) { - if(GameServer()->Collision()->GetSwitchNumber(MapIndex) == 0 || GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()]) + if(Collision()->GetSwitchNumber(MapIndex) == 0 || Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()]) { m_LiveFreeze = false; m_Core.m_LiveFrozen = false; } } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_HAMMER && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_HAMMER) + else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_HAMMER && Collision()->GetSwitchDelay(MapIndex) == WEAPON_HAMMER) { GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can hammer hit others"); m_Hit &= ~DISABLE_HIT_HAMMER; @@ -1783,7 +1783,7 @@ void CCharacter::HandleTiles(int Index) m_Core.m_NoHammerHit = false; GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_HAMMER) && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_HAMMER) + else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_HAMMER) && Collision()->GetSwitchDelay(MapIndex) == WEAPON_HAMMER) { GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't hammer hit others"); m_Hit |= DISABLE_HIT_HAMMER; @@ -1791,45 +1791,45 @@ void CCharacter::HandleTiles(int Index) m_Core.m_NoHammerHit = true; GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_SHOTGUN && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_SHOTGUN) + else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_SHOTGUN && Collision()->GetSwitchDelay(MapIndex) == WEAPON_SHOTGUN) { GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can shoot others with shotgun"); m_Hit &= ~DISABLE_HIT_SHOTGUN; m_Core.m_NoShotgunHit = false; } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_SHOTGUN) && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_SHOTGUN) + else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_SHOTGUN) && Collision()->GetSwitchDelay(MapIndex) == WEAPON_SHOTGUN) { GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't shoot others with shotgun"); m_Hit |= DISABLE_HIT_SHOTGUN; m_Core.m_NoShotgunHit = true; } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_GRENADE && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_GRENADE) + else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_GRENADE && Collision()->GetSwitchDelay(MapIndex) == WEAPON_GRENADE) { GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can shoot others with grenade"); m_Hit &= ~DISABLE_HIT_GRENADE; m_Core.m_NoGrenadeHit = false; } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_GRENADE) && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_GRENADE) + else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_GRENADE) && Collision()->GetSwitchDelay(MapIndex) == WEAPON_GRENADE) { GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't shoot others with grenade"); m_Hit |= DISABLE_HIT_GRENADE; m_Core.m_NoGrenadeHit = true; } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_LASER && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_LASER) + else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_LASER && Collision()->GetSwitchDelay(MapIndex) == WEAPON_LASER) { GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can shoot others with laser"); m_Hit &= ~DISABLE_HIT_LASER; m_Core.m_NoLaserHit = false; } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_LASER) && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_LASER) + else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_LASER) && Collision()->GetSwitchDelay(MapIndex) == WEAPON_LASER) { GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't shoot others with laser"); m_Hit |= DISABLE_HIT_LASER; m_Core.m_NoLaserHit = true; } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_JUMP) + else if(Collision()->GetSwitchType(MapIndex) == TILE_JUMP) { - int NewJumps = GameServer()->Collision()->GetSwitchDelay(MapIndex); + int NewJumps = Collision()->GetSwitchDelay(MapIndex); if(NewJumps == 255) { NewJumps = -1; @@ -1860,10 +1860,10 @@ void CCharacter::HandleTiles(int Index) m_Core.m_Jumps = NewJumps; } } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_ADD_TIME && !m_LastPenalty) + else if(Collision()->GetSwitchType(MapIndex) == TILE_ADD_TIME && !m_LastPenalty) { - int min = GameServer()->Collision()->GetSwitchDelay(MapIndex); - int sec = GameServer()->Collision()->GetSwitchNumber(MapIndex); + int min = Collision()->GetSwitchDelay(MapIndex); + int sec = Collision()->GetSwitchNumber(MapIndex); int Team = Teams()->m_Core.Team(m_Core.m_Id); m_StartTime -= (min * 60 + sec) * Server()->TickSpeed(); @@ -1884,10 +1884,10 @@ void CCharacter::HandleTiles(int Index) m_LastPenalty = true; } - else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_SUBTRACT_TIME && !m_LastBonus) + else if(Collision()->GetSwitchType(MapIndex) == TILE_SUBTRACT_TIME && !m_LastBonus) { - int min = GameServer()->Collision()->GetSwitchDelay(MapIndex); - int sec = GameServer()->Collision()->GetSwitchNumber(MapIndex); + int min = Collision()->GetSwitchDelay(MapIndex); + int sec = Collision()->GetSwitchNumber(MapIndex); int Team = Teams()->m_Core.Team(m_Core.m_Id); m_StartTime += (min * 60 + sec) * Server()->TickSpeed(); @@ -1911,17 +1911,17 @@ void CCharacter::HandleTiles(int Index) m_LastBonus = true; } - if(GameServer()->Collision()->GetSwitchType(MapIndex) != TILE_ADD_TIME) + if(Collision()->GetSwitchType(MapIndex) != TILE_ADD_TIME) { m_LastPenalty = false; } - if(GameServer()->Collision()->GetSwitchType(MapIndex) != TILE_SUBTRACT_TIME) + if(Collision()->GetSwitchType(MapIndex) != TILE_SUBTRACT_TIME) { m_LastBonus = false; } - int z = GameServer()->Collision()->IsTeleport(MapIndex); + int z = Collision()->IsTeleport(MapIndex); if(!g_Config.m_SvOldTeleportHook && !g_Config.m_SvOldTeleportWeapons && z && !(*m_pTeleOuts)[z - 1].empty()) { if(m_Super) @@ -1936,7 +1936,7 @@ void CCharacter::HandleTiles(int Index) ResetPickups(); return; } - int evilz = GameServer()->Collision()->IsEvilTeleport(MapIndex); + int evilz = Collision()->IsEvilTeleport(MapIndex); if(evilz && !(*m_pTeleOuts)[evilz - 1].empty()) { if(m_Super) @@ -1959,7 +1959,7 @@ void CCharacter::HandleTiles(int Index) } return; } - if(GameServer()->Collision()->IsCheckEvilTeleport(MapIndex)) + if(Collision()->IsCheckEvilTeleport(MapIndex)) { if(m_Super) return; @@ -1996,7 +1996,7 @@ void CCharacter::HandleTiles(int Index) } return; } - if(GameServer()->Collision()->IsCheckTeleport(MapIndex)) + if(Collision()->IsCheckTeleport(MapIndex)) { if(m_Super) return; @@ -2034,8 +2034,8 @@ void CCharacter::HandleTiles(int Index) void CCharacter::HandleTuneLayer() { m_TuneZoneOld = m_TuneZone; - int CurrentIndex = GameServer()->Collision()->GetMapIndex(m_Pos); - m_TuneZone = GameServer()->Collision()->IsTune(CurrentIndex); + int CurrentIndex = Collision()->GetMapIndex(m_Pos); + m_TuneZone = Collision()->IsTune(CurrentIndex); if(m_TuneZone) m_Core.m_Tuning = GameServer()->TuningList()[m_TuneZone]; // throw tunings from specific zone into gamecore @@ -2134,11 +2134,11 @@ void CCharacter::DDRaceTick() HandleTuneLayer(); // need this before coretick // check if the tee is in any type of freeze - int Index = GameServer()->Collision()->GetPureMapIndex(m_Pos); + int Index = Collision()->GetPureMapIndex(m_Pos); const int aTiles[] = { - GameServer()->Collision()->GetTileIndex(Index), - GameServer()->Collision()->GetFTileIndex(Index), - GameServer()->Collision()->GetSwitchType(Index)}; + Collision()->GetTileIndex(Index), + Collision()->GetFTileIndex(Index), + Collision()->GetSwitchType(Index)}; m_Core.m_IsInFreeze = false; for(const int Tile : aTiles) { @@ -2201,13 +2201,13 @@ void CCharacter::DDRacePostCoreTick() m_Core.m_Jumped = 1; } - int CurrentIndex = GameServer()->Collision()->GetMapIndex(m_Pos); + int CurrentIndex = Collision()->GetMapIndex(m_Pos); HandleSkippableTiles(CurrentIndex); if(!m_Alive) return; // handle Anti-Skip tiles - std::list Indices = GameServer()->Collision()->GetMapIndices(m_PrevPos, m_Pos); + std::list Indices = Collision()->GetMapIndices(m_PrevPos, m_Pos); if(!Indices.empty()) { for(int &Index : Indices)