This commit is contained in:
parent
08f5fb4abf
commit
376d81c387
3 changed files with 39 additions and 3 deletions
|
@ -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__
|
#ifdef __SHOW_COLLISION__
|
||||||
#include "gfx\prim.h"
|
#include "gfx\prim.h"
|
||||||
|
|
|
@ -24,6 +24,7 @@ virtual void shutdown();
|
||||||
|
|
||||||
u8 Get(int X,int Y) {return(Map[X+(Y*MapWidth)]&COLLISION_MASK);}
|
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);
|
||||||
|
int getCollisionType(int _x,int _y);
|
||||||
|
|
||||||
#ifdef __SHOW_COLLISION__
|
#ifdef __SHOW_COLLISION__
|
||||||
void render(DVECTOR &MapPos);
|
void render(DVECTOR &MapPos);
|
||||||
|
|
|
@ -805,11 +805,17 @@ PLAYERINPUT CPlayer::getPadInputDown()
|
||||||
Params:
|
Params:
|
||||||
Returns:
|
Returns:
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
int slip=false;
|
|
||||||
int CPlayer::isOnSlippySurface()
|
int CPlayer::isOnSlippySurface()
|
||||||
{
|
{
|
||||||
return false;
|
int ret=false;
|
||||||
// return slip&&isOnSolidGround();
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue