Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/atmospheric_engine/src/util/multiplayer_team_deathmatch.h @ 8774

Last change on this file since 8774 was 8147, checked in by bensch, 19 years ago

orxonox/trunk: merged the network branche back here
merged with command:
svn merge -r8070:HEAD https://svn.orxonox.net/orxonox/branches/network .
no conflicts

File size: 2.5 KB
Line 
1
2/*!
3 * @file multiplayer_team_deathmatch.h
4 * Defines game rules for team deathmatch games
5 *
6 * currently there are only two teams supported
7 */
8
9#ifndef _MULTIPLAYER_TEAM_DEATHMATCH_H
10#define _MULTIPLAYER_TEAM_DEATHMATCH_H
11
12#include "network_game_rules.h"
13
14#include "glgui_box.h"
15
16class TiXmlElement;
17class ObjectManager;
18class Player;
19class ImagePlane;
20
21enum
22{
23  GAMESTATE_PRE_GAME = 0,
24  GAMESTATE_GAME,
25  GAMESTATE_POST_GAME
26};
27
28
29class MultiplayerTeamDeathmatch : public NetworkGameRules
30{
31
32  public:
33    MultiplayerTeamDeathmatch(const TiXmlElement* root = NULL);
34    virtual ~MultiplayerTeamDeathmatch();
35
36    virtual void loadParams(const TiXmlElement* root);
37
38    virtual int getTeamForNewUser();
39    virtual ClassID getPlayableClassId( int userId, int team );
40    virtual std::string getPlayableModelFileName( int userId, int team, ClassID classId );
41
42    virtual void onPlayerSpawn();
43    virtual void onPlayerDeath();
44
45
46    virtual void tick(float dt);
47    void draw();
48
49    inline void setDeathPenaltyTimeout(float time) { this->deathTimeout = time; }
50    inline void setMaxKills(int kills) { this->maxKills = kills; }
51    void setDeathScreen(const std::string& imageName);
52   
53    inline void setNumTeams( int numTeams ){ this->numTeams = numTeams; }
54    inline int getNumTeams(){ return this->numTeams; }
55   
56    int getRandomTeam();
57
58  protected:
59    virtual void checkGameRules();
60
61  private:
62    bool               bLocalPlayerDead;           //!< true if the local player is dead
63    float              deathTimeout;               //!< timeout a player cannot play if he/she dies
64    float              timeout;                    //!< time counted if player dead
65    int                maxKills;                   //!< max kills for winning condition
66
67    int                numTeams;                   //!< number of teams
68
69    std::map<int,int>  teamScore;                  //!< team score
70
71    ImagePlane*        deathScreen;                //!< the death screen
72
73    int                currentGameState;           //!< game state
74    float              gameStateTimer;             //!< if less than 0 -> change game state
75
76    OrxGui::GLGuiBox* box;
77
78
79    void calculateTeamScore();
80    void nextGameState();
81    void handleTeamChanges();
82    void teamChange( int userId );
83    void assignPlayable();
84   
85    void onButtonSpectator();
86    void onButtonRandom();
87    void onButtonTeam0();
88    void onButtonTeam1();
89    void onButtonExit();
90};
91
92
93#endif /* _MULTIPLAYER_TEAM_DEATHMATCH_H */
Note: See TracBrowser for help on using the repository browser.