This commit is contained in:
Paul 2001-02-20 17:04:11 +00:00
parent 82fabeb2ed
commit 84c2259a25
2 changed files with 5 additions and 5 deletions

View file

@ -52,7 +52,7 @@ int CLayerCollision::getHeightFromGround(int _x,int _y,int _maxHeight)
yFraction=16-(_y&0x0f); yFraction=16-(_y&0x0f);
distanceFromGround=0; distanceFromGround=0;
colHeight=m_collisionTable[(Map[mapX+mapY]*16)+xFraction]; colHeight=m_collisionTable[((Map[mapX+mapY]&COLLISION_MASK)*16)+xFraction];
if(colHeight) if(colHeight)
{ {
// Inside a collision block.. find the nearest ground above this point // Inside a collision block.. find the nearest ground above this point
@ -66,7 +66,7 @@ int CLayerCollision::getHeightFromGround(int _x,int _y,int _maxHeight)
{ {
return -_maxHeight; return -_maxHeight;
} }
colHeight=m_collisionTable[(Map[mapX+mapY]*16)+xFraction]; colHeight=m_collisionTable[((Map[mapX+mapY]&COLLISION_MASK)*16)+xFraction];
} }
distanceFromGround+=yFraction-colHeight; distanceFromGround+=yFraction-colHeight;
if(distanceFromGround<-_maxHeight)distanceFromGround=-_maxHeight; if(distanceFromGround<-_maxHeight)distanceFromGround=-_maxHeight;
@ -85,7 +85,7 @@ int CLayerCollision::getHeightFromGround(int _x,int _y,int _maxHeight)
{ {
return _maxHeight; return _maxHeight;
} }
colHeight=m_collisionTable[(Map[mapX+mapY]*16)+xFraction]; colHeight=m_collisionTable[((Map[mapX+mapY]&COLLISION_MASK)*16)+xFraction];
} }
distanceFromGround+=yFraction-colHeight; distanceFromGround+=yFraction-colHeight;
if(distanceFromGround>_maxHeight)distanceFromGround=_maxHeight; if(distanceFromGround>_maxHeight)distanceFromGround=_maxHeight;
@ -128,7 +128,7 @@ void CLayerCollision::render(DVECTOR &MapPos)
coll=&Map[mapx+(mapy*MapWidth)]; coll=&Map[mapx+(mapy*MapWidth)];
for(x=-xoff;x<(33*16)-xoff;x+=16) for(x=-xoff;x<(33*16)-xoff;x+=16)
{ {
switch(*coll) switch((*coll)&COLLISION_MASK)
{ {
case 0: case 0:
break; break;

View file

@ -22,7 +22,7 @@ virtual ~CLayerCollision();
virtual void shutdown(); virtual void shutdown();
u8 Get(int X,int Y) {return(Map[X+(Y*MapWidth)]);} u8 Get(int X,int Y) {return(Map[X+(Y*MapWidth)]&COLLISION_MASK);}
int getHeightFromGround(int _x,int _y,int _maxHeight=32); int getHeightFromGround(int _x,int _y,int _maxHeight=32);
#ifdef __SHOW_COLLISION__ #ifdef __SHOW_COLLISION__