This commit is contained in:
Charles 2001-07-12 15:45:39 +00:00
parent da5516aaed
commit 1176db9ce2
3 changed files with 19 additions and 5 deletions

View File

@ -208,7 +208,7 @@ int CLayerCollision::getHeightFromCeiling(int _x,int _y,int _maxHeight)
*/
/*****************************************************************************/
int CLayerCollision::getHeightFromGroundNonSB(int _x,int _y,int _maxHeight)
int CLayerCollision::getHeightFromGroundExcluding(int _x,int _y,int _exclusion,int _maxHeight=32)
{
int mapX,mapY,xFraction,yFraction;
int distanceFromGround;
@ -222,7 +222,7 @@ int CLayerCollision::getHeightFromGroundNonSB(int _x,int _y,int _maxHeight)
distanceFromGround=0;
colHeight=s_collisionTable[((Map[mapX+mapY]&COLLISION_TILE_MASK)*16)+xFraction];
if ( (Map[mapX+mapY] & COLLISION_TYPE_MASK) == COLLISION_TYPE_FLAG_SB_NOMOVE )
if ( (Map[mapX+mapY] & COLLISION_TYPE_MASK) == _exclusion )
{
colHeight = 0;
}
@ -239,7 +239,7 @@ int CLayerCollision::getHeightFromGroundNonSB(int _x,int _y,int _maxHeight)
return -_maxHeight;
}
colHeight=s_collisionTable[((Map[mapX+mapY]&COLLISION_TILE_MASK)*16)+xFraction];
if ( (Map[mapX+mapY] & COLLISION_TYPE_MASK) == COLLISION_TYPE_FLAG_SB_NOMOVE )
if ( (Map[mapX+mapY] & COLLISION_TYPE_MASK) == _exclusion )
{
colHeight = 0;
}
@ -261,7 +261,7 @@ int CLayerCollision::getHeightFromGroundNonSB(int _x,int _y,int _maxHeight)
return _maxHeight;
}
colHeight=s_collisionTable[((Map[mapX+mapY]&COLLISION_TILE_MASK)*16)+xFraction];
if ( (Map[mapX+mapY] & COLLISION_TYPE_MASK) == COLLISION_TYPE_FLAG_SB_NOMOVE )
if ( (Map[mapX+mapY] & COLLISION_TYPE_MASK) == _exclusion )
{
colHeight = 0;
}
@ -273,6 +273,12 @@ int CLayerCollision::getHeightFromGroundNonSB(int _x,int _y,int _maxHeight)
return distanceFromGround;
}
/*****************************************************************************/
int CLayerCollision::getHeightFromGroundNonSB(int _x,int _y,int _maxHeight)
{
return( CLayerCollision::getHeightFromGroundExcluding( _x, _y, COLLISION_TYPE_FLAG_SB_NOMOVE, _maxHeight ) );
}
/*****************************************************************************/
int CLayerCollision::getHeightFromGroundCart(int _x,int _y,int _maxHeight)
{
@ -342,6 +348,12 @@ int CLayerCollision::getHeightFromGroundCart(int _x,int _y,int _maxHeight)
return distanceFromGround;
}
/*****************************************************************************/
int CLayerCollision::getHeightFromGroundAmmo(int _x,int _y,int _maxHeight)
{
return( CLayerCollision::getHeightFromGroundExcluding( _x, _y, COLLISION_TYPE_FLAG_NORMAL, _maxHeight ) );
}
/*****************************************************************************/
#ifdef __SHOW_COLLISION__
#include "gfx\prim.h"

View File

@ -24,8 +24,10 @@ virtual void shutdown();
u8 Get(int X,int Y) {return(Map[X+(Y*MapWidth)]&COLLISION_TILE_MASK);}
int getHeightFromGround(int _x,int _y,int _maxHeight=32);
int getHeightFromGroundExcluding(int _x,int _y,int _exclusion,int _maxHeight=32);
int getHeightFromGroundNonSB(int _x,int _y,int _maxHeight=32);
int getHeightFromGroundCart(int _x,int _y,int _maxHeight=32);
int getHeightFromGroundAmmo(int _x,int _y,int _maxHeight=32);
int getCollisionBlock(int _x,int _y) {return Map[(_x>>4)+((_y>>4)*MapWidth)];}
u8 *getMapPtr(int _x,int _y) {return(&Map[(_x>>4)+((_y>>4)*MapWidth)]);}

View File

@ -640,7 +640,7 @@ void CPlayerProjectile::think(int _frames)
s16 moveY = ( m_vertVelocity >> 8 ) * _frames;
s32 groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy, moveY );
s32 groundHeight = CGameScene::getCollision()->getHeightFromGroundAmmo( Pos.vx, Pos.vy, moveY );
if ( groundHeight < moveY )
{