23 #ifndef TACTICS3DAPP_H
24 #define TACTICS3DAPP_H
26 #include "../Libs/OgreCore_LIB/OgreCore.h"
27 #include "../Libs/Graphics_LIB/GUI.h"
28 #include "../Libs/Utils_LIB/USocket.h"
34 #include <OgreRenderObjectListener.h>
45 class WarriorsSetupScreen;
46 class WarriorsWrapupScreen;
79 virtual bool keyPressed(
const OIS::KeyEvent& arg);
82 virtual void pickNode(Ogre::SceneNode* node_);
105 friend DWORD WINAPI
gameLoop(LPVOID arg);
115 TiXmlDocument _tactics3DObjectsDoc;
116 volatile bool _areWarriorsSetup, _isGameStageOver;
117 std::vector<WARRIOR_SETUP_STAGE> _warriorSetupStage;
118 std::vector<WARRIOR_TYPE> _warriorType;
119 std::vector<bool> _isWarriorMusician;
124 CEGUI::WindowManager* _wMgr;
125 Ogre::SceneNode* _objNode;
127 std::set<OpenSkyNet::CD::Volume*> _pFVolumes;
128 std::set<OpenSkyNet::CD::Volume*> _cDVolumes;
129 const Ogre::Vector3* _vCorners;
131 std::vector<Warrior*> _warriors;
132 unsigned int _keysHeldDown;
133 std::map<const Warrior*,CEGUI::Window*> _warriorsToWindows;
134 Warrior* _currWarriorGettingActions;
135 std::vector<Warrior*> _currChosenDefenders;
136 volatile bool _canAcceptPCActionsInput;
137 volatile bool _canSetGotActionsEvent;
138 bool _shouldFocusOnPickedWarrior;
140 std::map<CEGUI::Window*,Ogre::Camera*> _dieRollCams;
147 #ifdef TACTICS3D_DEBUG
148 bool _doRayTraceDebugDraw;
151 Ogre::ManualObject* _debugSpreadPointObj;
157 virtual bool setup(
bool restoreOgreConfig_);
159 void setupDieRollViewports(
const Warrior* warrior_);
160 virtual void destroyScene(
bool doDestroyPersistentData_);
161 void teardownDieRollViewports(
const Warrior* warrior_);
162 void teardownEventHandlers();
163 void clearCEGUICache();
166 void updateWarriorGUI(
const Warrior* warrior_,
const std::string& warriorWindowPrefix_);
169 std::queue<std::string> _msgs;
170 void showPlayerMessage(
const char* msg_,
bool clearQueue_=
true,
bool queue_=
false,
bool showCancel_=
false);
173 void serializeWarrior(
const Warrior* warrior_, TiXmlElement* element_);
176 virtual bool configure(
bool restoreOgreConfig_);
183 virtual bool setup(
bool restoreOgreConfig_,
bool isSmokeTest_);
228 virtual bool frameEnded(
const Ogre::FrameEvent& evt);
255 static void onBeginRoundWrapper(
void* instance_, std::vector<OpenSkyNet::Utils::TaggedUnion> params_);
256 virtual void onBeginRound(std::vector<OpenSkyNet::Utils::TaggedUnion> params_);
286 virtual void onWarriorAttacked(std::vector<OpenSkyNet::Utils::TaggedUnion> params_);
288 static void onWarriorDeadWrapper(
void* instance_, std::vector<OpenSkyNet::Utils::TaggedUnion> params_);
289 virtual void onWarriorDead(std::vector<OpenSkyNet::Utils::TaggedUnion> params_);
294 static void onLockCoreWrapper(
void* instance_, std::vector<OpenSkyNet::Utils::TaggedUnion> params_);
295 virtual void onLockCore(std::vector<OpenSkyNet::Utils::TaggedUnion> params_);
297 static void onUnlockCoreWrapper(
void* instance_, std::vector<OpenSkyNet::Utils::TaggedUnion> params_);
298 virtual void onUnlockCore(std::vector<OpenSkyNet::Utils::TaggedUnion> params_);
309 virtual void notifyRenderSingleObject(Ogre::Renderable* rend,
const Ogre::Pass* pass,
const Ogre::AutoParamDataSource* source,
const Ogre::LightList* pLightList,
bool suppressRenderStateChanges);
324 assert(static_cast<OpenSkyNet::Utils::uint>(_warriors.size()) > warriorIndex_);
325 return _warriors[warriorIndex_];
329 std::map<const Warrior*, CEGUI::Window*>::const_iterator i = _warriorsToWindows.find(warrior_);
330 if (i != _warriorsToWindows.end())
359 void addWarriorAction(
Warrior* warrior_, CEGUI::Listbox* actionsListbox_,
Action* action_,
bool updateContinuous_,
bool insertInFront_=
false);
377 bool serializePCs(
const char* inputXML_,
const char* outputXML_);
389 #endif //TACTICS3DAPP_H
Definition: Tactics3DApp.h:92
virtual bool processUnbufferedMouseInput(const Ogre::FrameEvent &evt)
Definition: Tactics3DOgreEventHandlers.cpp:385
virtual void createCamera()
Definition: Tactics3DApp.h:201
bool isServer() const
Definition: Tactics3DApp.h:315
WARRIOR_SETUP_STAGE getWarriorSetupStage(int warriorIndex_) const
Definition: Tactics3DApp.h:206
TYPE
Definition: Tactics3DApp.h:58
Definition: Tactics3DApp.h:58
virtual void onPostGetWarriorActions(std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlers.cpp:209
void loadWarriorXML(OpenSkyNet::Utils::uint index_)
Definition: Tactics3DAppSetup.cpp:91
Definition: Tactics3DAction.h:40
void setTeamThatWon(Warrior::TEAM team_)
Definition: Tactics3DApp.h:364
static void onWarriorDeadWrapper(void *instance_, std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlerWrappers.cpp:55
Definition: Tactics3DApp.h:93
static void onPreWarriorPerformWrapper(void *instance_, std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlerWrappers.cpp:39
static void onBeginRoundWrapper(void *instance_, std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlerWrappers.cpp:11
Warrior * _warrior
Definition: Tactics3DApp.h:60
friend void * serverAccept(void *arg)
Definition: Tactics3DLobbyScreen.cpp:83
virtual void onPostGetAllWarriorsActions(std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlers.cpp:249
bool canAddWarriorAction(const Warrior *warrior_, const Action *action_, CEGUI::Window *&warriorWindow_, CEGUI::Listbox *&actionsListbox_)
Definition: Tactics3DApp.cpp:317
static void onUnlockCoreWrapper(void *instance_, std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlerWrappers.cpp:67
void setWarriorSetupStage(int warriorIndex_, WARRIOR_SETUP_STAGE stage_)
Definition: Tactics3DApp.h:208
bool _isMovable
Definition: Tactics3DApp.h:61
bool handleSpecialMoveCombobox(const CEGUI::EventArgs &e)
Definition: Tactics3DSpecialMoveWindowEventHandlers.cpp:102
void loadWarriorGUI(const Warrior *warrior_, const std::string &warriorWindowPrefix_)
Definition: Tactics3DAppSetup.cpp:185
virtual bool configure(bool restoreOgreConfig_)
Definition: Tactics3DAppSetup.cpp:449
Warrior * pickNextEnemyAlive()
Definition: Tactics3DApp.cpp:235
void updateSuperPowerWindow(bool reset)
Definition: Tactics3DSuperPowerWindowEventHandlers.cpp:16
void updateSpecialMoveWindow(bool reset)
Definition: Tactics3DSpecialMoveWindowEventHandlers.cpp:16
Warrior * pickClosestEnemyAlive(const Warrior *warrior_)
Definition: Tactics3DApp.cpp:207
Definition: Tactics3DApp.h:93
static void onPreGetWarriorActionsWrapper(void *instance_, std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlerWrappers.cpp:23
static void onPostGetWarriorActionsWrapper(void *instance_, std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlerWrappers.cpp:31
bool isMovable() const
Definition: Tactics3DApp.h:68
Definition: Tactics3DApp.h:92
void destroyAllObjects(bool doDestroyPersistentData_)
Definition: Tactics3DApp.cpp:501
Warrior::TEAM getTeamThatWon() const
Definition: Tactics3DApp.h:365
void setupDieRollCameras()
Definition: Tactics3DAppSetup.cpp:311
virtual void onLockCore(std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlers.cpp:637
Definition: Tactics3DWarrior.h:42
static void onPostWarriorPerformWrapper(void *instance_, std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlerWrappers.cpp:43
WARRIOR_TYPE
Definition: Tactics3DApp.h:95
OpenSkyNet::Utils::uint getGameStage()
Definition: Tactics3DApp.h:215
virtual long getTypeID() const
Definition: Tactics3DApp.h:66
Definition: Tactics3DLobbyScreen.h:40
bool isConnectedAsClient() const
Definition: USocket.h:234
void loadTactics3DObjectsXML(const char *tactics3DObjectsXML_, bool loadWarriorsImages_)
Definition: Tactics3DAppSetup.cpp:18
static void onPostWarriorPerformAllWrapper(void *instance_, std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlerWrappers.cpp:47
bool handleSuperPowerCombobox(const CEGUI::EventArgs &e)
Definition: Tactics3DSuperPowerWindowEventHandlers.cpp:41
bool isOnlineGame() const
Definition: Tactics3DApp.h:314
bool handleActionsCombobox(const CEGUI::EventArgs &e)
Definition: Tactics3DActionWindowEventHandlers.cpp:140
virtual void onCurrCamJustBecameWarriorPOV(std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlers.cpp:20
void serializeTactics3DObjects(const char *tactics3DObjectsXML_)
Definition: Tactics3DApp.cpp:590
bool serializePCs(const char *inputXML_, const char *outputXML_)
Definition: Tactics3DApp.cpp:627
virtual void setupEventHandlers()
Definition: ViewerAppSetup.cpp:80
void addWarriorActions(Warrior *warrior_, bool updateContinuous_)
Definition: Tactics3DApp.cpp:372
CEGUI::Window * getWarriorWindow(const Warrior *warrior_) const
Definition: Tactics3DApp.h:328
virtual void onGetWarriorActions(std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlers.cpp:183
Definition: UThread.h:111
Definition: Tactics3DWarriorsSetupScreen.h:33
void focusOnWarrior(const Warrior *warrior_)
Definition: Tactics3DApp.cpp:171
virtual void switchMouseMode()
Definition: Tactics3DOgreEventHandlers.cpp:591
Definition: Tactics3DApp.h:56
bool handleSuperPowerChooseButton(const CEGUI::EventArgs &e)
Definition: Tactics3DSuperPowerWindowEventHandlers.cpp:46
void pFDebugDraw(Warrior *warrior_)
Definition: Tactics3DDebugDraw.cpp:13
void rayTraceDebugDraw()
Definition: Tactics3DDebugDraw.cpp:111
virtual void createViewports()
Definition: Tactics3DApp.h:203
bool handleActionsListbox(const CEGUI::EventArgs &e)
Definition: Tactics3DActionWindowEventHandlers.cpp:194
bool handleSpecialMoveChooseOpponentButton(const CEGUI::EventArgs &e)
Definition: Tactics3DSpecialMoveWindowEventHandlers.cpp:107
virtual bool frameStarted(const Ogre::FrameEvent &evt)
Definition: ViewerEventHandlers.cpp:132
static void onWarriorAttackedWrapper(void *instance_, std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlerWrappers.cpp:51
static void onLockCoreWrapper(void *instance_, std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlerWrappers.cpp:63
Definition: Tactics3DWarriorsWrapupScreen.h:33
virtual void onRecvPCAttributes(std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlers.cpp:568
Definition: Tactics3DApp.h:95
OpenSkyNet::Utils::uint getNumWarriors() const
Definition: Tactics3DApp.h:321
void loadWarriorsGUIs()
Definition: Tactics3DAppSetup.cpp:277
virtual void onPostWarriorPerformAll(std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlers.cpp:419
virtual void onBeginRound(std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlers.cpp:33
void setupGame()
Definition: Tactics3DAppSetup.cpp:457
unsigned int uint
Definition: UTypes.h:39
bool handleActionCancelButton(const CEGUI::EventArgs &e)
Definition: Tactics3DActionWindowEventHandlers.cpp:127
Definition: Tactics3DMainScreen.h:32
bool isConnectedAsServer() const
Definition: USocket.h:233
friend void * recvPCAttributes(void *arg)
Definition: Tactics3DRemotePC.cpp:18
InputListener * _inputListener
Definition: GUI.h:109
static void onInitiativeRolledWrapper(void *instance_, std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlerWrappers.cpp:15
bool areWarriorsSetup() const
Definition: Tactics3DWarriorsSetupWindowsEventHandlers.cpp:15
virtual void notifyRenderSingleObject(Ogre::Renderable *rend, const Ogre::Pass *pass, const Ogre::AutoParamDataSource *source, const Ogre::LightList *pLightList, bool suppressRenderStateChanges)
Definition: Tactics3DApp.cpp:203
void addWarriorAction(Warrior *warrior_, CEGUI::Listbox *actionsListbox_, Action *action_, bool updateContinuous_, bool insertInFront_=false)
Definition: Tactics3DApp.cpp:353
void shouldFocusOnPickedWarrior(bool shouldFocus_)
Definition: Tactics3DApp.h:340
virtual void onAllInitiativesRolled(std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlers.cpp:93
friend void * gameLoop(void *arg)
bool handleSpecialMoveSpinner(const CEGUI::EventArgs &e)
Definition: Tactics3DSpecialMoveWindowEventHandlers.cpp:97
bool isClient() const
Definition: Tactics3DApp.h:316
virtual void onPreGetWarriorActions(std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlers.cpp:126
void loadWarriorsXMLs()
Definition: Tactics3DAppSetup.cpp:271
Definition: Tactics3DApp.h:93
bool isConnected() const
Definition: USocket.h:232
Definition: Tactics3DApp.h:95
static void onPostGetAllWarriorsActionsWrapper(void *instance_, std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlerWrappers.cpp:35
virtual bool frameEnded(const Ogre::FrameEvent &evt)
Definition: ViewerEventHandlers.cpp:215
TEAM
Definition: Tactics3DWarrior.h:72
virtual void onWarriorDead(std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlers.cpp:557
OpenSkyNet::Utils::uint incrementGameStage()
Definition: Tactics3DApp.h:216
void setMovable(bool isMovable_)
Definition: Tactics3DApp.h:69
Warrior * pickPrevEnemyAlive()
Definition: Tactics3DApp.cpp:276
Definition: Tactics3DApp.h:92
virtual void onPreWarriorPerform(std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlers.cpp:268
static void onAllInitiativesRolledWrapper(void *instance_, std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlerWrappers.cpp:19
static void onRecvPCAttributesWrapper(void *instance_, std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlerWrappers.cpp:59
static void onCurrCamJustBecameWarriorPOVWrapper(void *instance_, std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlerWrappers.cpp:7
virtual void onUnlockCore(std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlers.cpp:641
AppUserObj(TYPE type_, Warrior *warrior_=0)
Definition: Tactics3DApp.h:63
Definition: Tactics3DApp.h:93
Definition: Tactics3DApp.h:93
Definition: Tactics3DIntroScreen.h:32
virtual void onPostWarriorPerform(std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlers.cpp:369
bool handleActionDoneButton(const CEGUI::EventArgs &e)
Definition: Tactics3DActionWindowEventHandlers.cpp:15
void saveGame()
Definition: Tactics3DApp.cpp:443
Definition: Tactics3DApp.h:95
void handleWarriorsSetupDone()
Definition: Tactics3DWarriorsSetupWindowsEventHandlers.cpp:220
Warrior * getWarrior(OpenSkyNet::Utils::uint warriorIndex_) const
Definition: Tactics3DApp.h:323
virtual void moveCamera()
Definition: ViewerApp.cpp:139
static void onGetWarriorActionsWrapper(void *instance_, std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlerWrappers.cpp:27
virtual void onWarriorAttacked(std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlers.cpp:465
Definition: Tactics3DApp.h:90
TYPE _type
Definition: Tactics3DApp.h:59
Warrior * getPickedWarrior() const
Definition: Tactics3DApp.h:335
virtual void onInitiativeRolled(std::vector< OpenSkyNet::Utils::TaggedUnion > params_)
Definition: Tactics3DCombatEventHandlers.cpp:67
WARRIOR_SETUP_STAGE
Definition: Tactics3DApp.h:92
Definition: Tactics3DApp.h:58
bool handleWarriorsSetupWindows(const CEGUI::EventArgs &e)
Definition: Tactics3DWarriorsSetupWindowsEventHandlers.cpp:28
App()
Definition: Tactics3DApp.cpp:406
void * gameLoop(void *arg)
Definition: Tactics3DApp.cpp:19
virtual void go()
Definition: ViewerApp.cpp:116
virtual ~App()
Definition: ViewerApp.cpp:200