Main Page | Modules | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members

gamectrl.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * $Id: gamectrl.h,v 1.1 2003/07/16 11:42:15 schou Exp $
00003  * Author: Jakob Schou Jensen <schou@sourceforge.net>
00004  * Licence: GPL
00005  *
00006  * Description: Game control
00007  *
00008  ****************************************************************************/
00009 
00015 #ifndef GAMECTRL_H
00016 #define GAMECTRL_H
00017 
00018 #include <adsomath.h>
00019 #include <adsoheightmap.h>
00020 #include <GL/gl.h>
00021 #include "vehicle.h"
00022 #include "camera.h"
00023 #include "autopilot.h"
00024 #include "netlink.h"
00025 #include "view.h"
00026 #include "epsilon.h"
00027 #include "ufo.h"
00028 
00029 #define GC_STATE_INACTIVE 0
00030 #define GC_STATE_MENU     1
00031 #define GC_STATE_GETREADY 2
00032 #define GC_STATE_INGAME   3
00033 #define GC_STATE_FINISH   4
00034 #define GC_STATE_FAILED   5
00035 #define GC_STATE_NETSTART 6
00036 #define GC_STATE_NETABORT 7
00037 #define GC_STATE_OPPFAIL  8
00038 #define GC_STATE_DISCON   9
00039 #define GC_STATE_DRAW    10
00040 #define GC_STATE_RESOLVE 11
00041 
00042 class GameCtrl : public Overlay {
00043   float time;
00044   v3f pos;
00045   AdsoHeightMap *hm;
00046   AutoPilot *autoPilot;
00047   Camera *eye;
00048   int dimActive;
00049   float dimLevel;
00050   
00051   // Game data
00052   float totalTime;
00053   float subTime;
00054   float lastSubTime;
00055   float timer_viewLastSubTime;
00056   float timer_flashArrow;
00057   float vehicleStuckTime;
00058   float epsilonCount;
00059   float epsInc;
00060   float scimatLevel;
00061   float oppEpsilonCount;
00062   float oppScimatLevel;
00063   int state;
00064   int netGame;
00065   int deathMatch;
00066   int netDeathMatchEndRemote;
00067   int netDeathMatchEndLocal;
00068 
00069   float timer_analyze_msg;
00070   float timer_rescue_msg;
00071   float timer_rescue;
00072   float timer_oppscore_msg;
00073 
00074   int resolveCollect;
00075   float collectTime;
00076   int active;
00077 
00078   int part2;
00079 
00080  public:
00081   Vehicle *vehicle,*opponent;;
00082   Epsilon *epsilon;
00083   Ufo *ufo;
00084   int isActive(){return active;}
00085   int getState(){return state;}
00086   int hasRescueCredit(){ return epsilonCount>=2.0f; }
00087   int getRescueCredit();
00088   void reduceEpsilon(int opp);
00089   void photonHit(float,Vehicle*);
00090   void rescue();
00091   void activate();
00092   void deactivate();
00093   int isVisible(){ return epsilon->isEnabled() && state==GC_STATE_INGAME; }
00094   void update(float delta_time);
00095   void setPos(s2f p);
00096   s2f getPos(){ return s2f(pos); }
00097   void setRandomPos();
00098   void setOpponent(Vehicle *o) { opponent = o; }
00099   void waitNetGame();
00100   void startGame();
00101   void startNetGame();
00102   void stopGame();
00103   int isNetGame(){ return netGame; }
00104   int isDeathMatch(){ return deathMatch; }
00105   int isInGame(){ return state==GC_STATE_GETREADY || state==GC_STATE_INGAME 
00106         || state==GC_STATE_NETSTART || state==GC_STATE_RESOLVE; }
00107   int isFinished(){ return state==GC_STATE_FINISH || state==GC_STATE_FAILED 
00108           || state==GC_STATE_NETABORT || state==GC_STATE_OPPFAIL
00109           || state==GC_STATE_DISCON || state==GC_STATE_DRAW; }
00110   void init(AdsoHeightMap *m, Vehicle *v, Camera *e);
00111   void drawArrow();
00112   void drawText();
00113   void draw(){ drawArrow(); drawText(); }
00114   GameCtrl(){ 
00115     active = 0; 
00116     state = GC_STATE_INACTIVE; 
00117     time = 0; 
00118     hm = 0; 
00119     vehicle = 0; 
00120     opponent = 0;
00121     autoPilot = 0;
00122     epsInc = 2.0f;
00123     deathMatch = 0;
00124   }
00125 };
00126 
00127 extern GameCtrl gameCtrl;
00128 
00129 #endif
00130 

Generated on Mon Jul 21 10:44:47 2003 for Rover by doxygen 1.3.2