diff --git a/src/game/client/prediction/entities/character.cpp b/src/game/client/prediction/entities/character.cpp index 86bcd39a6..7461c36b5 100644 --- a/src/game/client/prediction/entities/character.cpp +++ b/src/game/client/prediction/entities/character.cpp @@ -704,62 +704,62 @@ void CCharacter::HandleTiles(int Index) } // handle switch tiles - if(Collision()->IsSwitch(MapIndex) == TILE_FREEZE && Team() != TEAM_SUPER) + if(Collision()->GetSwitchType(MapIndex) == TILE_FREEZE && Team() != TEAM_SUPER) { if(Collision()->GetSwitchNumber(MapIndex) == 0 || Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()]) Freeze(Collision()->GetSwitchDelay(MapIndex)); } - else if(Collision()->IsSwitch(MapIndex) == TILE_DFREEZE && Team() != TEAM_SUPER) + else if(Collision()->GetSwitchType(MapIndex) == TILE_DFREEZE && Team() != TEAM_SUPER) { if(Collision()->GetSwitchNumber(MapIndex) == 0 || Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()]) m_DeepFreeze = true; } - else if(Collision()->IsSwitch(MapIndex) == TILE_DUNFREEZE && Team() != TEAM_SUPER) + else if(Collision()->GetSwitchType(MapIndex) == TILE_DUNFREEZE && Team() != TEAM_SUPER) { if(Collision()->GetSwitchNumber(MapIndex) == 0 || Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()]) m_DeepFreeze = false; } - else if(Collision()->IsSwitch(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_HAMMER && Collision()->GetSwitchDelay(MapIndex) == WEAPON_HAMMER) + else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_HAMMER && Collision()->GetSwitchDelay(MapIndex) == WEAPON_HAMMER) { m_Hit &= ~DISABLE_HIT_HAMMER; m_Core.m_NoHammerHit = false; } - else if(Collision()->IsSwitch(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_HAMMER) && Collision()->GetSwitchDelay(MapIndex) == WEAPON_HAMMER) + else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_HAMMER) && Collision()->GetSwitchDelay(MapIndex) == WEAPON_HAMMER) { m_Hit |= DISABLE_HIT_HAMMER; m_Core.m_NoHammerHit = true; } - else if(Collision()->IsSwitch(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_SHOTGUN && Collision()->GetSwitchDelay(MapIndex) == WEAPON_SHOTGUN) + else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_SHOTGUN && Collision()->GetSwitchDelay(MapIndex) == WEAPON_SHOTGUN) { m_Hit &= ~DISABLE_HIT_SHOTGUN; m_Core.m_NoShotgunHit = false; } - else if(Collision()->IsSwitch(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_SHOTGUN) && Collision()->GetSwitchDelay(MapIndex) == WEAPON_SHOTGUN) + else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_SHOTGUN) && Collision()->GetSwitchDelay(MapIndex) == WEAPON_SHOTGUN) { m_Hit |= DISABLE_HIT_SHOTGUN; m_Core.m_NoShotgunHit = true; } - else if(Collision()->IsSwitch(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_GRENADE && Collision()->GetSwitchDelay(MapIndex) == WEAPON_GRENADE) + else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_GRENADE && Collision()->GetSwitchDelay(MapIndex) == WEAPON_GRENADE) { m_Hit &= ~DISABLE_HIT_GRENADE; m_Core.m_NoGrenadeHit = false; } - else if(Collision()->IsSwitch(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_GRENADE) && Collision()->GetSwitchDelay(MapIndex) == WEAPON_GRENADE) + else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_GRENADE) && Collision()->GetSwitchDelay(MapIndex) == WEAPON_GRENADE) { m_Hit |= DISABLE_HIT_GRENADE; m_Core.m_NoGrenadeHit = true; } - else if(Collision()->IsSwitch(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_LASER && Collision()->GetSwitchDelay(MapIndex) == WEAPON_LASER) + else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_LASER && Collision()->GetSwitchDelay(MapIndex) == WEAPON_LASER) { m_Hit &= ~DISABLE_HIT_LASER; m_Core.m_NoLaserHit = false; } - else if(Collision()->IsSwitch(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_LASER) && Collision()->GetSwitchDelay(MapIndex) == WEAPON_LASER) + else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_LASER) && Collision()->GetSwitchDelay(MapIndex) == WEAPON_LASER) { m_Hit |= DISABLE_HIT_LASER; m_Core.m_NoLaserHit = true; } - else if(Collision()->IsSwitch(MapIndex) == TILE_JUMP) + else if(Collision()->GetSwitchType(MapIndex) == TILE_JUMP) { int newJumps = Collision()->GetSwitchDelay(MapIndex); if(newJumps != m_Core.m_Jumps) diff --git a/src/game/collision.cpp b/src/game/collision.cpp index 8549755f7..72eb919ac 100644 --- a/src/game/collision.cpp +++ b/src/game/collision.cpp @@ -754,7 +754,7 @@ void CCollision::GetSpeedup(int Index, vec2 *Dir, int *Force, int *MaxSpeed) con *MaxSpeed = m_pSpeedup[Index].m_MaxSpeed; } -int CCollision::IsSwitch(int Index) const +int CCollision::GetSwitchType(int Index) const { if(Index < 0 || !m_pSwitch) return 0; diff --git a/src/game/collision.h b/src/game/collision.h index ad2ea0b54..5a0434d45 100644 --- a/src/game/collision.h +++ b/src/game/collision.h @@ -92,7 +92,7 @@ public: int IsSpeedup(int Index) const; int IsTune(int Index) const; void GetSpeedup(int Index, vec2 *Dir, int *Force, int *MaxSpeed) const; - int IsSwitch(int Index) const; + int GetSwitchType(int Index) const; int GetSwitchNumber(int Index) const; int GetSwitchDelay(int Index) const; diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index b6d1927b2..67da3c5b1 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -1716,46 +1716,46 @@ void CCharacter::HandleTiles(int Index) m_Core.m_Vel = ClampVel(m_MoveRestrictions, m_Core.m_Vel); // handle switch tiles - if(GameServer()->Collision()->IsSwitch(MapIndex) == TILE_SWITCHOPEN && Team() != TEAM_SUPER && GameServer()->Collision()->GetSwitchNumber(MapIndex) > 0) + if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_SWITCHOPEN && Team() != TEAM_SUPER && GameServer()->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; } - else if(GameServer()->Collision()->IsSwitch(MapIndex) == TILE_SWITCHTIMEDOPEN && Team() != TEAM_SUPER && GameServer()->Collision()->GetSwitchNumber(MapIndex) > 0) + else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_SWITCHTIMEDOPEN && Team() != TEAM_SUPER && GameServer()->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; } - else if(GameServer()->Collision()->IsSwitch(MapIndex) == TILE_SWITCHTIMEDCLOSE && Team() != TEAM_SUPER && GameServer()->Collision()->GetSwitchNumber(MapIndex) > 0) + else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_SWITCHTIMEDCLOSE && Team() != TEAM_SUPER && GameServer()->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; } - else if(GameServer()->Collision()->IsSwitch(MapIndex) == TILE_SWITCHCLOSE && Team() != TEAM_SUPER && GameServer()->Collision()->GetSwitchNumber(MapIndex) > 0) + else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_SWITCHCLOSE && Team() != TEAM_SUPER && GameServer()->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; } - else if(GameServer()->Collision()->IsSwitch(MapIndex) == TILE_FREEZE && Team() != TEAM_SUPER) + else if(GameServer()->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()]) Freeze(GameServer()->Collision()->GetSwitchDelay(MapIndex)); } - else if(GameServer()->Collision()->IsSwitch(MapIndex) == TILE_DFREEZE && Team() != TEAM_SUPER) + else if(GameServer()->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()]) m_DeepFreeze = true; } - else if(GameServer()->Collision()->IsSwitch(MapIndex) == TILE_DUNFREEZE && Team() != TEAM_SUPER) + else if(GameServer()->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()]) m_DeepFreeze = false; } - else if(GameServer()->Collision()->IsSwitch(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_HAMMER && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_HAMMER) + else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_HAMMER && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_HAMMER) { GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can hammer hit others"); m_Hit &= ~DISABLE_HIT_HAMMER; @@ -1763,7 +1763,7 @@ void CCharacter::HandleTiles(int Index) m_Core.m_NoHammerHit = false; GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings } - else if(GameServer()->Collision()->IsSwitch(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_HAMMER) && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_HAMMER) + else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_HAMMER) && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_HAMMER) { GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't hammer hit others"); m_Hit |= DISABLE_HIT_HAMMER; @@ -1771,43 +1771,43 @@ void CCharacter::HandleTiles(int Index) m_Core.m_NoHammerHit = true; GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings } - else if(GameServer()->Collision()->IsSwitch(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_SHOTGUN && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_SHOTGUN) + else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_SHOTGUN && GameServer()->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()->IsSwitch(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_SHOTGUN) && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_SHOTGUN) + else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_SHOTGUN) && GameServer()->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()->IsSwitch(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_GRENADE && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_GRENADE) + else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_GRENADE && GameServer()->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()->IsSwitch(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_GRENADE) && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_GRENADE) + else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_GRENADE) && GameServer()->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()->IsSwitch(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_LASER && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_LASER) + else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_LASER && GameServer()->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()->IsSwitch(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_LASER) && GameServer()->Collision()->GetSwitchDelay(MapIndex) == WEAPON_LASER) + else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_LASER) && GameServer()->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()->IsSwitch(MapIndex) == TILE_JUMP) + else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_JUMP) { int newJumps = GameServer()->Collision()->GetSwitchDelay(MapIndex); @@ -1834,7 +1834,7 @@ void CCharacter::HandleTiles(int Index) m_Core.m_Jumps = newJumps; } } - else if(GameServer()->Collision()->IsSwitch(MapIndex) == TILE_ADD_TIME && !m_LastPenalty) + else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_ADD_TIME && !m_LastPenalty) { int min = GameServer()->Collision()->GetSwitchDelay(MapIndex); int sec = GameServer()->Collision()->GetSwitchNumber(MapIndex); @@ -1858,7 +1858,7 @@ void CCharacter::HandleTiles(int Index) m_LastPenalty = true; } - else if(GameServer()->Collision()->IsSwitch(MapIndex) == TILE_SUBTRACT_TIME && !m_LastBonus) + else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_SUBTRACT_TIME && !m_LastBonus) { int min = GameServer()->Collision()->GetSwitchDelay(MapIndex); int sec = GameServer()->Collision()->GetSwitchNumber(MapIndex); @@ -1885,12 +1885,12 @@ void CCharacter::HandleTiles(int Index) m_LastBonus = true; } - if(GameServer()->Collision()->IsSwitch(MapIndex) != TILE_ADD_TIME) + if(GameServer()->Collision()->GetSwitchType(MapIndex) != TILE_ADD_TIME) { m_LastPenalty = false; } - if(GameServer()->Collision()->IsSwitch(MapIndex) != TILE_SUBTRACT_TIME) + if(GameServer()->Collision()->GetSwitchType(MapIndex) != TILE_SUBTRACT_TIME) { m_LastBonus = false; } @@ -2108,7 +2108,7 @@ void CCharacter::DDRaceTick() const int aTiles[] = { GameServer()->Collision()->GetTileIndex(Index), GameServer()->Collision()->GetFTileIndex(Index), - GameServer()->Collision()->IsSwitch(Index)}; + GameServer()->Collision()->GetSwitchType(Index)}; if(IsGrounded() && !m_DeepFreeze) { bool IsInFreeze = false; diff --git a/src/game/server/entities/laser.cpp b/src/game/server/entities/laser.cpp index 3e623630b..453a49f9b 100644 --- a/src/game/server/entities/laser.cpp +++ b/src/game/server/entities/laser.cpp @@ -193,8 +193,8 @@ void CLaser::DoBounce() { int MapIndex = GameServer()->Collision()->GetPureMapIndex(Coltile); int TileFIndex = GameServer()->Collision()->GetFTileIndex(MapIndex); - bool IsSwitchTeleGun = GameServer()->Collision()->IsSwitch(MapIndex) == TILE_ALLOW_TELE_GUN; - bool IsBlueSwitchTeleGun = GameServer()->Collision()->IsSwitch(MapIndex) == TILE_ALLOW_BLUE_TELE_GUN; + bool IsSwitchTeleGun = GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_ALLOW_TELE_GUN; + bool IsBlueSwitchTeleGun = GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_ALLOW_BLUE_TELE_GUN; int IsTeleInWeapon = GameServer()->Collision()->IsTeleportWeapon(MapIndex); if(!IsTeleInWeapon) diff --git a/src/game/server/entities/projectile.cpp b/src/game/server/entities/projectile.cpp index 14b0b7736..1d8fe3d23 100644 --- a/src/game/server/entities/projectile.cpp +++ b/src/game/server/entities/projectile.cpp @@ -179,8 +179,8 @@ void CProjectile::Tick() { int MapIndex = GameServer()->Collision()->GetPureMapIndex(pTargetChr ? pTargetChr->m_Pos : ColPos); int TileFIndex = GameServer()->Collision()->GetFTileIndex(MapIndex); - bool IsSwitchTeleGun = GameServer()->Collision()->IsSwitch(MapIndex) == TILE_ALLOW_TELE_GUN; - bool IsBlueSwitchTeleGun = GameServer()->Collision()->IsSwitch(MapIndex) == TILE_ALLOW_BLUE_TELE_GUN; + bool IsSwitchTeleGun = GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_ALLOW_TELE_GUN; + bool IsBlueSwitchTeleGun = GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_ALLOW_BLUE_TELE_GUN; if(IsSwitchTeleGun || IsBlueSwitchTeleGun) {