1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < |
---|
4 | * |
---|
5 | * |
---|
6 | * License notice: |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the GNU General Public License |
---|
10 | * as published by the Free Software Foundation; either version 2 |
---|
11 | * of the License, or (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | * |
---|
22 | * Author: |
---|
23 | * Johannes Ritz |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _Dynamicmatch_H__ |
---|
30 | #define _Dynamicmatch_H__ |
---|
31 | |
---|
32 | #include "OrxonoxPrereqs.h" |
---|
33 | |
---|
34 | #include <map> |
---|
35 | #include <set> |
---|
36 | #include <vector> |
---|
37 | |
---|
38 | #include "tools/Timer.h" |
---|
39 | |
---|
40 | #include "Gametype.h" |
---|
41 | |
---|
42 | namespace orxonox |
---|
43 | { |
---|
44 | class _OrxonoxExport Dynamicmatch : public Gametype |
---|
45 | { |
---|
46 | public: |
---|
47 | Dynamicmatch(Context* context); |
---|
48 | virtual ~Dynamicmatch(); |
---|
49 | |
---|
50 | bool notEnoughPigs; |
---|
51 | bool notEnoughKillers; |
---|
52 | bool notEnoughChasers; |
---|
53 | |
---|
54 | //three different parties |
---|
55 | int chaser; |
---|
56 | int piggy; |
---|
57 | int killer; |
---|
58 | |
---|
59 | virtual void evaluatePlayerParties(); |
---|
60 | int getParty(PlayerInfo* player); |
---|
61 | void setPlayerColour(PlayerInfo* player);//own function |
---|
62 | void setConfigValues();//done |
---|
63 | |
---|
64 | bool friendlyfire; //goal: player can switch it on/off |
---|
65 | bool tutorial; //goal: new players receive messages how the new gametype works - later it can be switched off. |
---|
66 | |
---|
67 | virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = nullptr) override; //ok - score function and management of parties |
---|
68 | virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr) override; //ok - simple |
---|
69 | virtual void start() override; |
---|
70 | virtual void end() override; //Wie geht das mit der Punkteausgabe aendern? Z.B: Persoenliche Nachricht? |
---|
71 | virtual void playerEntered(PlayerInfo* player) override; |
---|
72 | virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) override;//is used to initialize the player's party and colour |
---|
73 | virtual bool playerLeft(PlayerInfo* player) override; |
---|
74 | virtual bool playerChangedName(PlayerInfo* player) override;//unchanged |
---|
75 | |
---|
76 | /*virtual void instructions(); |
---|
77 | virtual void furtherInstructions();*/ |
---|
78 | virtual void rewardPig(); |
---|
79 | void grantPigBoost(SpaceShip* spaceship); // Grant the piggy a boost. |
---|
80 | void resetSpeedFactor(SpaceShip* spaceship, Timer* timer); |
---|
81 | virtual void tick (float dt) override;// used to end the game |
---|
82 | virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const override; |
---|
83 | |
---|
84 | |
---|
85 | protected: |
---|
86 | inline unsigned int getPlayerCount() const |
---|
87 | { return this->numberOf[chaser] + numberOf[piggy] + this->numberOf[killer]; } |
---|
88 | |
---|
89 | std::map< PlayerInfo*, int > playerParty_; //player's parties are recorded here |
---|
90 | std::vector<ColourValue> partyColours_; //aus TeamDeathmatch |
---|
91 | std::set<Timer*> piggyTimers_; |
---|
92 | unsigned int numberOf[3]; //array to count number of chasers, pigs, killers |
---|
93 | float pointsPerTime; |
---|
94 | float gameTime_; // from UnderAttack |
---|
95 | bool gameEnded_; // true if game is over |
---|
96 | int timesequence_; //used for countdown |
---|
97 | //Timer callInstructions_; |
---|
98 | }; |
---|
99 | } |
---|
100 | |
---|
101 | #endif /* _Dynamicmatch_H__ */ |
---|