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