From 19e379afdff058bd41820f0f2738634215fbf60e Mon Sep 17 00:00:00 2001 From: GreYFoXGTi Date: Sat, 21 Aug 2010 19:25:10 +0200 Subject: [PATCH] Updated GetTile for FrontLayer Added dbg_msg check Signed-off-by: GreYFoXGTi --- src/game/collision.cpp | 19 ++++++++++++------- src/game/server/gamecontroller.cpp | 4 ++++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/game/collision.cpp b/src/game/collision.cpp index 6beac3c8a..f76553b2f 100644 --- a/src/game/collision.cpp +++ b/src/game/collision.cpp @@ -173,18 +173,23 @@ int CCollision::GetTile(int x, int y) int nx = clamp(x/32, 0, m_Width-1); int ny = clamp(y/32, 0, m_Height-1); /*dbg_msg("GetTile","m_Index %d",m_pTiles[ny*m_Width+nx].m_Index);//Remove */ - if(m_pTiles[ny*m_Width+nx].m_Index == COLFLAG_SOLID - || m_pTiles[ny*m_Width+nx].m_Index == (COLFLAG_SOLID|COLFLAG_NOHOOK) - || m_pTiles[ny*m_Width+nx].m_Index == COLFLAG_DEATH - || m_pTiles[ny*m_Width+nx].m_Index == COLFLAG_NOLASER) + if(m_pTiles[ny*m_Width+nx].m_Index == COLFLAG_SOLID || + m_pTiles[ny*m_Width+nx].m_Index == (COLFLAG_SOLID|COLFLAG_NOHOOK) || + m_pTiles[ny*m_Width+nx].m_Index == COLFLAG_DEATH || + m_pTiles[ny*m_Width+nx].m_Index == COLFLAG_NOLASER || + (m_pFront && (m_pFront[ny*m_Width+nx].m_Index == COLFLAG_SOLID)) || + (m_pFront && (m_pFront[ny*m_Width+nx].m_Index == (COLFLAG_SOLID|COLFLAG_NOHOOK))) || + (m_pFront && (m_pFront[ny*m_Width+nx].m_Index == COLFLAG_DEATH)) || + (m_pFront && (m_pFront[ny*m_Width+nx].m_Index == COLFLAG_NOLASER))) + return m_pTiles[ny*m_Width+nx].m_Index; else return 0; } int CCollision::Entity(int x, int y, bool Front) { - //if(0 < x || x >= m_Width) return 0; - //if(0 < y || y >= m_Height) return 0; + if(0 < x || x >= m_Width) return 0; + if(0 < y || y >= m_Height) return 0; int Index = Front?m_pFront[y*m_Width+x].m_Index:m_pTiles[y*m_Width+x].m_Index; return Index-ENTITY_OFFSET; } @@ -271,7 +276,7 @@ int CCollision::IntersectNoLaser(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 { float a = f/d; vec2 Pos = mix(Pos0, Pos1, a); - if(IsSolid(round(Pos.x), round(Pos.y)) || IsNoLaser(round(Pos.x), round(Pos.y))) + if(CheckPoint(Pos.x, Pos.y) || IsNoLaser(round(Pos.x), round(Pos.y))) { if(pOutCollision) *pOutCollision = Pos; diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp index ed4391557..709ffd7fb 100644 --- a/src/game/server/gamecontroller.cpp +++ b/src/game/server/gamecontroller.cpp @@ -121,12 +121,16 @@ bool IGameController::OnEntity(int Index, vec2 Pos, bool Front) { if (Index<0) return false; + int temp1=Pos.x; + int temp2=Pos.y; + dbg_msg("OnEntity","Index=%d Front=%d",Index,Front);//Remove*/ int Type = -1; int SubType = 0; int x,y; x=(Pos.x-16.0f)/32.0f; y=(Pos.y-16.0f)/32.0f; + dbg_msg("OnEntity","Pos %d %d, x%d y%d",temp1,temp2,x,y);//Remove*/ /*dbg_msg("OnEntity","Pos(%d,%d)",x,y);//Remove*/ int sides[8]; sides[0]=GameServer()->Collision()->Entity(x,y+1, Front);