Tactics: Western Philosophers Vs. Musicians  0.12
A turn-based tactical game combining rules and gameplay elements inspired by Final Fantasy Tactics and the Mayfair Exponential Game System. Unlike most games of this type, motion is in full, grid-less 3D.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Tactics3DPC.h
Go to the documentation of this file.
1 // Copyright (C) 2006-2015 Dylan Blair
3 //
4 // email: dblair@alumni.cs.utexas.edu
5 //
6 // This file is part of Tactics3D.
7 //
8 // Tactics3D is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // Tactics3D 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 St, Fifth Floor, Boston, MA 02110-1301 USA
22 
23 #ifndef TACTICS3DPC_H
24 #define TACTICS3DPC_H
25 
26 #include "../Libs/Core_LIB/CCamera.h"
27 #include "../Libs/Core_LIB/ITransformChangeListener.h"
28 #include "../Libs/Utils_LIB/USocket.h"
29 
30 #include "Tactics3DWarrior.h"
31 
32 namespace Tactics3D {
35  static OpenSkyNet::Utils::SyncEvent _gotActionsEvent;
36  static OpenSkyNet::Utils::SyncEvent _infoAcknowledgedEvent;
37  static OpenSkyNet::Utils::SyncEvent _currCamJustBecameWarriorPOVEvent;
38  protected:
40  std::string _spreadWindowName;
44  public:
46  int gp_, int lvl_, int dex_, int str_, int end_, TEAM team_,
47  OpenSkyNet::Core::Cinematographer* cine_, const std::string& spreadWindowName_,
48  OpenSkyNet::Utils::Socket* socket_);
49 
50  virtual ~PC() {}
51 
54  virtual void setPos(const OpenSkyNet::Math::Point<>& pos_);
56 
61 
64  virtual void handleNewAttackRangeCollisions(AttackRange* collidee_, std::vector<OpenSkyNet::Core::Object*>& colliders_);
65  virtual void handleDeletedAttackRangeCollisions(AttackRange* collidee_, std::vector<OpenSkyNet::Core::Object*>& colliders_);
67 
70  virtual void handleTransformChange(OpenSkyNet::Core::Object* obj_, const OpenSkyNet::Math::Point<>& prevPos_, const OpenSkyNet::Math::Matrix3x3& prevRot_, float dt_);
71  virtual void handleIdle(OpenSkyNet::Core::Object* obj_, float idleSecs_);
73 
77  static volatile bool _waitingForInfoAcknowledgment;
78 
80  static inline void setGotActionsEvent(bool ignoreIfQuitting_) {
81  setEvent(_gotActionsEvent,ignoreIfQuitting_);
82  }
83  static inline void waitForGotActionsEvent(bool ignoreIfQuitting_) {
84  waitForEvent(_gotActionsEvent,ignoreIfQuitting_);
85  }
86 
88  static inline void setInfoAcknowledgedEvent(bool ignoreIfQuitting_) {
89  if (!_isSmokeTest)
90  setEvent(_infoAcknowledgedEvent,ignoreIfQuitting_);
91  }
92  static inline void waitForInfoAcknowledgedEvent(bool ignoreIfQuitting_) {
93  if (!_isSmokeTest)
94  waitForEvent(_infoAcknowledgedEvent,ignoreIfQuitting_);
95  }
96 
97  static volatile bool _isCurrCamWarriorPOV;
98 
100  static inline void setCurrCamJustBecameWarriorPOVEvent() {
101  _isCurrCamWarriorPOV = true;
102  setEvent(_currCamJustBecameWarriorPOVEvent, true);
103  }
105  waitForEvent(_currCamJustBecameWarriorPOVEvent, true);
106  }
107 
108  inline bool isWaitingForPerformEvent() const { return _waitingForPerformEvent; }
110 
113  virtual void onPrePerformAnyAction(const std::vector<Warrior*>& warriors_);
114  virtual void onMove();
115  virtual void onHipFire(OpenSkyNet::Core::Object* intendedTarget_, Action* action_);
116  virtual void onIronSightsFire(OpenSkyNet::Core::Object* intendedTarget_, Action* action_);
117  virtual void onEvocation();
118  virtual void onAttacked(const std::vector<OpenSkyNet::Utils::TaggedUnion>& eventParams_);
120 
121  virtual void setActions();
122 
125  void sendAttributes();
126  void sendActions();
127  void sendMoveUpdate(int flags_);
128  void sendAttack(const std::vector<OpenSkyNet::Utils::TaggedUnion>& eventParams_);
130  };
131 }
132 
133 #endif //TACTICS3DPC_H
bool isWaitingForPerformEvent() const
Definition: Tactics3DPC.h:108
virtual void handleTransformChange(OpenSkyNet::Core::Object *obj_, const OpenSkyNet::Math::Point<> &prevPos_, const OpenSkyNet::Math::Matrix3x3 &prevRot_, float dt_)
Definition: Tactics3DPC.cpp:120
Definition: CPhysVisObject.h:30
Definition: Tactics3DAction.h:40
static void setInfoAcknowledgedEvent(bool ignoreIfQuitting_)
Definition: Tactics3DPC.h:88
OpenSkyNet::Core::Cinematographer * _cine
Definition: Tactics3DPC.h:39
virtual void setActions()
Definition: Tactics3DPC.cpp:274
static volatile bool _isCurrCamWarriorPOV
Definition: Tactics3DPC.h:97
virtual void onMove()
Definition: Tactics3DPC.cpp:159
void sendAttack(const std::vector< OpenSkyNet::Utils::TaggedUnion > &eventParams_)
Definition: Tactics3DPC.cpp:317
Definition: CCamera.h:41
static volatile bool _waitingForInfoAcknowledgment
Definition: Tactics3DPC.h:77
Definition: Tactics3DWarrior.h:42
PC(OpenSkyNet::Utils::uint networkId_, OpenSkyNet::Core::PhysVisObject *pVO_, int gp_, int lvl_, int dex_, int str_, int end_, TEAM team_, OpenSkyNet::Core::Cinematographer *cine_, const std::string &spreadWindowName_, OpenSkyNet::Utils::Socket *socket_)
Definition: Tactics3DPC.cpp:22
virtual void onIronSightsFire(OpenSkyNet::Core::Object *intendedTarget_, Action *action_)
Definition: Tactics3DPC.cpp:206
void sendActions()
Definition: Tactics3DPC.cpp:297
virtual void onHipFire(OpenSkyNet::Core::Object *intendedTarget_, Action *action_)
Definition: Tactics3DPC.cpp:180
Definition: ITransformChangeListener.h:29
virtual void onEvocation()
Definition: Tactics3DPC.cpp:246
Definition: USocket.h:46
Definition: Tactics3DPC.h:34
static void waitForGotActionsEvent(bool ignoreIfQuitting_)
Definition: Tactics3DPC.h:83
virtual void onAttacked(const std::vector< OpenSkyNet::Utils::TaggedUnion > &eventParams_)
Definition: Tactics3DPC.cpp:269
virtual void handleDeletedAttackRangeCollisions(AttackRange *collidee_, std::vector< OpenSkyNet::Core::Object * > &colliders_)
Definition: Tactics3DPC.cpp:106
static void waitForInfoAcknowledgedEvent(bool ignoreIfQuitting_)
Definition: Tactics3DPC.h:92
Definition: Tactics3DAttackRange.h:33
virtual void handleNewAttackRangeCollisions(AttackRange *collidee_, std::vector< OpenSkyNet::Core::Object * > &colliders_)
Definition: Tactics3DPC.cpp:95
std::string _spreadWindowName
Definition: Tactics3DPC.h:40
unsigned int uint
Definition: UTypes.h:39
static void setEvent(OpenSkyNet::Utils::SyncEvent &event_, bool ignoreIfQuitting_)
Definition: Tactics3DWarrior.h:342
Definition: UThread.h:68
void sendAttributes()
Definition: Tactics3DPC.cpp:287
static void waitForEvent(OpenSkyNet::Utils::SyncEvent &event_, bool ignoreIfQuitting_)
Definition: Tactics3DWarrior.h:346
virtual void setPos(const OpenSkyNet::Math::Point<> &pos_)
Definition: Tactics3DPC.cpp:37
Definition: MPoint.h:33
void sendMoveUpdate(int flags_)
Definition: Tactics3DPC.cpp:307
float _secsSinceLastTransformNetworkUpdate
Definition: Tactics3DPC.h:43
virtual ~PC()
Definition: Tactics3DPC.h:50
Definition: IObject.h:36
TEAM
Definition: Tactics3DWarrior.h:72
OpenSkyNet::Utils::Socket * _socket
Definition: Tactics3DPC.h:41
static void setGotActionsEvent(bool ignoreIfQuitting_)
Definition: Tactics3DPC.h:80
bool _waitingForPerformEvent
Definition: Tactics3DPC.h:42
static void waitForCurrCamJustBecameWarriorPOVEvent()
Definition: Tactics3DPC.h:104
Definition: MMatrix3x3.h:32
static void setCurrCamJustBecameWarriorPOVEvent()
Definition: Tactics3DPC.h:100
static bool _isSmokeTest
Definition: Tactics3DWarrior.h:340
virtual void handleNonCollidingTransformApplied(OpenSkyNet::Core::Object *obj_)
Definition: Tactics3DPC.cpp:81
virtual void onPrePerformAnyAction(const std::vector< Warrior * > &warriors_)
Definition: Tactics3DPC.cpp:142
float pos_[3]
Definition: ViewerApp.h:31
virtual void handleIdle(OpenSkyNet::Core::Object *obj_, float idleSecs_)
Definition: Tactics3DPC.cpp:134