From bd90c006e2ce979093332a27ec411bb5a8ad4aa8 Mon Sep 17 00:00:00 2001 From: GreYFoXGTi Date: Tue, 31 Aug 2010 08:43:44 +0200 Subject: [PATCH] The bug still exists but i thought why keep checking for more tees in laser/door wait for 1 tee 1st Signed-off-by: GreYFoXGTi --- src/game/server/entities/door.cpp | 56 +++++++++++++++++------------- src/game/server/entities/light.cpp | 55 ++++++++++++++++------------- 2 files changed, 61 insertions(+), 50 deletions(-) diff --git a/src/game/server/entities/door.cpp b/src/game/server/entities/door.cpp index 69dfbf368..8026ba497 100644 --- a/src/game/server/entities/door.cpp +++ b/src/game/server/entities/door.cpp @@ -30,41 +30,47 @@ void CDoor::Close() bool CDoor::HitCharacter() { - vec2 Points[36]; vec2 At; - for(int i=1;i<=36;i++) - { - Points[i-1].x = m_Pos.x * (1 - i/38.0) + m_To.x * i / 38.0; - Points[i-1].y = m_Pos.y * (1 - i/38.0) + m_To.y * i / 38.0; - } - CCharacter *Hit = GameServer()->m_World.IntersectCharacter(m_Pos, Points[0], 1.f, At, 0); + CCharacter *Hit = GameServer()->m_World.IntersectCharacter(m_Pos, m_To, 1.f, At, 0); if(Hit) - Hit->m_Doored = true; - Hit = 0; - Hit = GameServer()->m_World.IntersectCharacter(Points[0], m_Pos, 1.f, At, 0); - if(Hit) - Hit->m_Doored = true; - Hit = 0; - for(int i = 0; i < 36; i++) { - Hit = GameServer()->m_World.IntersectCharacter(Points[i], Points[i+1], 1.f, At, 0); + vec2 Points[36]; + Hit->m_Doored = true; + Hit = 0; + for(int i=1;i<=36;i++) + { + Points[i-1].x = m_Pos.x * (1 - i/38.0) + m_To.x * i / 38.0; + Points[i-1].y = m_Pos.y * (1 - i/38.0) + m_To.y * i / 38.0; + } + CCharacter *Hit = GameServer()->m_World.IntersectCharacter(m_Pos, Points[0], 1.f, At, 0); if(Hit) Hit->m_Doored = true; Hit = 0; - Hit = GameServer()->m_World.IntersectCharacter(Points[i+1], Points[i], 1.f, At, 0); + Hit = GameServer()->m_World.IntersectCharacter(Points[0], m_Pos, 1.f, At, 0); if(Hit) Hit->m_Doored = true; Hit = 0; + for(int i = 0; i < 36; i++) + { + Hit = GameServer()->m_World.IntersectCharacter(Points[i], Points[i+1], 1.f, At, 0); + if(Hit) + Hit->m_Doored = true; + Hit = 0; + Hit = GameServer()->m_World.IntersectCharacter(Points[i+1], Points[i], 1.f, At, 0); + if(Hit) + Hit->m_Doored = true; + Hit = 0; + } + Hit = GameServer()->m_World.IntersectCharacter(Points[35], m_To, 1.f, At, 0); + if(Hit) + Hit->m_Doored = true; + Hit = 0; + Hit = GameServer()->m_World.IntersectCharacter(m_To, Points[35], 1.f, At, 0); + if(Hit) + Hit->m_Doored = true; + Hit = 0; + //hit->reset_pos(); } - Hit = GameServer()->m_World.IntersectCharacter(Points[35], m_To, 1.f, At, 0); - if(Hit) - Hit->m_Doored = true; - Hit = 0; - Hit = GameServer()->m_World.IntersectCharacter(m_To, Points[35], 1.f, At, 0); - if(Hit) - Hit->m_Doored = true; - Hit = 0; - //hit->reset_pos(); return true; } diff --git a/src/game/server/entities/light.cpp b/src/game/server/entities/light.cpp index 68edbc0d1..0c4264f7c 100644 --- a/src/game/server/entities/light.cpp +++ b/src/game/server/entities/light.cpp @@ -28,40 +28,45 @@ CLight::CLight(CGameWorld *pGameWorld, vec2 Pos, float Rotation, int Length) bool CLight::HitCharacter() { vec2 At; - vec2 Points[36]; - for(int i=1;i<37;i++) - { - Points[i-1].x = m_Pos.x * (1 - i/38.0) + m_To.x * i / 38.0; - Points[i-1].y = m_Pos.y * (1 - i/38.0) + m_To.y * i / 38.0; - } - CCharacter *Hit = GameServer()->m_World.IntersectCharacter(m_Pos, Points[0], 1.f, At, 0); + CCharacter *Hit = GameServer()->m_World.IntersectCharacter(m_Pos, m_To, 1.f, At, 0); if(Hit) - Hit->Freeze(Server()->TickSpeed()*3); - Hit = 0; - Hit = GameServer()->m_World.IntersectCharacter(Points[0], m_Pos, 1.f, At, 0); - if(Hit) - Hit->Freeze(Server()->TickSpeed()*3); - Hit = 0; - for(int i = 0; i < 36; i++) { - Hit = GameServer()->m_World.IntersectCharacter(Points[i], Points[i+1], 1.f, At, 0); + vec2 Points[36]; + Hit->Freeze(Server()->TickSpeed()*3); + Hit = 0; + for(int i=1;i<37;i++) + { + Points[i-1].x = m_Pos.x * (1 - i/38.0) + m_To.x * i / 38.0; + Points[i-1].y = m_Pos.y * (1 - i/38.0) + m_To.y * i / 38.0; + } + Hit = GameServer()->m_World.IntersectCharacter(m_Pos, Points[0], 1.f, At, 0); if(Hit) Hit->Freeze(Server()->TickSpeed()*3); Hit = 0; - Hit = GameServer()->m_World.IntersectCharacter(Points[i+1], Points[i], 1.f, At, 0); + Hit = GameServer()->m_World.IntersectCharacter(Points[0], m_Pos, 1.f, At, 0); + if(Hit) + Hit->Freeze(Server()->TickSpeed()*3); + Hit = 0; + for(int i = 0; i < 36; i++) + { + Hit = GameServer()->m_World.IntersectCharacter(Points[i], Points[i+1], 1.f, At, 0); + if(Hit) + Hit->Freeze(Server()->TickSpeed()*3); + Hit = 0; + Hit = GameServer()->m_World.IntersectCharacter(Points[i+1], Points[i], 1.f, At, 0); + if(Hit) + Hit->Freeze(Server()->TickSpeed()*3); + Hit = 0; + } + Hit = GameServer()->m_World.IntersectCharacter(Points[35], m_To, 1.f, At, 0); + if(Hit) + Hit->Freeze(Server()->TickSpeed()*3); + Hit = 0; + Hit = GameServer()->m_World.IntersectCharacter(m_To, Points[35], 1.f, At, 0); if(Hit) Hit->Freeze(Server()->TickSpeed()*3); Hit = 0; } - Hit = GameServer()->m_World.IntersectCharacter(Points[35], m_To, 1.f, At, 0); - if(Hit) - Hit->Freeze(Server()->TickSpeed()*3); - Hit = 0; - Hit = GameServer()->m_World.IntersectCharacter(m_To, Points[35], 1.f, At, 0); - if(Hit) - Hit->Freeze(Server()->TickSpeed()*3); - Hit = 0; - return true; }