Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10241 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

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