Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/util/multiplayer_team_deathmatch.h @ 9703

Last change on this file since 9703 was 9691, checked in by bensch, 18 years ago

new_class_id: adapted Network

File size: 3.2 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();
[9691]40    virtual const NewClassID& getPlayableClassId( int userId, int team );
41    virtual std::string getPlayableModelTextureFileName( int userId, int team, const NewClassID& classId );
42    virtual std::string getPlayableModelFileName( int userId, int team, const NewClassID& classId );
43    virtual float getPlayableScale( int userId, int team, const NewClassID& classId );
[7034]44
[8802]45    virtual void registerSpawn( WorldEntity * we );
[7034]46
47    virtual void tick(float dt);
48    void draw();
49
[7037]50    inline void setDeathPenaltyTimeout(float time) { this->deathTimeout = time; }
51    inline void setMaxKills(int kills) { this->maxKills = kills; }
[9691]52
[8068]53    inline void setNumTeams( int numTeams ){ this->numTeams = numTeams; }
54    inline int getNumTeams(){ return this->numTeams; }
[9691]55
[8068]56    int getRandomTeam();
[9691]57
[8623]58    virtual void process(const Event &event);
[9691]59
[9008]60    void onKill( WorldEntity * victim, WorldEntity * killer );
[8802]61    void onRespawn( int userId );
[9691]62
[8623]63    virtual void handleChatMessage( int userId, const std::string & message, int messageType );
[9691]64
[9008]65    void respawnPlayable( Playable * playable, int teamId, float delay );
[7034]66
67  protected:
[7035]68    virtual void checkGameRules();
[7037]69
70  private:
71    bool               bLocalPlayerDead;           //!< true if the local player is dead
72    float              deathTimeout;               //!< timeout a player cannot play if he/she dies
[7039]73    float              timeout;                    //!< time counted if player dead
[7037]74    int                maxKills;                   //!< max kills for winning condition
75
[8068]76    int                numTeams;                   //!< number of teams
[7039]77
[8068]78    std::map<int,int>  teamScore;                  //!< team score
79
80    int                currentGameState;           //!< game state
81    float              gameStateTimer;             //!< if less than 0 -> change game state
82
[8623]83    bool               bShowTeamChange;            //!< if true -> show team change dialog
84
[8147]85    OrxGui::GLGuiBox* box;
[9691]86
[8708]87    OrxGui::GLGuiInputLine* input;
[9691]88
[8068]89    void calculateTeamScore();
90    void nextGameState();
91    void handleTeamChanges();
92    void teamChange( int userId );
[8147]93    void assignPlayable();
[9691]94
[8147]95    void onButtonSpectator();
96    void onButtonRandom();
97    void onButtonTeam0();
98    void onButtonTeam1();
[8623]99    void onButtonCancel();
[8147]100    void onButtonExit();
[9691]101
[8708]102    void onInputEnter( const std::string & text );
[9691]103
[8802]104    OrxGui::GLGuiBox* statsBox;
105    OrxGui::GLGuiTable* table;
106    void tickStatsTable();
[9691]107
[8802]108    void showStats();
109    void hideStats();
[7034]110};
111
112
113#endif /* _MULTIPLAYER_TEAM_DEATHMATCH_H */
Note: See TracBrowser for help on using the repository browser.