Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

Play.h

Go to the documentation of this file.
00001 
00007 #ifndef _SCENE_PLAY_H_
00008 #define _SCENE_PLAY_H_
00009 
00010 #include "Scene.h"
00011 #include "Level.h"
00012 #include "Player.h"
00013 #include "Weapon.h"
00014 #include "GGlobals.h"   // game globals
00015 #include "Util/Granade.h"
00016 #include "Util/Projectile.h"
00017 #include "../Math/Vector.h"
00018 #include "../Util/Objects/Sphere.h"
00019 #include "../Util/Objects/Box.h"
00020 #include "../Util/Objects/Cubemap.h"
00021 #include "../Util/Objects/ObjLevel.h"
00022 #include "../Util/OpenGL/OpenGLParticleSystem.h"
00023 #include "../Sound/Sound.h"
00024 #include "../Sound/Music.h"
00025 #include "../Util/Explosion.h"
00026 #include "../Util/MilkShape.h"
00027 #include "../Util/Objects/MilkShapeObject.h"
00028 
00029 #define MAX_GRANADES            128
00030 #define MAX_EXPLOSIONS          64
00031 #define MAX_PROJECTILES         256
00032 #define MAX_PARTICLESYSTEMS     8
00033 
00034 // Textures
00035 #define PLAY_TEXTURES                   11
00036 #define PLAY_TEX_MODEL_0                0
00037 #define PLAY_TEX_GRENADE                1
00038 #define PLAY_TEX_SKIN                   2
00039 #define PLAY_TEX_PARTICLE               3
00040 #define PLAY_TEX_SHADOW                 4
00041 #define PLAY_TEX_SPAWN_SPHERE   5
00042 #define PLAY_TEX_LIFEBAR_FRAME  6
00043 #define PLAY_TEX_EXTRAS_OTHER   7
00044 #define PLAY_TEX_GAME_OVER              8
00045 #define PLAY_TEX_LIFEBAR_BG             9
00046 #define PLAY_TEX_LIFEBAR_GLOW   10
00047 
00048 // Objects
00049 #define PLAY_OBJECTS            2
00050 #define PLAY_OBJ_GRENADE        0
00051 #define PLAY_OBJ_SPHERE         1
00052 
00053 // Sounds
00054 #define PLAY_SOUNDS                     14
00055 #define PLAY_SOUND_GRENADE      0
00056 #define PLAY_SOUND_SPAWN        1
00057 #define PLAY_SOUND_GUN          2
00058 #define PLAY_SOUND_DEATH        3
00059 #define PLAY_SOUND_GUN_HIT      4
00060 #define PLAY_SOUND_DROWN        5
00061 
00062 #define PLAY_SOUND_EXTRAS_LIFE          6
00063 #define PLAY_SOUND_EXTRAS_AMMO          7
00064 #define PLAY_SOUND_EXTRAS_SLOW          8
00065 #define PLAY_SOUND_EXTRAS_SHAKE         9
00066 #define PLAY_SOUND_EXTRAS_FAST          10
00067 #define PLAY_SOUND_EXTRAS_FLIPVIEW      11
00068 #define PLAY_SOUND_EXTRAS_INVISIBLE     12
00069 #define PLAY_SOUND_EXTRAS_IMMORTAL      13
00070 
00071 // Actions
00072 #define PLAY_ACTION_PLAYER_EXPLODE      0
00073 #define PLAY_ACTION_PLAYER_DROWN        1
00074 #define PLAY_ACTION_PLAYER_SPAWN        2
00075 #define PLAY_ACTION_PLAYER_SPAWNED      3
00076 
00077 // Extras
00078 #define PLAY_EXTRAS_SIMULTANEOUS        16
00079 #define PLAY_EXTRAS                                     8                       // SAME AS PLAYER_EXTRAS IN "Player.h"
00080 #define PLAY_EXTRAS_NONE                        (-1)
00081 #define PLAY_EXTRAS_LIFE                        7
00082 #define PLAY_EXTRAS_AMMO                        6
00083 #define PLAY_EXTRAS_SLOW                        5
00084 #define PLAY_EXTRAS_SHAKE                       4
00085 #define PLAY_EXTRAS_FAST                        3
00086 #define PLAY_EXTRAS_FLIPVIEW            2
00087 #define PLAY_EXTRAS_INVISIBLE           1
00088 #define PLAY_EXTRAS_IMMORTAL            0
00089 
00090 #define PLAY_NET_START_GAME                     (-1)
00091 #define PLAY_NET_GAME_OVER                      (-2)
00092 
00093 struct PlayExtras {
00094         Vec3 pos;
00095         int type;
00096         float time;
00097 };
00098 
00099 class Play : public Scene {
00100         public:
00101                 Play();
00102                 virtual ~Play();
00103 
00104                 bool load(Application *parent);
00105                 bool unload();
00106                 bool update();
00107                 bool drawFrame();
00108 
00109                 void handleKeys();
00110 
00111         protected:
00112                 bool loadObjects();
00113                 bool loadSounds();
00114                 bool loadTextures();
00115 
00116                 int playerCollission(Vec3 pos, float size);
00117 
00118                 void bot(int playerID); // Remove this later
00119 
00120                 void serverLoop();
00121                 void networkLoop();
00122 
00123                 void applyExtras(int playerID, int type, bool add = true);
00124                 void dealExtras();
00125                 void newExtras(int type, float x, float z);
00126 
00127                 void drawGrenades();
00128                 void drawExplosions();
00129                 void drawProjectiles();
00130                 void drawPlayers();
00131                 void drawPlayer(int playerID);
00132                 void drawSpawn(int playerID);
00133                 void drawParticleSystems();
00134                 void drawShadow(Vec3 pos, float size);
00135                 void drawLifebar();
00136                 void drawExtras();
00137 
00138                 void drawAvatar(int model, bool clear = false);
00139 
00140                 void setSpawnPlayer(int playerID);
00141                 void setPlayerCam(int playerID);
00142 
00143                 void throwGrenade(int playerID, Vec3 pos, Vec3 vel, float life, float strength);
00144                 void fireProjectile(int playerID, Vec3 pos, Vec3 vel, float strength);
00145                 void createExplosion(Vec3 pos, float power, bool sphere = false);
00146                 int      startParticleSystem(Vec3 pos, int type);
00147 
00148                 void grenadeExplode(int ownerID, Vec3 pos, float strength);
00149                 void dealDamage(int onwerID, int playerID, float damage);
00150 
00151                 void setParticleSystemPos(int id, Vec3 pos);
00152 
00153         protected:
00154                 TextureID               m_textures[PLAY_TEXTURES];
00155                 Sound                   m_sounds[PLAY_SOUNDS];
00156                 OpenGLObject    *m_objects[PLAY_OBJECTS];
00157                 Music                   m_music;
00158 
00159                 OpenGLParticleSystem    m_particleSystems[MAX_PARTICLESYSTEMS];
00160                 Granade                                 m_granades[MAX_GRANADES];
00161                 Explosion                               m_explosions[MAX_EXPLOSIONS];
00162                 Projectile                              m_projectiles[MAX_PROJECTILES];
00163 
00164                 LevelInfo       m_lvl;
00165                 ObjLevel        *m_objLevel;
00166                 float           m_timeStart;
00167                 float           m_timeEnd;
00168 
00169                 PlayExtras m_extras[PLAY_EXTRAS_SIMULTANEOUS];
00170 
00171                 //MilkShape     m_model;
00172 };
00173 
00174 #endif

Generated on Sun Jun 5 15:47:05 2005 for Defacto by  doxygen 1.4.3