Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/util/multiplayer_team_deathmatch.h @ 9013

Last change on this file since 9013 was 9008, checked in by bensch, 18 years ago

orxonox/trunk: merged the network bak to the trunk
merged with command:
svn merge -r8804:HEAD https://svn.orxonox.net/orxonox/branches/multi_player_map .

conflicts all resolved in favour of the branche

File size: 3.1 KB
RevLine 
[7034]1
2/*!
[7035]3 * @file multiplayer_team_deathmatch.h
[7037]4 * Defines game rules for team deathmatch games
5 *
6 * currently there are only two teams supported
[7034]7 */
8
9#ifndef _MULTIPLAYER_TEAM_DEATHMATCH_H
10#define _MULTIPLAYER_TEAM_DEATHMATCH_H
11
[8068]12#include "network_game_rules.h"
[7034]13
[8623]14#include "glgui.h"
[8708]15#include "specials/glgui_notifier.h"
[7034]16
17class TiXmlElement;
18class ObjectManager;
19class Player;
[7810]20class ImagePlane;
[7034]21
[8068]22enum
23{
24  GAMESTATE_PRE_GAME = 0,
25  GAMESTATE_GAME,
26  GAMESTATE_POST_GAME
27};
[7034]28
[8068]29
[8623]30class MultiplayerTeamDeathmatch : public NetworkGameRules, public EventListener
[7034]31{
32
33  public:
[7035]34    MultiplayerTeamDeathmatch(const TiXmlElement* root = NULL);
[7034]35    virtual ~MultiplayerTeamDeathmatch();
36
37    virtual void loadParams(const TiXmlElement* root);
38
[8068]39    virtual int getTeamForNewUser();
[8147]40    virtual ClassID getPlayableClassId( int userId, int team );
41    virtual std::string getPlayableModelFileName( int userId, int team, ClassID classId );
[7034]42
[8802]43    virtual void registerSpawn( WorldEntity * we );
[7034]44
45    virtual void tick(float dt);
46    void draw();
47
[7037]48    inline void setDeathPenaltyTimeout(float time) { this->deathTimeout = time; }
49    inline void setMaxKills(int kills) { this->maxKills = kills; }
[8068]50   
51    inline void setNumTeams( int numTeams ){ this->numTeams = numTeams; }
52    inline int getNumTeams(){ return this->numTeams; }
53   
54    int getRandomTeam();
[8623]55   
56    virtual void process(const Event &event);
57   
[9008]58    void onKill( WorldEntity * victim, WorldEntity * killer );
[8802]59    void onRespawn( int userId );
60   
[8623]61    virtual void handleChatMessage( int userId, const std::string & message, int messageType );
[9008]62   
63    void respawnPlayable( Playable * playable, int teamId, float delay );
[7034]64
65  protected:
[7035]66    virtual void checkGameRules();
[7037]67
68  private:
69    bool               bLocalPlayerDead;           //!< true if the local player is dead
70    float              deathTimeout;               //!< timeout a player cannot play if he/she dies
[7039]71    float              timeout;                    //!< time counted if player dead
[7037]72    int                maxKills;                   //!< max kills for winning condition
73
[8068]74    int                numTeams;                   //!< number of teams
[7039]75
[8068]76    std::map<int,int>  teamScore;                  //!< team score
77
78    int                currentGameState;           //!< game state
79    float              gameStateTimer;             //!< if less than 0 -> change game state
80
[8623]81    bool               bShowTeamChange;            //!< if true -> show team change dialog
82
[8147]83    OrxGui::GLGuiBox* box;
[8623]84   
[8708]85    OrxGui::GLGuiNotifier* notifier;
86    OrxGui::GLGuiInputLine* input;
87   
[8068]88    void calculateTeamScore();
89    void nextGameState();
90    void handleTeamChanges();
91    void teamChange( int userId );
[8147]92    void assignPlayable();
93   
94    void onButtonSpectator();
95    void onButtonRandom();
96    void onButtonTeam0();
97    void onButtonTeam1();
[8623]98    void onButtonCancel();
[8147]99    void onButtonExit();
[8708]100   
101    void onInputEnter( const std::string & text );
[8802]102   
103    OrxGui::GLGuiBox* statsBox;
104    OrxGui::GLGuiTable* table;
105    void tickStatsTable();
106   
107    void showStats();
108    void hideStats();
[7034]109};
110
111
112#endif /* _MULTIPLAYER_TEAM_DEATHMATCH_H */
Note: See TracBrowser for help on using the repository browser.