This commit is contained in:
Paul 2001-02-22 15:14:49 +00:00
parent 08f5fb4abf
commit 376d81c387
3 changed files with 39 additions and 3 deletions

View File

@ -95,6 +95,35 @@ int CLayerCollision::getHeightFromGround(int _x,int _y,int _maxHeight)
}
/*****************************************************************************/
int CLayerCollision::getCollisionType(int _x,int _y)
{
int mapX,mapY,xFraction,yFraction;
int distanceFromGround;
int block,colHeight;
int ret;
mapX=_x>>4;
mapY=(_y>>4)*MapWidth;
xFraction=_x&0x0f;
yFraction=16-(_y&0x0f);
block=Map[mapX+mapY];
colHeight=m_collisionTable[((block&COLLISION_MASK)*16)+xFraction];
if(colHeight==yFraction)
{
ret=block;
}
else
{
PAUL_DBGMSG("not on ground in getCollisionType()");
ret=0;
}
return ret;
}
/*****************************************************************************/
#ifdef __SHOW_COLLISION__
#include "gfx\prim.h"

View File

@ -24,6 +24,7 @@ virtual void shutdown();
u8 Get(int X,int Y) {return(Map[X+(Y*MapWidth)]&COLLISION_MASK);}
int getHeightFromGround(int _x,int _y,int _maxHeight=32);
int getCollisionType(int _x,int _y);
#ifdef __SHOW_COLLISION__
void render(DVECTOR &MapPos);

View File

@ -805,11 +805,17 @@ PLAYERINPUT CPlayer::getPadInputDown()
Params:
Returns:
---------------------------------------------------------------------- */
int slip=false;
int CPlayer::isOnSlippySurface()
{
return false;
// return slip&&isOnSolidGround();
int ret=false;
if(m_layerCollision->getHeightFromGround(Pos.vx,Pos.vy,5)==0&&
m_layerCollision->getCollisionType(Pos.vx,Pos.vy)&COLLISION_TYPE_FLAG_SLIPPERY)
{
ret=true;
}
return ret;
}