mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 09:34:19 +00:00
general enhancements
Signed-off-by: GreYFoXGTi <GreYFoXGTi@GMaiL.CoM>
This commit is contained in:
parent
394013374a
commit
51d6670ad9
|
@ -100,6 +100,7 @@ void CCollision::Init(class CLayers *pLayers)
|
||||||
int CCollision::GetMapIndex(vec2 PrevPos, vec2 Pos)
|
int CCollision::GetMapIndex(vec2 PrevPos, vec2 Pos)
|
||||||
{
|
{
|
||||||
float d = distance(PrevPos, Pos);
|
float d = distance(PrevPos, Pos);
|
||||||
|
int End(d+1);
|
||||||
|
|
||||||
if(!d)
|
if(!d)
|
||||||
{
|
{
|
||||||
|
@ -109,11 +110,11 @@ int CCollision::GetMapIndex(vec2 PrevPos, vec2 Pos)
|
||||||
else if (m_pTele && m_pTele[ny*m_Width+nx].m_Type==TILE_TELEOUT) dbg_msg("TELEOUT","ny*m_Width+nx %d",ny*m_Width+nx);
|
else if (m_pTele && m_pTele[ny*m_Width+nx].m_Type==TILE_TELEOUT) dbg_msg("TELEOUT","ny*m_Width+nx %d",ny*m_Width+nx);
|
||||||
else dbg_msg("GetMapIndex(","ny*m_Width+nx %d",ny*m_Width+nx);//REMOVE */
|
else dbg_msg("GetMapIndex(","ny*m_Width+nx %d",ny*m_Width+nx);//REMOVE */
|
||||||
|
|
||||||
if((m_pTiles[ny*m_Width+nx].m_Index >= TILE_THROUGH && m_pTiles[ny*m_Width+nx].m_Index < TILE_TELEIN) ||
|
if((m_pTiles[ny*m_Width+nx].m_Index >= TILE_FREEZE && m_pTiles[ny*m_Width+nx].m_Index < TILE_TELEIN) ||
|
||||||
((m_pTiles[ny*m_Width+nx].m_Index >TILE_BOOST)&&(m_pTiles[ny*m_Width+nx].m_Index <= TILE_NPH) ) ||
|
((m_pTiles[ny*m_Width+nx].m_Index >TILE_BOOST)&&(m_pTiles[ny*m_Width+nx].m_Index <= TILE_NPH) ) ||
|
||||||
(m_pFront && (m_pFront[ny*m_Width+nx].m_Index >= TILE_THROUGH && m_pFront[ny*m_Width+nx].m_Index < TILE_TELEIN)) ||
|
(m_pFront && (m_pFront[ny*m_Width+nx].m_Index >= TILE_FREEZE && m_pFront[ny*m_Width+nx].m_Index < TILE_TELEIN)) ||
|
||||||
(m_pFront && ((m_pFront[ny*m_Width+nx].m_Index >TILE_BOOST)&&(m_pFront[ny*m_Width+nx].m_Index <= TILE_NPH))) ||
|
(m_pFront && ((m_pFront[ny*m_Width+nx].m_Index >TILE_BOOST)&&(m_pFront[ny*m_Width+nx].m_Index <= TILE_NPH))) ||
|
||||||
(m_pTele && (m_pTele[ny*m_Width+nx].m_Type == TILE_TELEIN || m_pTele[ny*m_Width+nx].m_Type == TILE_TELEOUT)) ||
|
(m_pTele && (m_pTele[ny*m_Width+nx].m_Type == TILE_TELEIN || m_pTele[ny*m_Width+nx].m_Type == TILE_TELEINEVIL || m_pTele[ny*m_Width+nx].m_Type == TILE_TELEOUT)) ||
|
||||||
(m_pSpeedup && m_pSpeedup[ny*m_Width+nx].m_Force > 0))
|
(m_pSpeedup && m_pSpeedup[ny*m_Width+nx].m_Force > 0))
|
||||||
{
|
{
|
||||||
return ny*m_Width+nx;
|
return ny*m_Width+nx;
|
||||||
|
@ -125,15 +126,15 @@ int CCollision::GetMapIndex(vec2 PrevPos, vec2 Pos)
|
||||||
int nx = 0;
|
int nx = 0;
|
||||||
int ny = 0;
|
int ny = 0;
|
||||||
|
|
||||||
for(float f = 0; f < d; f++)
|
for(int i = 0; i < End; i++)
|
||||||
{
|
{
|
||||||
a = f/d;
|
a = i/d;
|
||||||
Tmp = mix(PrevPos, Pos, a);
|
Tmp = mix(PrevPos, Pos, a);
|
||||||
nx = clamp((int)Tmp.x/32, 0, m_Width-1);
|
nx = clamp((int)Tmp.x/32, 0, m_Width-1);
|
||||||
ny = clamp((int)Tmp.y/32, 0, m_Height-1);
|
ny = clamp((int)Tmp.y/32, 0, m_Height-1);
|
||||||
if((m_pTiles[ny*m_Width+nx].m_Index >= TILE_THROUGH && m_pTiles[ny*m_Width+nx].m_Index < TILE_TELEIN) ||
|
if((m_pTiles[ny*m_Width+nx].m_Index >= TILE_FREEZE && m_pTiles[ny*m_Width+nx].m_Index < TILE_TELEIN) ||
|
||||||
((m_pTiles[ny*m_Width+nx].m_Index >TILE_BOOST)&&(m_pTiles[ny*m_Width+nx].m_Index <= TILE_NPH) ) ||
|
((m_pTiles[ny*m_Width+nx].m_Index >TILE_BOOST)&&(m_pTiles[ny*m_Width+nx].m_Index <= TILE_NPH) ) ||
|
||||||
(m_pFront && (m_pFront[ny*m_Width+nx].m_Index >= TILE_THROUGH && m_pFront[ny*m_Width+nx].m_Index < TILE_TELEIN)) ||
|
(m_pFront && (m_pFront[ny*m_Width+nx].m_Index >= TILE_FREEZE && m_pFront[ny*m_Width+nx].m_Index < TILE_TELEIN)) ||
|
||||||
(m_pFront && ((m_pFront[ny*m_Width+nx].m_Index >TILE_BOOST)&&(m_pFront[ny*m_Width+nx].m_Index <= TILE_NPH))) ||
|
(m_pFront && ((m_pFront[ny*m_Width+nx].m_Index >TILE_BOOST)&&(m_pFront[ny*m_Width+nx].m_Index <= TILE_NPH))) ||
|
||||||
(m_pTele && (m_pTele[ny*m_Width+nx].m_Type == TILE_TELEIN || m_pTele[ny*m_Width+nx].m_Type == TILE_TELEINEVIL || m_pTele[ny*m_Width+nx].m_Type == TILE_TELEOUT)) ||
|
(m_pTele && (m_pTele[ny*m_Width+nx].m_Type == TILE_TELEIN || m_pTele[ny*m_Width+nx].m_Type == TILE_TELEINEVIL || m_pTele[ny*m_Width+nx].m_Type == TILE_TELEOUT)) ||
|
||||||
(m_pSpeedup && m_pSpeedup[ny*m_Width+nx].m_Force > 0))
|
(m_pSpeedup && m_pSpeedup[ny*m_Width+nx].m_Force > 0))
|
||||||
|
|
Loading…
Reference in a new issue