CRobotMain rewrite

- rewritten CRobotMain
- won't compile yet because of dependencies to CMainDialog
dev-ui
Piotr Dziwinski 2012-09-15 15:33:08 +02:00
parent 8b9954fff4
commit a1400f496b
5 changed files with 2229 additions and 3110 deletions

View File

@ -178,7 +178,7 @@ protected:
Ui::CInterface* m_interface; Ui::CInterface* m_interface;
Ui::CDisplayText* m_displayText; Ui::CDisplayText* m_displayText;
CRobotMain* m_main; CRobotMain* m_main;
CStudio* m_studio; Ui::CStudio* m_studio;
CSoundInterface* m_sound; CSoundInterface* m_sound;
CTaskManager* m_primaryTask; CTaskManager* m_primaryTask;

View File

@ -37,8 +37,6 @@ CMainMovie::CMainMovie(CInstanceManager* iMan)
m_iMan = iMan; m_iMan = iMan;
m_iMan->AddInstance(CLASS_SHORT, this); m_iMan->AddInstance(CLASS_SHORT, this);
m_interface = static_cast< CInterface* >(m_iMan->SearchInstance(CLASS_INTERFACE));
m_event = static_cast< CEvent* >(m_iMan->SearchInstance(CLASS_EVENT));
m_engine = static_cast< Gfx::CEngine* >(m_iMan->SearchInstance(CLASS_ENGINE)); m_engine = static_cast< Gfx::CEngine* >(m_iMan->SearchInstance(CLASS_ENGINE));
m_main = static_cast< CRobotMain* >(m_iMan->SearchInstance(CLASS_MAIN)); m_main = static_cast< CRobotMain* >(m_iMan->SearchInstance(CLASS_MAIN));
m_camera = static_cast< Gfx::CCamera* >(m_iMan->SearchInstance(CLASS_CAMERA)); m_camera = static_cast< Gfx::CCamera* >(m_iMan->SearchInstance(CLASS_CAMERA));

View File

