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-05-12 19:24:44 +02:00
|
|
|
#if !defined(__USER_CDBUILD__)
|
2001-02-13 17:45:31 +01:00
|
|
|
#define __SHOW_COLLISION__
|
2001-05-12 19:24:44 +02:00
|
|
|
#endif
|
2001-02-13 17:45:31 +01:00
|
|
|
|
|
|
|
|
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-05-09 14:52:54 +02:00
|
|
|
u8 Get(int X,int Y) {return(Map[X+(Y*MapWidth)]&COLLISION_TILE_MASK);}
|
2001-02-15 20:49:34 +01:00
|
|
|
int getHeightFromGround(int _x,int _y,int _maxHeight=32);
|
2001-07-06 00:27:34 +02:00
|
|
|
int getHeightFromGroundNonSB(int _x,int _y,int _maxHeight=32);
|
2001-07-06 21:42:07 +02:00
|
|
|
int getHeightFromGroundCart(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-05-16 21:06:47 +02:00
|
|
|
u8 *getMapPtr(int _x,int _y) {return(&Map[(_x>>4)+((_y>>4)*MapWidth)]);}
|
|
|
|
|
2001-02-13 17:45:31 +01:00
|
|
|
#ifdef __SHOW_COLLISION__
|
|
|
|
void render(DVECTOR &MapPos);
|
|
|
|
#endif
|
|
|
|
|
2001-06-19 00:27:39 +02:00
|
|
|
int getMapWidth() {return(MapWidth);}
|
|
|
|
int getMapHeight() {return(MapHeight);}
|
2001-02-13 17:45:31 +01:00
|
|
|
|
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
|