SBSPSS/source/level/layercollision.h
Charles 1176db9ce2
2001-07-12 15:45:39 +00:00

56 lines
1.4 KiB
C++

/******************************/
/*** Collision Layer Class ***/
/******************************/
#ifndef __LAYER_COLLISION_H__
#define __LAYER_COLLISION_H__
#include <dstructs.h>
#if !defined(__USER_CDBUILD__)
#define __SHOW_COLLISION__
#endif
/*****************************************************************************/
class CLayerCollision
{
public:
CLayerCollision(sLayerHdr *Hdr);
virtual ~CLayerCollision();
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)]);}
#ifdef __SHOW_COLLISION__
void render(DVECTOR &MapPos);
#endif
int getMapWidth() {return(MapWidth);}
int getMapHeight() {return(MapHeight);}
protected:
sLayerHdr *LayerHdr;
int MapWidth,MapHeight;
u8 *Map;
static u8 s_collisionTable[];
};
/*****************************************************************************/
#endif