From ed575f9b0c0388e860d899082815931e54341541 Mon Sep 17 00:00:00 2001 From: GreYFoXGTi Date: Tue, 24 Aug 2010 03:30:22 +0200 Subject: [PATCH] Fixed 2x and 1.5x boosters Removed Unused Vars Signed-off-by: GreYFoXGTi --- src/game/server/entities/character.cpp | 20 +++++++++++--------- src/game/server/entities/character.h | 3 ++- src/game/server/player.cpp | 2 -- src/game/server/player.h | 1 - 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 5ab95e402..037c0b642 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -79,7 +79,6 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos) GameServer()->m_World.InsertEntity(this); m_Alive = true; - dbg_msg("m_RconFreeze","%d",m_pPlayer->m_RconFreeze); if(m_pPlayer->m_RconFreeze) Freeze(-1); GameServer()->m_pController->OnCharacterSpawn(this); @@ -729,58 +728,61 @@ void CCharacter::Tick() { if(m_PrevPos.x-m_Pos.x<0) m_Core.m_Vel.x += m_Core.m_Vel.x *-0.5; - else + else if(m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2) m_Core.m_Vel.x += m_Core.m_Vel.x*0.5; } if (TileIndex1 == TILE_BOOST_R || TileIndex2 == TILE_BOOST_R) { if(m_PrevPos.x-m_Pos.x>0) m_Core.m_Vel.x += m_Core.m_Vel.x *-0.5; - else + else if(m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2) m_Core.m_Vel.x += m_Core.m_Vel.x*0.5; } if (TileIndex1 == TILE_BOOST_D || TileIndex2 == TILE_BOOST_D) { if(m_PrevPos.y-m_Pos.y>0) m_Core.m_Vel.y += m_Core.m_Vel.y *-0.5; - else + else if(m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2) m_Core.m_Vel.y += m_Core.m_Vel.y*0.5; } if (TileIndex1 == TILE_BOOST_U || TileIndex2 == TILE_BOOST_U) { if(m_PrevPos.y-m_Pos.y<0) m_Core.m_Vel.y += m_Core.m_Vel.y *-0.5; - else + else if(m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2) m_Core.m_Vel.y += m_Core.m_Vel.y*0.5; } - if (TileIndex1 == TILE_BOOST_L2 || TileIndex2 == TILE_BOOST_L2) + if ((TileIndex1 == TILE_BOOST_L2 || TileIndex2 == TILE_BOOST_L2) && (m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2)) { if(m_PrevPos.x-m_Pos.x<0) m_Core.m_Vel.x = m_Core.m_Vel.x *-1.1; else m_Core.m_Vel.x += m_Core.m_Vel.x*1.1; } - if (TileIndex1 == TILE_BOOST_R2|| TileIndex2 == TILE_BOOST_R2) + if ((TileIndex1 == TILE_BOOST_R2|| TileIndex2 == TILE_BOOST_R2) && (m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2)) { if(m_PrevPos.x-m_Pos.x>0) m_Core.m_Vel.x = m_Core.m_Vel.x *-1.1; else m_Core.m_Vel.x += m_Core.m_Vel.x*1.1; } - if (TileIndex1 == TILE_BOOST_D2 || TileIndex2 == TILE_BOOST_D2) + if ((TileIndex1 == TILE_BOOST_D2 || TileIndex2 == TILE_BOOST_D2) && (m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2)) { if(m_PrevPos.y-m_Pos.y>0) m_Core.m_Vel.y = m_Core.m_Vel.y *-1.1; else m_Core.m_Vel.y += m_Core.m_Vel.y*1.1; } - if (TileIndex1 == TILE_BOOST_U2 || TileIndex2 == TILE_BOOST_U2) + if ((TileIndex1 == TILE_BOOST_U2 || TileIndex2 == TILE_BOOST_U2) && (m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2)) { if(m_PrevPos.y-m_Pos.y<0) m_Core.m_Vel.y = m_Core.m_Vel.y *-1.1; else m_Core.m_Vel.y += m_Core.m_Vel.y*1.1; } + m_LastBooster = TileIndex1; + m_LastFBooster = TileIndex2; + // handle speedup tiles if(GameServer()->Collision()->IsSpeedup((int)m_Core.m_Pos.x, (int)m_Core.m_Pos.y)) { vec2 Direction; diff --git a/src/game/server/entities/character.h b/src/game/server/entities/character.h index 9561ecfb2..6918a76d8 100644 --- a/src/game/server/entities/character.h +++ b/src/game/server/entities/character.h @@ -161,7 +161,8 @@ public: int m_StartTime; int m_RefreshTime; - int m_LastSpeedup; + int m_LastBooster; + int m_LastFBooster; vec2 m_PrevPos; // checkpoints diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 96b456239..76276947b 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -248,7 +248,6 @@ void CPlayer::LoadCharacter() { Character->m_Armor = m_PauseInfo.m_Armor; Character->m_PlayerState = m_PauseInfo.m_PlayerState; Character->m_LastMove = m_PauseInfo.m_LastMove; - Character->m_LastSpeedup = m_PauseInfo.m_LastSpeedup; Character->m_PrevPos = m_PauseInfo.m_PrevPos; Character->m_ActiveWeapon = m_PauseInfo.m_ActiveWeapon; Character->m_LastWeapon = m_PauseInfo.m_LastWeapon; @@ -276,7 +275,6 @@ void CPlayer::SaveCharacter() m_PauseInfo.m_Armor = Character->m_Armor; m_PauseInfo.m_PlayerState = Character->m_PlayerState; m_PauseInfo.m_LastMove = Character->m_LastMove; - m_PauseInfo.m_LastSpeedup = Character->m_LastSpeedup; m_PauseInfo.m_PrevPos = Character->m_PrevPos; m_PauseInfo.m_ActiveWeapon = Character->m_ActiveWeapon; m_PauseInfo.m_LastWeapon = Character->m_LastWeapon; diff --git a/src/game/server/player.h b/src/game/server/player.h index 64ad17309..095b66d2f 100644 --- a/src/game/server/player.h +++ b/src/game/server/player.h @@ -48,7 +48,6 @@ public: int m_Armor; int m_PlayerState; int m_LastMove; - int m_LastSpeedup; vec2 m_PrevPos; int m_ActiveWeapon; int m_LastWeapon;