b354792797c7779d966a30e8662690466bf19fb0.svn-base (1386B)
1 #ifndef TERRAIN_H 2 #define TERRAIN_H 3 4 #include "Utils.h" 5 #include "Console.h" 6 7 #define AIR 0x00 8 #define GROUND 0x01 9 #define PLATFORM 0x02 10 #define WATER 0x03 11 12 //BUG: Diagonal Stretch occurs when world H and world W are not multiples 13 14 class TerrainCollisionManager 15 { 16 public: 17 18 TerrainCollisionManager() : mCol_Map(NULL) {} 19 20 TerrainCollisionManager(SDL_Surface* Col_Map); 21 22 bool DetectTerrainIntersect(SDL_Rect* Bounds, int ttype1, int ttype2 = -1); 23 24 bool DetectWorldEscape(SDL_Rect* Bounds); 25 26 void DrawTerrain(); //scans the entire collison map and draws each pixel, utterly obliterates framerate 27 28 protected: 29 SDL_Surface* mCol_Map; 30 }; 31 32 class colman_Character : public TerrainCollisionManager 33 { 34 public: 35 36 colman_Character() {} 37 38 colman_Character(SDL_Surface* Col_Map, SDL_Rect* PosData, SDL_Rect* DestData, int EdgeThickness); 39 40 bool DetectEdgeCollision(SDL_Rect* Bounds); 41 42 int DetectIncline(int StepSizeLimit); 43 44 bool DetectFalling(); 45 46 bool DetectDirectionalCollision(SDL_Rect* bounds, int dir); 47 48 bool DetectSideCollision(SDL_Rect* Bounds); 49 50 bool DetectSwim(); 51 52 bool DetectSurface(); 53 54 int FindSurface(); 55 56 bool DetectWade(); 57 58 bool SetPlaformCollision(bool b) 59 { 60 //gCons->ConsPrintf("Platform Collisions %i\n", b); 61 return mPlatformCollision = b; 62 } 63 64 protected: 65 66 bool mPlatformCollision; 67 68 SDL_Rect* mPosition; 69 SDL_Rect* mDestination; 70 71 int mWallThickness; 72 73 }; 74 75 #endif