1 #ifndef INC_STATE_H 2 #define INC_STATE_H 3 4 #include <SDL/SDL.h> 5 #include "coords.h" 6 #include "gfx.h" 7 #include "shot.h" 8 #include "invaders.h" 9 #include "player.h" 10 #include "node.h" 11 12 #include <vector> 13 14 #define MAX(x,y) ((x) > (y) ? (x) : (y)) 15 #define MIN(x,y) ((x) < (y) ? (x) : (y)) 16 #define BOUNDED(x,min,max) (MAX(MIN((x),(max)),(min))) 17 18 enum EndState 19 { 20 END_NOT, 21 END_DEAD, 22 END_EXTRACTED, 23 END_WIN 24 }; 25 26 class AI; 27 28 class GameState 29 { 30 friend class AI; 31 friend class BasicAI; 32 private: 33 std::vector<Shot> shots; 34 std::vector<Invader*> invaders; 35 std::vector<Node> nodes; 36 37 Node* targettedNode; 38 int invaderCooldown; 39 40 bool youHaveNode(NodeColour colour); 41 bool youHaveShotNode(int type); 42 bool evilHasNode(NodeColour colour); 43 44 int shotHeat(int type); 45 int shotDelay(int type); 46 47 float mutilationWave; 48 Angle preMutilationPhase; 49 int extractPreMutCutoff; 50 void updateMutilation(int time); 51 52 int rateOfRating(int rating); 53 void updateObjects(int time); 54 void handleGameInput(int time); 55 void handleFreeViewInput(int time); 56 void updateZoom(int time); 57 void evilAI(int time); 58 bool deadShots; 59 void cleanup(); 60 61 bool freeViewMode; 62 View freeView; 63 64 void drawGrid(SDL_Surface* surface, const View& view); 65 void drawTargettingLines(SDL_Surface* surface, const View& view); 66 void drawNodeTargetting(SDL_Surface* surface, const View& view); 67 void drawIndicators(SDL_Surface* surface, const View& view); 68 void drawObjects(SDL_Surface* surface, const View& view, 69 View* boundView=NULL); 70 71 public: 72 double extracted; 73 float extractDecayRate; 74 Player you; 75 float zoomdist; 76 int invaderRate; 77 int speed; 78 double rating; 79 int extractMax; 80 EndState end; 81 82 AI* ai; 83 84 void setRating(); 85 void update(int time, bool noInput=false); 86 void draw(SDL_Surface* surface); 87 88 const char* getHint(); 89 90 GameState(int speed); 91 }; 92 93 const char* ratingString(int rating); 94 95 #endif /* INC_STATE_H */ 96