Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 8156 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
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
[8147]14#include "glgui_box.h"
[7034]15
16class TiXmlElement;
17class ObjectManager;
18class Player;
[7810]19class ImagePlane;
[7034]20
[8068]21enum
22{
23  GAMESTATE_PRE_GAME = 0,
24  GAMESTATE_GAME,
25  GAMESTATE_POST_GAME
26};
[7034]27
[8068]28
29class MultiplayerTeamDeathmatch : public NetworkGameRules
[7034]30{
31
32  public:
[7035]33    MultiplayerTeamDeathmatch(const TiXmlElement* root = NULL);
[7034]34    virtual ~MultiplayerTeamDeathmatch();
35
36    virtual void loadParams(const TiXmlElement* root);
37
[8068]38    virtual int getTeamForNewUser();
[8147]39    virtual ClassID getPlayableClassId( int userId, int team );
40    virtual std::string getPlayableModelFileName( int userId, int team, ClassID classId );
[7034]41
[7044]42    virtual void onPlayerSpawn();
43    virtual void onPlayerDeath();
[7034]44
45
46    virtual void tick(float dt);
47    void draw();
48
[7037]49    inline void setDeathPenaltyTimeout(float time) { this->deathTimeout = time; }
50    inline void setMaxKills(int kills) { this->maxKills = kills; }
[7221]51    void setDeathScreen(const std::string& imageName);
[8068]52   
53    inline void setNumTeams( int numTeams ){ this->numTeams = numTeams; }
54    inline int getNumTeams(){ return this->numTeams; }
55   
56    int getRandomTeam();
[7034]57
58  protected:
[7035]59    virtual void checkGameRules();
[7037]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
[7039]64    float              timeout;                    //!< time counted if player dead
[7037]65    int                maxKills;                   //!< max kills for winning condition
66
[8068]67    int                numTeams;                   //!< number of teams
[7039]68
[8068]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
[8147]76    OrxGui::GLGuiBox* box;
77
78
[8068]79    void calculateTeamScore();
80    void nextGameState();
81    void handleTeamChanges();
82    void teamChange( int userId );
[8147]83    void assignPlayable();
84   
85    void onButtonSpectator();
86    void onButtonRandom();
87    void onButtonTeam0();
88    void onButtonTeam1();
89    void onButtonExit();
[7034]90};
91
92
93#endif /* _MULTIPLAYER_TEAM_DEATHMATCH_H */
Note: See TracBrowser for help on using the repository browser.