Changeset 3020 for code/branches
- Timestamp:
- May 23, 2009, 7:04:10 PM (16 years ago)
- Location:
- code/branches/gametypes/src/orxonox
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gametypes/src/orxonox/OrxonoxPrereqs.h
r2826 r3020 139 139 class MovableEntity; 140 140 class Sublevel; 141 class ForceField; 141 142 142 143 class Model; … … 163 164 class Pawn; 164 165 class SpaceShip; 166 class TeamBaseMatchBase; 167 class Destroyer; 165 168 166 169 class Item; … … 173 176 class EventTrigger; 174 177 class PlayerTrigger; 178 class CheckPoint; 175 179 176 180 class WeaponSystem; … … 202 206 class Deathmatch; 203 207 class TeamDeathmatch; 208 class Asteroids; 209 class TeamBaseMatch; 210 class UnderAttack; 204 211 class Pong; 205 212 … … 234 241 class HUDSpeedBar; 235 242 class HUDHealthBar; 243 class HUDTimer; 236 244 class InGameConsole; 237 245 class Notification; -
code/branches/gametypes/src/orxonox/objects/gametypes/Asteroids.cc
r3019 r3020 21 21 * 22 22 * Author: 23 * Aurelian 23 * Aurelian Jaggi 24 24 * Co-authors: 25 25 * ... … … 50 50 { 51 51 SUPER(Asteroids, tick, dt); 52 52 53 53 if (firstCheckpointReached_ && !this->timerIsActive_) 54 54 { -
code/branches/gametypes/src/orxonox/objects/gametypes/Asteroids.h
r3019 r3020 21 21 * 22 22 * Author: 23 * Aurelian 23 * Aurelian Jaggi 24 24 * Co-authors: 25 25 * ... … … 46 46 virtual void start(); 47 47 virtual void end(); 48 48 49 49 inline void firstCheckpointReached(bool reached) 50 50 { this->firstCheckpointReached_ = reached; } -
code/branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.cc
r3019 r3020 20 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 21 * 22 * Author: Val Mikos 22 * Author: 23 * Val Mikos 24 * Co-authors: 25 * ... 26 * 23 27 */ 24 25 26 28 27 29 #include "TeamBaseMatch.h" 28 30 29 30 #include "objects/worldentities/pawns/TeamBaseMatchBase.h" 31 #include "objects/worldentities/pawns/TeamBaseMatchBase.h" 31 32 #include "core/CoreIncludes.h" 32 #include "core/XMLPort.h" 33 34 33 35 34 namespace orxonox 36 35 { 37 36 CreateUnloadableFactory(TeamBaseMatch); 38 37 39 40 // Timer and Creator41 38 TeamBaseMatch::TeamBaseMatch(BaseObject* creator) : TeamDeathmatch(creator) 42 39 { … … 49 46 this->pointsTeam2_ = 0; 50 47 } 51 52 53 // set the Bases positions using XML54 void TeamBaseMatch::XMLPort(Element& xmlelement, XMLPort::Mode mode)55 {56 SUPER(TeamBaseMatch, XMLPort, xmlelement, mode);57 58 // XMLPortObject(TeamBaseMatch, WorldEntity, setNeutralshape, getNeturalshape, xmlelement, mode);59 // XMLPortObject(TeamBaseMatch, WorldEntity, setTeam1shape, getTeam1shape, xmlelement, mode);60 // XMLPortObject(TeamBaseMatch, WorldEntity, setTeam2shape, getTeam2shape, xmlelement, mode);61 62 // XMLPortObject(TeamBaseMatch, TeamBaseMatchBase, addBase, getBase, xmlelement, mode);63 }64 65 /*66 // pretty useless at the moment...should be implemented in the TeamBaseMatchBase class headerfile67 // State of the Base (controlled, uncontrolled)68 int TeamBaseMatch::baseState(Base)69 {70 if(Enum state_==uncontrolled) return 0;71 if(Enum state_==controlTeam1) return 1;72 if(Enum state_==controlTeam2) return 2;73 }74 */75 76 48 77 49 // Change the control of the defeated base and respawn it with its initial health … … 117 89 { 118 90 std::map<PlayerInfo*, int>::const_iterator it1 = this->teamnumbers_.find(pawn1->getPlayer()); 119 120 121 122 switch(base->getState())91 int teamnrbase = -1; 92 int teamnrplayer = getTeam(pawn1->getPlayer()); 93 94 switch (base->getState()) 123 95 { 124 96 case BaseState::controlTeam1: … … 130 102 case BaseState::uncontrolled: 131 103 default: 132 teamnrbase = -1; 133 } 134 135 136 if(teamnrbase == teamnrplayer){ 137 return false; 138 } 104 teamnrbase = -1; 105 } 106 107 if (teamnrbase == teamnrplayer) 108 return false; 139 109 } 140 110 return true; … … 155 125 void TeamBaseMatch::showPoints() 156 126 { 157 127 158 128 COUT(0) << "Points standing:" << std::endl << "Team 1: "<< pointsTeam1_ << std::endl << "Team 2: " << pointsTeam2_ << std::endl; 159 129 if(pointsTeam1_ >=1700) COUT(0) << "Team 1 is near victory!" << std::endl; … … 205 175 { 206 176 this->pointsTeam2_ += points; 207 } 177 } 208 178 209 179 this->endGame(); … … 227 197 return 0; 228 198 } 229 199 230 200 } 231 201 232 202 -
code/branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.h
r3019 r3020 21 21 * 22 22 * Author: 23 * Fabian 'x3n' Landau23 * Val Mikos 24 24 * Co-authors: 25 * Val Mikos25 * ... 26 26 * 27 27 */ … … 32 32 #include "OrxonoxPrereqs.h" 33 33 34 #include <vector>35 34 #include <set> 36 37 35 #include "TeamDeathmatch.h" 38 36 #include "tools/Timer.h" 39 37 40 41 42 38 namespace orxonox 43 39 { 44 class TeamBaseMatchBase;45 46 47 40 class _OrxonoxExport TeamBaseMatch : public TeamDeathmatch 48 41 { 49 42 public: 50 43 TeamBaseMatch(BaseObject* creator); 51 52 // if class closes, close everything53 44 virtual ~TeamBaseMatch() {} 54 55 56 // set Base positions with XML 57 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 58 45 59 46 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); 47 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator); 60 48 61 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator); 62 63 64 65 // give information about the state of a base 66 // (this should be pretty useless atm) 67 // virtual int baseState(Base); 68 69 virtual void playerScored(PlayerInfo* player); 49 virtual void playerScored(PlayerInfo* player); 70 50 virtual void showPoints(); 71 51 virtual void endGame(); 72 52 73 53 void addBase(TeamBaseMatchBase* base); 74 54 TeamBaseMatchBase* getBase(unsigned int index) const; 75 55 76 56 void addTeamPoints(int team, int points); 77 78 79 80 57 81 58 protected: 82 59 void winPoints(); 83 60 84 85 bool pawnsAreInTheSameTeam(Pawn* pawn1, TeamBaseMatchBase* base); 61 bool pawnsAreInTheSameTeam(Pawn* pawn1, TeamBaseMatchBase* base); 86 62 using TeamDeathmatch::pawnsAreInTheSameTeam; 87 63 … … 89 65 Timer<TeamBaseMatch> scoreTimer_; 90 66 Timer<TeamBaseMatch> outputTimer_; 91 67 92 68 //points for each team 93 69 int pointsTeam1_; -
code/branches/gametypes/src/orxonox/objects/gametypes/UnderAttack.cc
r3019 r3020 21 21 * 22 22 * Author: 23 * Fabian 'x3n' Landau23 * Matthias Mock 24 24 * Co-authors: 25 25 * ... … … 32 32 #include "core/CoreIncludes.h" 33 33 #include "core/ConfigValueIncludes.h" 34 #include "objects/Teamcolourable.h"35 #include "objects/worldentities/TeamSpawnPoint.h"36 34 #include "util/Convert.h" 35 #include "network/Host.h" 37 36 38 #include "network/Host.h" 37 #include "objects/worldentities/pawns/Destroyer.h" 38 39 39 namespace orxonox 40 40 { … … 168 168 } 169 169 } 170 171 170 } -
code/branches/gametypes/src/orxonox/objects/gametypes/UnderAttack.h
r3019 r3020 21 21 * 22 22 * Author: 23 * Fabian 'x3n' Landau23 * Matthias Mock 24 24 * Co-authors: 25 25 * ... … … 32 32 #include "OrxonoxPrereqs.h" 33 33 34 #include <vector>35 #include "objects/worldentities/pawns/Destroyer.h"36 34 #include "TeamDeathmatch.h" 37 35 #include "objects/worldentities/pawns/Pawn.h" -
code/branches/gametypes/src/orxonox/objects/worldentities/ForceField.cc
r3019 r3020 53 53 { 54 54 SUPER(ForceField, XMLPort, xmlelement, mode); 55 55 56 56 //For correct xml import use: position, direction, velocity, scale 57 57 … … 60 60 XMLPortParam(ForceField, "length" , setLength , getLength , xmlelement, mode).defaultValues(2000); 61 61 } 62 62 63 63 void ForceField::tick(float dt) 64 64 { 65 65 66 66 for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it) 67 67 { 68 69 //calculate from 68 69 //calculate from 70 70 Vector3 directionVec = this->getOrientation() * WorldEntity::FRONT; 71 71 directionVec.normalise(); … … 81 81 it->applyCentralForce(((diameter_ / 2 - distFromCenterVec) / (diameter_ / 2)) * directionVec * velocity_); 82 82 } 83 83 84 84 } 85 85 } -
code/branches/gametypes/src/orxonox/objects/worldentities/pawns/Destroyer.cc
r3019 r3020 21 21 * 22 22 * Author: 23 * Fabian 'x3n' Landau23 * Matthias Mock 24 24 * Co-authors: 25 25 * ... … … 30 30 #include "Destroyer.h" 31 31 32 #include "BulletDynamics/Dynamics/btRigidBody.h"33 34 #include "util/Math.h"35 #include "util/Exception.h"36 32 #include "core/CoreIncludes.h" 37 #include "core/ConfigValueIncludes.h"38 #include "core/Template.h"39 #include "core/XMLPort.h"40 #include "objects/items/Engine.h"41 33 #include "objects/gametypes/UnderAttack.h" 42 34 … … 55 47 } 56 48 } 57 58 49 } -
code/branches/gametypes/src/orxonox/objects/worldentities/pawns/Destroyer.h
r3019 r3020 21 21 * 22 22 * Author: 23 * Fabian 'x3n' Landau23 * Matthias Mock 24 24 * Co-authors: 25 25 * ... … … 31 31 32 32 #include "OrxonoxPrereqs.h" 33 34 #include "LinearMath/btVector3.h"35 33 36 34 #include "SpaceShip.h" -
code/branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc
r3019 r3020 21 21 * 22 22 * Author: 23 * Fabian 'x3n' Landau23 * Val Mikos 24 24 * Co-authors: 25 * Val Mikos25 * ... 26 26 * 27 27 */ … … 74 74 } 75 75 76 76 77 77 std::set<WorldEntity*> attachments = this->getAttachedObjects(); 78 78 for (std::set<WorldEntity*>::iterator it = attachments.begin(); it != attachments.end(); ++it) -
code/branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h
r3019 r3020 21 21 * 22 22 * Author: 23 * Fabian 'x3n' Landau23 * Val Mikos 24 24 * Co-authors: 25 * Val Mikos25 * ... 26 26 * 27 27 */ 28 29 30 31 // setState und getState functions declare here32 // TeamBaseMatchBase class33 34 35 // save as TeamBaseMatchBase.h in objects/worldentities/pawns/TeamBaseMatchBase.h36 37 28 38 29 #ifndef _TeamBaseMatchBase_H__ … … 61 52 TeamBaseMatchBase(BaseObject* creator); 62 53 63 // if class closes, close everything 54 // if class closes, close everything 64 55 virtual ~TeamBaseMatchBase() {} 65 66 67 68 // Set the state of a base to whatever the argument of the function is 56 57 58 59 // Set the state of a base to whatever the argument of the function is 69 60 void setState(BaseState::Enum state) 70 61 { 71 62 this->state_ = state; 72 63 this->changeTeamColour(); 73 64 } 74 65 75 66 76 // Get the state of a base as a return value 77 BaseState::Enum getState() 78 79 80 67 // Get the state of a base as a return value 68 BaseState::Enum getState() const 69 { 70 return this->state_; 71 } 81 72 82 73 -
code/branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc
r3019 r3020 21 21 * 22 22 * Author: 23 * Aurelian 23 * Aurelian Jaggi 24 24 * Co-authors: 25 25 * ... … … 29 29 #include "OrxonoxStableHeaders.h" 30 30 #include "CheckPoint.h" 31 #include "objects/gametypes/Asteroids.h"32 33 #include <OgreNode.h>34 31 35 32 #include "core/CoreIncludes.h" 36 33 #include "core/XMLPort.h" 37 34 38 #include "o rxonox/objects/worldentities/ControllableEntity.h"35 #include "objects/gametypes/Asteroids.h" 39 36 #include "orxonox/objects/worldentities/pawns/Pawn.h" 40 37 … … 59 56 { 60 57 } 61 58 62 59 void CheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode) 63 60 { … … 68 65 XMLPortParam(CheckPoint, "addtime", setAddTime, getAddTime, xmlelement, mode).defaultValues(30); 69 66 } 70 67 71 68 void CheckPoint::triggered(bool bIsTriggered) 72 69 { … … 75 72 Asteroids* gametype = dynamic_cast<Asteroids*>(this->getGametype()); 76 73 if (gametype) 77 { 74 { 78 75 gametype->addTime(addTime_); 79 76 … … 83 80 gametype->firstCheckpointReached(true); 84 81 } 85 82 86 83 if (bIsTriggered && bIsDestination_) 87 84 { -
code/branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.h
r3019 r3020 21 21 * 22 22 * Author: 23 * Aurelian 23 * Aurelian Jaggi 24 24 * Co-authors: 25 25 * ... … … 30 30 @file 31 31 @brief 32 Definition of the PlayerTrigger class.33 32 */ 34 33 … … 38 37 #include "DistanceTrigger.h" 39 38 40 #include <set>41 42 #include "core/ClassTreeMask.h"43 #include "core/BaseObject.h"44 45 #include "orxonox/objects/worldentities/ControllableEntity.h"46 47 39 namespace orxonox 48 40 { 49 41 class _OrxonoxExport CheckPoint : public DistanceTrigger 50 42 { 51 43 public: 52 44 CheckPoint(BaseObject* creator); 53 45 virtual ~CheckPoint(); 54 46 55 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CheckPoint object through XML. 56 48 57 49 private: 58 virtual void triggered(bool bIsTriggered); 50 virtual void triggered(bool bIsTriggered); 59 51 virtual void notifyMaskUpdate(); 60 52 … … 63 55 64 56 inline bool getDestination() 65 { return bIsDestination_; } 66 57 { return bIsDestination_; } 58 67 59 inline void setFirst(bool isFirst) 68 60 { this->bIsFirst_ = isFirst; } … … 76 68 inline bool getAddTime() 77 69 { return this->addTime_; } 78 70 79 71 bool bIsFirst_; 80 72 bool bIsDestination_; -
code/branches/gametypes/src/orxonox/overlays/hud/HUDTimer.cc
r3019 r3020 30 30 #include "HUDTimer.h" 31 31 32 #include <OgreTextAreaOverlayElement.h>33 34 32 #include "core/CoreIncludes.h" 35 33 #include "util/Convert.h" 36 #include "objects/infos/GametypeInfo.h"37 #include "objects/infos/PlayerInfo.h"38 34 #include "objects/worldentities/ControllableEntity.h" 39 #include "objects/worldentities/pawns/Spectator.h"40 35 #include "objects/gametypes/Gametype.h" 41 36 … … 68 63 69 64 void HUDTimer::changedOwner() 70 { 65 { 71 66 SUPER(HUDTimer, changedOwner); 72 67 -
code/branches/gametypes/src/orxonox/overlays/hud/HUDTimer.h
r3019 r3020 49 49 private: 50 50 ControllableEntity* owner_; 51 51 }; 52 52 } 53 53 #endif /* _HUDTimer_H__ */
Note: See TracChangeset
for help on using the changeset viewer.