SBSPSS/source/level/layercollision.h

48 lines
949 B
C
Raw Normal View History

2001-02-02 19:39:16 +01:00
/******************************/
2001-02-02 20:16:49 +01:00
/*** Collision Layer Class ***/
2001-02-02 19:39:16 +01:00
/******************************/
2001-02-02 20:16:49 +01:00
#ifndef __LAYER_COLLISION_H__
#define __LAYER_COLLISION_H__
2001-02-02 19:39:16 +01:00
2001-02-02 20:16:49 +01:00
#include <dstructs.h>
2001-02-02 19:39:16 +01:00
2001-02-13 17:45:31 +01:00
2001-02-13 17:46:47 +01:00
#ifdef __VERSION_DEBUG__
2001-02-13 17:45:31 +01:00
#define __SHOW_COLLISION__
#endif
2001-02-02 19:39:16 +01:00
/*****************************************************************************/
2001-02-02 20:16:49 +01:00
class CLayerCollision
2001-02-02 19:39:16 +01:00
{
public:
2001-02-02 20:16:49 +01:00
CLayerCollision(sLayerHdr *Hdr);
virtual ~CLayerCollision();
2001-02-02 19:39:16 +01:00
2001-02-02 20:16:49 +01:00
virtual void shutdown();
2001-02-02 19:39:16 +01:00
2001-03-13 17:45:31 +01:00
u8 Get(int X,int Y) {return(Map[X+(Y*MapWidth)]&COLLISION_MASK);}
2001-02-15 20:49:34 +01:00
int getHeightFromGround(int _x,int _y,int _maxHeight=32);
2001-03-13 17:45:31 +01:00
int getCollisionBlock(int _x,int _y) {return Map[(_x>>4)+((_y>>4)*MapWidth)];}
2001-02-02 20:46:54 +01:00
2001-02-13 17:45:31 +01:00
#ifdef __SHOW_COLLISION__
void render(DVECTOR &MapPos);
#endif
2001-02-02 19:39:16 +01:00
protected:
2001-02-02 20:16:49 +01:00
sLayerHdr *LayerHdr;
int MapWidth,MapHeight;
2001-02-02 19:39:16 +01:00
2001-02-02 20:46:54 +01:00
2001-02-02 20:16:49 +01:00
u8 *Map;
2001-02-15 20:49:34 +01:00
2001-03-01 17:35:05 +01:00
static u8 s_collisionTable[];
2001-02-02 19:39:16 +01:00
};
/*****************************************************************************/
#endif