@ -24,8 +24,6 @@
class CInstanceManager; class CInstanceManager;
class CEvent;
class CInterface;
class CRobotMain; class CRobotMain;
class CSoundInterface; class CSoundInterface;
@ -33,8 +31,7 @@ namespace Gfx
{ {
class CCamera; class CCamera;
class CEngine; class CEngine;
} /* Gfx */ };
enum MainMovieType enum MainMovieType
{ {
@ -62,10 +59,8 @@ public:
protected: protected:
protected: protected:
CInstanceManager* m_iMan; CInstanceManager* m_iMan;
CEvent* m_event;
Gfx::CEngine* m_engine; Gfx::CEngine* m_engine;
CInterface* m_interface;
CRobotMain* m_main; CRobotMain* m_main;
Gfx::CCamera* m_camera; Gfx::CCamera* m_camera;
CSoundInterface* m_sound; CSoundInterface* m_sound;

File diff suppressed because it is too large Load Diff

View File

@ -18,15 +18,13 @@
#pragma once #pragma once
#include "common/global.h"
#include <stdio.h>
#include "common/misc.h" #include "common/misc.h"
#include "graphics/engine/engine.h" #include "graphics/engine/particle.h"
#include "object/object.h" #include "object/object.h"
#include "object/mainmovie.h" #include "object/mainmovie.h"
#include "graphics/engine/camera.h"
#include "graphics/engine/particle.h" #include <stdio.h>
enum Phase enum Phase
{ {
@ -68,36 +66,41 @@ enum Phase
class CInstanceManager; class CInstanceManager;
class CEventQueue;
class CSoundInterface;
namespace Gfx
{
class CEngine;
class CLightManager;
class CWater;
class CCloud;
class CLightning;
class CPlanet;
class CTerrain;
};
namespace Ui
{
class CMainDialog; class CMainDialog;
class CMainShort; class CMainShort;
class CMainMap; class CMainMap;
class CEvent;
class CD3DEngine;
class CLight;
class CWater;
class CCloud;
class CBlitz;
class CPlanet;
class CTerrain;
class CModel;
class CInterface; class CInterface;
class CWindow;
class CControl;
class CDisplayText; class CDisplayText;
class CDisplayInfo; class CDisplayInfo;
class CSoundInterface; };
struct EndTake struct EndTake
{ {
Math::Vector pos; Math::Vector pos;
float dist; float dist;
ObjectType type; ObjectType type;
int min; // wins if> int min; // wins if>
int max; // wins if < int max; // wins if <
int lost; // lost if <= int lost; // lost if <=
bool bImmediat; bool immediat;
char message[100]; char message[100];
}; };
@ -105,7 +108,7 @@ const int MAXNEWSCRIPTNAME = 20;
struct NewScriptName struct NewScriptName
{ {
bool bUsed; bool used;
ObjectType type; ObjectType type;
char name[40]; char name[40];
}; };
@ -117,8 +120,8 @@ const float SHOWLIMITTIME = 20.0f;
struct ShowLimit struct ShowLimit
{ {
bool bUsed; bool used;
Math::Vector pos; Math::Vector pos;
float radius; float radius;
int total; int total;
int parti[MAXSHOWPARTI]; int parti[MAXSHOWPARTI];
@ -141,7 +144,7 @@ const int SATCOM_MAX = 6;
class CRobotMain class CRobotMain
{ {
public: public:
CRobotMain(CInstanceManager* iMan); CRobotMain(CInstanceManager* iMan, CApplication* app);
~CRobotMain(); ~CRobotMain();
void CreateIni(); void CreateIni();
@ -152,23 +155,23 @@ public:
bool CreateShortcuts(); bool CreateShortcuts();
void ScenePerso(); void ScenePerso();
void SetMovieLock(bool bLock); void SetMovieLock(bool lock);
bool GetMovieLock(); bool GetMovieLock();
bool GetInfoLock(); bool GetInfoLock();
void SetSatComLock(bool bLock); void SetSatComLock(bool lock);
bool GetSatComLock(); bool GetSatComLock();
void SetEditLock(bool bLock, bool bEdit); void SetEditLock(bool lock, bool edit);
bool GetEditLock(); bool GetEditLock();
void SetEditFull(bool bFull); void SetEditFull(bool full);
bool GetEditFull(); bool GetEditFull();
bool GetFreePhoto(); bool GetFreePhoto();
void SetFriendAim(bool bFriend); void SetFriendAim(bool friendAim);
bool GetFriendAim(); bool GetFriendAim();
void SetTracePrecision(float factor); void SetTracePrecision(float factor);
float GetTracePrecision(); float GetTracePrecision();
void ChangePause(bool bPause); void ChangePause(bool pause);
void SetSpeed(float speed); void SetSpeed(float speed);
float GetSpeed(); float GetSpeed();
@ -178,26 +181,26 @@ public:
CObject* SearchHuman(); CObject* SearchHuman();
CObject* SearchToto(); CObject* SearchToto();
CObject* SearchNearest(Math::Vector pos, CObject* pExclu); CObject* SearchNearest(Math::Vector pos, CObject* pExclu);
bool SelectObject(CObject* pObj, bool bDisplayError=true); bool SelectObject(CObject* pObj, bool displayError=true);
CObject* GetSelectObject(); CObject* GetSelectObject();
CObject* DeselectAll(); CObject* DeselectAll();
bool DeleteObject(); bool DeleteObject();
void ResetObject(); void ResetObject();
void ResetCreate(); void ResetCreate();
Error CheckEndMission(bool bFrame); Error CheckEndMission(bool frame);
void CheckEndMessage(const char *message); void CheckEndMessage(char *message);
int GetObligatoryToken(); int GetObligatoryToken();
char* GetObligatoryToken(int i); char* GetObligatoryToken(int i);
int IsObligatoryToken(const char *token); int IsObligatoryToken(char *token);
bool IsProhibitedToken(const char *token); bool IsProhibitedToken(char *token);
void UpdateMap(); void UpdateMap();
bool GetShowMap(); bool GetShowMap();
MainMovieType GetMainMovie(); MainMovieType GetMainMovie();
void FlushDisplayInfo(); void FlushDisplayInfo();
void StartDisplayInfo(int index, bool bMovie); void StartDisplayInfo(int index, bool movie);
void StartDisplayInfo(char *filename, int index); void StartDisplayInfo(char *filename, int index);
void StopDisplayInfo(); void StopDisplayInfo();
char* GetDisplayInfoName(int index); char* GetDisplayInfoName(int index);
@ -216,7 +219,7 @@ public:
void SetWindowDim(Math::Point dim); void SetWindowDim(Math::Point dim);
Math::Point GetWindowDim(); Math::Point GetWindowDim();
void SetIOPublic(bool bMode); void SetIOPublic(bool mode);
bool GetIOPublic(); bool GetIOPublic();
void SetIOPos(Math::Point pos); void SetIOPos(Math::Point pos);
Math::Point GetIOPos(); Math::Point GetIOPos();
@ -259,14 +262,15 @@ public:
void HideDropZone(CObject* metal); void HideDropZone(CObject* metal);
void ShowDropZone(CObject* metal, CObject* truck); void ShowDropZone(CObject* metal, CObject* truck);
void FlushShowLimit(int i); void FlushShowLimit(int i);
void SetShowLimit(int i, Gfx::ParticleType parti, CObject *pObj, Math::Vector pos, float radius, float duration=SHOWLIMITTIME); void SetShowLimit(int i, Gfx::ParticleType parti, CObject *pObj, Math::Vector pos,
float radius, float duration=SHOWLIMITTIME);
void AdjustShowLimit(int i, Math::Vector pos); void AdjustShowLimit(int i, Math::Vector pos);
void StartShowLimit(); void StartShowLimit();
void FrameShowLimit(float rTime); void FrameShowLimit(float rTime);
void CompileScript(bool bSoluce); void CompileScript(bool soluce);
void LoadOneScript(CObject *pObj, int &nbError); void LoadOneScript(CObject *pObj, int &nerror);
void LoadFileScript(CObject *pObj, char* filename, int objRank, int &nbError); void LoadFileScript(CObject *pObj, char* filename, int objRank, int &nerror);
void SaveAllScript(); void SaveAllScript();
void SaveOneScript(CObject *pObj); void SaveOneScript(CObject *pObj);
void SaveFileScript(CObject *pObj, char* filename, int objRank); void SaveFileScript(CObject *pObj, char* filename, int objRank);
@ -294,11 +298,13 @@ protected:
void InitEye(); void InitEye();
void Convert(); void Convert();
void CreateScene(bool bSoluce, bool bFixScene, bool bResetObject); void CreateScene(bool soluce, bool fixScene, bool resetObject);
void CreateModel(); void CreateModel();
Math::Vector LookatPoint( Math::Vector eye, float angleH, float angleV, float length ); Math::Vector LookatPoint(Math::Vector eye, float angleH, float angleV, float length);
CObject* CreateObject(Math::Vector pos, float angle, float zoom, float height, ObjectType type, float power=1.0f, bool bTrainer=false, bool bToy=false, int option=0); CObject* CreateObject(Math::Vector pos, float angle, float zoom,
float height, ObjectType type, float power=1.0f,
bool trainer=false, bool toy=false, int option=0);
int CreateLight(Math::Vector direction, Gfx::Color color); int CreateLight(Math::Vector direction, Gfx::Color color);
void HiliteClear(); void HiliteClear();
void HiliteObject(Math::Point pos); void HiliteObject(Math::Point pos);
@ -308,10 +314,10 @@ protected:
CObject* DetectObject(Math::Point pos); CObject* DetectObject(Math::Point pos);
void ChangeCamera(); void ChangeCamera();
void RemoteCamera(float pan, float zoom, float rTime); void RemoteCamera(float pan, float zoom, float rTime);
void KeyCamera(EventType event, long param); void KeyCamera(EventType event, long key);
void AbortMovie(); void AbortMovie();
bool IsSelectable(CObject* pObj); bool IsSelectable(CObject* pObj);
void SelectOneObject(CObject* pObj, bool bDisplayError=true); void SelectOneObject(CObject* pObj, bool displayError=true);
void HelpObject(); void HelpObject();
bool DeselectObject(); bool DeselectObject();
void DeleteAllObjects(); void DeleteAllObjects();
@ -325,70 +331,70 @@ protected:
bool TestGadgetQuantity(int rank); bool TestGadgetQuantity(int rank);
protected: protected:
CInstanceManager* m_iMan; CInstanceManager* m_iMan;
CMainMovie* m_movie; CApplication* m_app;
CMainDialog* m_dialog; CEventQueue* m_eventQueue;
CMainShort* m_short; CMainMovie* m_movie;
CMainMap* m_map; Gfx::CEngine* m_engine;
CEvent* m_event;
CD3DEngine* m_engine;
Gfx::CParticle* m_particle; Gfx::CParticle* m_particle;
CWater* m_water; Gfx::CWater* m_water;
CCloud* m_cloud; Gfx::CCloud* m_cloud;
CBlitz* m_blitz; Gfx::CLightning* m_lightning;
CPlanet* m_planet; Gfx::CPlanet* m_planet;
CLight* m_light; Gfx::CLightManager* m_lightMan;
CTerrain* m_terrain; Gfx::CTerrain* m_terrain;
CModel* m_model; Gfx::CCamera* m_camera;
CInterface* m_interface; Ui::CMainDialog* m_dialog;
CCamera* m_camera; Ui::CMainShort* m_short;
CDisplayText* m_displayText; Ui::CMainMap* m_map;
CDisplayInfo* m_displayInfo; Ui::CInterface* m_interface;
CSound* m_sound; Ui::CDisplayText* m_displayText;
Ui::CDisplayInfo* m_displayInfo;
CSoundInterface* m_sound;
float m_time; float m_time;
float m_gameTime; float m_gameTime;
float m_checkEndTime; float m_checkEndTime;
float m_winDelay; float m_winDelay;
float m_lostDelay; float m_lostDelay;
bool m_bFixScene; // scene fixed, no interraction bool m_fixScene; // scene fixed, no interraction
bool m_bBase; // OBJECT_BASE exists in mission bool m_base; // OBJECT_BASE exists in mission
Math::Point m_lastMousePos; Math::Point m_lastMousePos;
CObject* m_selectObject; CObject* m_selectObject;
Phase m_phase; Phase m_phase;
int m_cameraRank; int m_cameraRank;
Gfx::Color m_color; Gfx::Color m_color;
bool m_bFreePhoto; bool m_freePhoto;
bool m_bCmdEdit; bool m_cmdEdit;
bool m_bShowPos; bool m_showPos;
bool m_bSelectInsect; bool m_selectInsect;
bool m_bShowSoluce; bool m_showSoluce;
bool m_bShowAll; bool m_showAll;
bool m_bCheatRadar; bool m_cheatRadar;
bool m_bAudioRepeat; bool m_audioRepeat;
bool m_bShortCut; bool m_shortCut;
int m_audioTrack; int m_audioTrack;
int m_delayWriteMessage; int m_delayWriteMessage;
int m_movieInfoIndex; int m_movieInfoIndex;
bool m_bImmediatSatCom; // SatCom immediately? bool m_immediatSatCom; // SatCom immediately?
bool m_bBeginSatCom; // messages SatCom poster? bool m_beginSatCom; // messages SatCom poster?
bool m_bMovieLock; // movie in progress? bool m_movieLock; // movie in progress?
bool m_bSatComLock; // call of SatCom is possible? bool m_satComLock; // call of SatCom is possible?
bool m_bEditLock; // edition in progress? bool m_editLock; // edition in progress?
bool m_bEditFull; // edition in full screen? bool m_editFull; // edition in full screen?
bool m_bPause; // simulation paused bool m_pause; // simulation paused
bool m_bHilite; bool m_hilite;
bool m_bTrainerPilot; // remote trainer? bool m_trainerPilot; // remote trainer?
bool m_bSuspend; bool m_suspend;
bool m_bFriendAim; bool m_friendAim;
bool m_bResetCreate; bool m_resetCreate;
bool m_bMapShow; bool m_mapShow;
bool m_bMapImage; bool m_mapImage;
char m_mapFilename[100]; char m_mapFilename[100];
Math::Point m_tooltipPos; Math::Point m_tooltipPos;
char m_tooltipName[100]; char m_tooltipName[100];
float m_tooltipTime; float m_tooltipTime;
@ -404,28 +410,28 @@ protected:
char m_scriptFile[100]; char m_scriptFile[100];
int m_endingWinRank; int m_endingWinRank;
int m_endingLostRank; int m_endingLostRank;
bool m_bWinTerminate; bool m_winTerminate;
float m_fontSize; float m_fontSize;
Math::Point m_windowPos; Math::Point m_windowPos;
Math::Point m_windowDim; Math::Point m_windowDim;
bool m_IOPublic; bool m_IOPublic;
Math::Point m_IOPos; Math::Point m_IOPos;
Math::Point m_IODim; Math::Point m_IODim;
NewScriptName m_newScriptName[MAXNEWSCRIPTNAME]; NewScriptName m_newScriptName[MAXNEWSCRIPTNAME];
float m_cameraPan; float m_cameraPan;
float m_cameraZoom; float m_cameraZoom;
EventType m_visitLast; EventType m_visitLast;
CObject* m_visitObject; CObject* m_visitObject;
CObject* m_visitArrow; CObject* m_visitArrow;
float m_visitTime; float m_visitTime;
float m_visitParticule; float m_visitParticle;
Math::Vector m_visitPos; Math::Vector m_visitPos;
Math::Vector m_visitPosArrow; Math::Vector m_visitPosArrow;
int m_endTakeTotal; int m_endTakeTotal;
EndTake m_endTake[10]; EndTake m_endTake[10];
@ -445,14 +451,14 @@ protected:
ShowLimit m_showLimit[MAXSHOWLIMIT]; ShowLimit m_showLimit[MAXSHOWLIMIT];
Gfx::Color m_colorRefBot; Gfx::Color m_colorRefBot;
Gfx::Color m_colorNewBot; Gfx::Color m_colorNewBot;
Gfx::Color m_colorRefAlien; Gfx::Color m_colorRefAlien;
Gfx::Color m_colorNewAlien; Gfx::Color m_colorNewAlien;
Gfx::Color m_colorRefGreen; Gfx::Color m_colorRefGreen;
Gfx::Color m_colorNewGreen; Gfx::Color m_colorNewGreen;
Gfx::Color m_colorRefWater; Gfx::Color m_colorRefWater;
Gfx::Color m_colorNewWater; Gfx::Color m_colorNewWater;
float m_colorShiftWater; float m_colorShiftWater;
}; };