471 lines
16 KiB
C++
471 lines
16 KiB
C++
/*=========================================================================*/
|
|
/* CPAProj.hpp : main header file for the ACPPROJECT application*/
|
|
/* This is a part of the CPA project.*/
|
|
/**/
|
|
/* Version 1.0*/
|
|
/* Creation date 06/06/96*/
|
|
/* Revision date*/
|
|
/**/
|
|
/* (c) Ubi Studio 1996*/
|
|
/**/
|
|
/* DO NOT MODIFY THAT FILE. IF SOMETHING NEEDS TO BE CHANGE, PLEASE CONTACT */
|
|
/* VINCENT GRECO OR CHRISTOPHE BEAUDET.*/
|
|
/*=========================================================================*/
|
|
|
|
#ifndef __CPAPROJ_HPP__
|
|
#define __CPAPROJ_HPP__
|
|
#include <afxtempl.h>
|
|
|
|
#include "geo.h"
|
|
#include "gli.h"
|
|
#include "CPAdllls.hpp"
|
|
#include "CPADD.hpp"
|
|
#include "CPAFrame.hpp"
|
|
#include "CPAKaCnf.hpp"
|
|
#include "CPAWData.hpp"
|
|
#include "CPAInter.hpp"
|
|
|
|
/****************************************/
|
|
#ifndef CPA_EXPORT
|
|
#if defined(CPA_WANTS_IMPORT)
|
|
#define CPA_EXPORT __declspec(dllimport)
|
|
#elif defined(CPA_WANTS_EXPORT)
|
|
#define CPA_EXPORT __declspec(dllexport)
|
|
#else
|
|
#define CPA_EXPORT
|
|
#endif
|
|
#endif
|
|
/****************************************/
|
|
|
|
#ifdef ACTIVE_EDITOR
|
|
|
|
|
|
class CPA_DlgAbout;
|
|
|
|
/*==================================================================================*/
|
|
/**/
|
|
/* Some general macros*/
|
|
/**/
|
|
/*==================================================================================*/
|
|
|
|
#define M_FocusToDevice(pMDevice) \
|
|
{ \
|
|
DEV_Device *pDevice = (pMDevice)->GetFocusDevice(); \
|
|
(pMDevice)->GetDevice(pDevice->GetNumber())->GetViewPort()->SetFocus(); \
|
|
}
|
|
#define M_GetMainApp() ((CPA_ProjectApp *) AfxGetApp())
|
|
#define M_GetMainWnd() ((CPA_MainFrame *) ((M_GetMainApp())->m_pMainWnd))
|
|
#define M_GetMainWnd2() ((FRMBaseMenu*)(g_oFrameGest.ma_p_oWinArray[2][2]))
|
|
|
|
#ifdef ACTIVE_EDITOR
|
|
#define M_GetMainDevice() ((DEV_MultiDevice *) M_GetMainWnd()->m_oSplitter.GetPane(0, 0))
|
|
#define M_GetMainDevice2() ((DEV_MultiDevice *) M_GetMainWnd2()->m_oSplitter.GetPane(0, 0))
|
|
#else /* ACTIVE_EDITOR*/
|
|
#define M_GetMainDevice() ((DEV_MultiDevice *) M_GetMainWnd()->GetActiveView())
|
|
#endif /* ACTIVE_EDITOR*/
|
|
|
|
#define M_GetMainDeviceNum(Num) (M_GetMainDevice()->GetDevice(Num))
|
|
#define M_GetMainDevice2D() ((DEV_MultiDevice2D *) M_GetMainDevice())
|
|
#define M_GetMainDevice3D() ((DEV_MultiDevice3D *) M_GetMainDevice())
|
|
|
|
#define M_GetMainActiveViewport() ((DEV_ViewPort *) (M_GetMainDevice()->GetDevice(M_GetMainDevice()->GetFocusDevice()->GetNumber())->GetViewPort()))
|
|
#define M_GetActiveViewport(p_Multi) ((DEV_ViewPort *) ((p_Multi)->GetDevice((p_Multi)->GetFocusDevice()->GetNumber())->GetViewPort()))
|
|
|
|
#define M_GetMainGLDDevice(Num) (M_GetMainDeviceNum(Num)->m_hDisplayDevice)
|
|
#define M_GetMainGLDViewport(Num) (M_GetMainDeviceNum(Num)->GetViewPort()->m_hDisplayViewport)
|
|
#define M_GetGLDDevice(p_Multi, Num) ((p_Multi)->GetDevice(Num)->m_hDisplayDevice)
|
|
#define M_GetGLDViewport(p_Multi, Num) ((p_Multi)->GetDevice(Num)->GetViewPort()->m_hDisplayViewport)
|
|
|
|
#define M_vFatalError(p_szError) {M_GetMainApp()->fn_vDynaFatalError(p_szError);}
|
|
|
|
#ifdef ACTIVE_EDITOR
|
|
#define M_bEditorsActive() (M_GetMainApp()->m_bEditorsAreActive)
|
|
#define M_GetListOfAllDLL() (&(M_GetMainApp()->m_oListOfAllDLL))
|
|
|
|
#define M_bFullScreenEditor() (M_GetMainApp()->m_bEditorsAreActive && M_GetMainApp()->m_bFullScreenInEditor)
|
|
|
|
#endif /* ACTIVE_EDITOR*/
|
|
|
|
|
|
class CPA_ProjectApp;
|
|
|
|
/*###########################################################################*/
|
|
/* CPA_ProjectApp:*/
|
|
/* See ACPProject.cpp for the implementation of this class*/
|
|
/**/
|
|
|
|
class CPA_MainWorld;
|
|
|
|
class CPA_EXPORT CPA_ProjectApp : public CWinApp
|
|
{
|
|
public:
|
|
CPA_ProjectApp();
|
|
~CPA_ProjectApp();
|
|
|
|
public:
|
|
CWinThread *m_p_oEngineThread; /* Thread for engine loop*/
|
|
BOOL m_bOldScreenSaveActive; /* To first actual screen save state*/
|
|
char *m_p_szMemoProfile; /* To save profile string*/
|
|
|
|
BOOL m_bBadResolution; /* Bad resolution ?*/
|
|
|
|
unsigned char m_bProjectIsClosing; /* Is project closing ?*/
|
|
HANDLE m_hDrawSem; /* For display*/
|
|
|
|
BOOL m_bWasInFullScreenBeforeLooseFocus;
|
|
|
|
BOOL m_bLeavingApplication;
|
|
BOOL m_bFlagTaken;
|
|
#ifdef ACTIVE_EDITOR
|
|
/*------------------*/
|
|
public:
|
|
BOOL m_bFullScreenInEditor;
|
|
/* BOOL m_bViewerOpened;*/
|
|
BOOL m_bAutoReinitTheMap;
|
|
|
|
CString m_csEditorDataPath; /* Complete access to data path*/
|
|
CString m_csEngineDataPath; /* Complete access to data path*/
|
|
CPA_DLLList m_oListOfAllDLL; /* List of all DLLs*/
|
|
unsigned char m_bEngineOneStep; /* To do one step of engine*/
|
|
CPA_MainWorld *m_p_oMainWorld; /* LE monde*/
|
|
CPA_KeyActionConfiguration *mp_oAppKeyboard; /* Keyboard defs*/
|
|
CPA_KeyActionConfiguration *mp_oDevKeyboard; /* For keyboard*/
|
|
/* List of all created keyboard objets*/
|
|
CList<CPA_KeyActionConfiguration *, CPA_KeyActionConfiguration *> m_lstKeyboard;
|
|
/* WaldDataMgr*/
|
|
CPA_WalkDataMgr m_oAppliWalkDataMgr;
|
|
|
|
/* Drag&Drop*/
|
|
int m_iNumRef; /* Number of CWnd reference*/
|
|
tdstDDRef m_a_WndRef[C_ucMaxCWndRef]; /* Array of all references*/
|
|
BOOL m_bCanDrop; /* Can we drop now ?*/
|
|
BOOL m_bCopy; /* Copy object or move it ?*/
|
|
BOOL m_bControl; /* Control key is pressed*/
|
|
HWND m_LastFocusWnd; /* Last Wnd under mouse.*/
|
|
POINT m_stMousePos; /* Current position of mouse*/
|
|
HCURSOR m_hFirstCursor; /* Initial cursor*/
|
|
/* Mouse*/
|
|
BOOL m_bCursorInFirstScreen; /* flag for second screen*/
|
|
|
|
CString m_csCurrentMapName; /* name of the current map*/
|
|
|
|
/* About Dialog*/
|
|
CString m_csApplicationName;
|
|
CString m_csApplicationVersion;
|
|
CPA_DlgAbout *m_p_oDlgAbout;
|
|
|
|
|
|
protected:
|
|
CPA_SuperObject *m_pSuperObject;
|
|
public:
|
|
POS_tdstCompletePosition m_stWorldBaseMatrix;
|
|
/*------------------*/
|
|
#endif /* ACTIVE_EDITOR*/
|
|
|
|
|
|
public:
|
|
virtual void fn_vDynaFatalError(char *){};
|
|
void fn_vTestWindowsConfig(void);
|
|
void fn_vSetWindowsParameters(void);
|
|
void fn_vResetWindowsParameters(void);
|
|
|
|
|
|
void BeforeWindows();
|
|
void AfterWindows();
|
|
|
|
virtual BOOL InitApplication(void);
|
|
virtual void ExitApplication(void);
|
|
virtual BOOL InitInstance(void);
|
|
virtual void fn_vWhenAppGainFocus(void) {};
|
|
virtual void fn_vWhenAppLooseFocus(void) {};
|
|
virtual void fn_vBeforeEngineStarts(void) {};
|
|
virtual void fn_vAfterEngineStops(void) {};
|
|
virtual BOOL PreTranslateMessageEngine(MSG *p_stMsg);
|
|
BOOL PreTranslateMessageEditor(MSG *p_stMsg);
|
|
BOOL PreTranslateMessage( MSG* pMsg );
|
|
virtual void fn_vUpdateFrameTitle(void) {};
|
|
virtual void fn_vCreateEngineThread(void) {};
|
|
virtual CString fn_csGetMainCharacterFile (void) {return "";}
|
|
virtual void fn_vUpdateDynamicLights (void) {};
|
|
|
|
/* int fn_iWindowsMainLoop(void);*/
|
|
/* void fn_vSuspendEngine(void);*/
|
|
/* void fn_vResumeEngine(void);*/
|
|
int Run(void);
|
|
|
|
#ifdef ACTIVE_EDITOR
|
|
virtual BOOL fn_bTreatAppKeyboard(UINT) { return FALSE; }
|
|
void fn_vLoadAllDLLs(void);
|
|
CPA_MainWorld *fn_p_oGetMainWorld() {return m_p_oMainWorld;}
|
|
void fn_vDataHasChanged(void);
|
|
void fn_vSetWorldBaseMatrix(void);
|
|
|
|
void fn_vSetCurrentMap(CString csMapName){ m_csCurrentMapName = csMapName;};
|
|
CString fn_csGetCurrentMap() {return m_csCurrentMapName; };
|
|
virtual void fn_vReinitCurrentMap(void) {};
|
|
|
|
void OnHelpAbout();
|
|
#endif /* ACTIVE_EDITOR*/
|
|
|
|
#ifdef ACTIVE_EDITOR
|
|
CPA_Interface * GetInterface (void);
|
|
#endif /* ACTIVE_EDITOR*/
|
|
|
|
|
|
/* FBF Added for new synchro with engine thread*/
|
|
public:
|
|
BOOL m_bEngineIsStopped; /* set when the engine has been stoped by the appli*/
|
|
/* CANNOT be changed by engine */
|
|
|
|
BOOL m_bEditorsAreActive; /* set when the Editors are active*/
|
|
/* CANNOT be changed by engine */
|
|
|
|
BOOL m_bAppliAskedToStopEngine; /* Set when the appli asked to stop the engine*/
|
|
/* CANNOT be changed by engine */
|
|
BOOL m_bAppliPulsedOneStep; /* Set when appli ask to do one step*/
|
|
/* reset by engine after engine restart*/
|
|
|
|
BOOL m_bAppliAskedToActivateEditors; /* Set when the appli asked to activate editors*/
|
|
/* CANNOT be changed by engine */
|
|
BOOL m_bEngineAskedToForceEditors; /* Set when the appli asked to force activation of editors*/
|
|
/* MUST be set by engine and reset by appli*/
|
|
BOOL m_bAppliAskedToEndGame; /* Set when the appli asked to end the game*/
|
|
/* CANNOT be changed by engine */
|
|
BOOL m_bEngineIsOver; /* set when the engine is finished*/
|
|
/* CANNOT be changed by engine*/
|
|
BOOL m_bFinishEngine; /* when the engine is over, setting this to TRUE will close engine thread*/
|
|
/* CANNOT be changed by engine*/
|
|
|
|
|
|
/* User Message definition*/
|
|
#define USERM_STOP_ENGINE 100
|
|
#define USERM_FORCE_START_EDITORS 101
|
|
#define USERM_START_EDITORS 102
|
|
#define USERM_ENGINE_IS_DONE 103
|
|
#define USERM_ENGINE_IS_CLOSING 104
|
|
#define USERM_SWAP_FULLSCREEN 105
|
|
|
|
/* functions called by Appli*/
|
|
public:
|
|
void fn_vAppliAskToStartEditors(void);
|
|
void fn_vAppliAskToStopEditors(void);
|
|
void fn_vAppliAskToStartEngine(void);
|
|
void fn_vAppliAskToStopEngine(void);
|
|
void fn_vAppliAskOneStep(void);
|
|
void fn_vAppliAskToEndGame(void);
|
|
|
|
void fn_vRestartEngine();
|
|
void fn_vStopEngine();
|
|
|
|
private:
|
|
void fn_vStartEditors();
|
|
|
|
|
|
|
|
|
|
/* message map */
|
|
afx_msg void OnUserMsg(UINT wParam,LONG lParam);
|
|
|
|
|
|
|
|
|
|
|
|
/* end FBF*/
|
|
|
|
|
|
/*{{AFX_MSG(CPA_ProjectApp)*/
|
|
|
|
/*}}AFX_MSG*/
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CPA_DlgAbout;
|
|
|
|
/*==================================================================================*/
|
|
/**/
|
|
/* Some general macros*/
|
|
/**/
|
|
/*==================================================================================*/
|
|
|
|
#define M_FocusToDevice(pMDevice) \
|
|
{ \
|
|
DEV_Device *pDevice = (pMDevice)->GetFocusDevice(); \
|
|
(pMDevice)->GetDevice(pDevice->GetNumber())->GetViewPort()->SetFocus(); \
|
|
}
|
|
#define M_GetMainApp() ((CPA_ProjectApp *) AfxGetApp())
|
|
#define M_GetMainWnd() ((CPA_MainFrame *) ((M_GetMainApp())->m_pMainWnd))
|
|
|
|
#define M_GetMainDevice() ((DEV_MultiDevice *) M_GetMainWnd()->GetActiveView())
|
|
|
|
#define M_GetMainDeviceNum(Num) (M_GetMainDevice()->GetDevice(Num))
|
|
#define M_GetMainDevice2D() ((DEV_MultiDevice2D *) M_GetMainDevice())
|
|
#define M_GetMainDevice3D() ((DEV_MultiDevice3D *) M_GetMainDevice())
|
|
|
|
#define M_GetMainActiveViewport() ((DEV_ViewPort *) (M_GetMainDevice()->GetDevice(M_GetMainDevice()->GetFocusDevice()->GetNumber())->GetViewPort()))
|
|
#define M_GetActiveViewport(p_Multi) ((DEV_ViewPort *) ((p_Multi)->GetDevice(M_GetMainDevice()->GetFocusDevice()->GetNumber())->mpViewPort))
|
|
|
|
#define M_GetMainGLDDevice(Num) (M_GetMainDeviceNum(Num)->m_hDisplayDevice)
|
|
#define M_GetMainGLDViewport(Num) (M_GetMainDeviceNum(Num)->GetViewPort()->m_hDisplayViewport)
|
|
#define M_GetGLDDevice(p_Multi, Num) ((p_Multi)->GetDevice(Num)->m_hDisplayDevice)
|
|
#define M_GetGLDViewport(p_Multi, Num) ((p_Multi)->GetDevice(Num)->GetViewPort()->m_hDisplayViewport)
|
|
|
|
#define M_vFatalError(p_szError) {M_GetMainApp()->fn_vDynaFatalError(p_szError);}
|
|
|
|
|
|
|
|
class CPA_ProjectApp;
|
|
|
|
/*###########################################################################*/
|
|
/* CPA_ProjectApp:*/
|
|
/* See ACPProject.cpp for the implementation of this class*/
|
|
/**/
|
|
|
|
class CPA_MainWorld;
|
|
|
|
class CPA_EXPORT CPA_ProjectApp : public CWinApp
|
|
{
|
|
public:
|
|
CPA_ProjectApp();
|
|
~CPA_ProjectApp();
|
|
|
|
public:
|
|
CWinThread *m_p_oEngineThread; /* Thread for engine loop*/
|
|
BOOL m_bOldScreenSaveActive; /* To first actual screen save state*/
|
|
char *m_p_szMemoProfile; /* To save profile string*/
|
|
|
|
BOOL m_bBadResolution; /* Bad resolution ?*/
|
|
|
|
unsigned char m_bProjectIsClosing; /* Is project closing ?*/
|
|
HANDLE m_hDrawSem; /* For display*/
|
|
|
|
BOOL m_bWasInFullScreenBeforeLooseFocus;
|
|
|
|
BOOL m_bLeavingApplication;
|
|
BOOL m_bFlagTaken;
|
|
|
|
|
|
public:
|
|
virtual void fn_vDynaFatalError(char *){};
|
|
void fn_vTestWindowsConfig(void);
|
|
void fn_vSetWindowsParameters(void);
|
|
void fn_vResetWindowsParameters(void);
|
|
|
|
|
|
void BeforeWindows();
|
|
void AfterWindows();
|
|
|
|
virtual BOOL InitApplication(void);
|
|
virtual void ExitApplication(void);
|
|
virtual BOOL InitInstance(void);
|
|
virtual void fn_vWhenAppGainFocus(void) {};
|
|
virtual void fn_vWhenAppLooseFocus(void) {};
|
|
virtual void fn_vBeforeEngineStarts(void) {};
|
|
virtual void fn_vAfterEngineStops(void) {};
|
|
virtual BOOL PreTranslateMessageEngine(MSG *p_stMsg);
|
|
BOOL PreTranslateMessageEditor(MSG *p_stMsg);
|
|
BOOL PreTranslateMessage( MSG* pMsg );
|
|
virtual void fn_vUpdateFrameTitle(void) {};
|
|
virtual void fn_vCreateEngineThread(void) {};
|
|
virtual CString fn_csGetMainCharacterFile (void) {return "";}
|
|
virtual void fn_vUpdateDynamicLights (void) {};
|
|
|
|
/* int fn_iWindowsMainLoop(void);*/
|
|
/* void fn_vSuspendEngine(void);*/
|
|
/* void fn_vResumeEngine(void);*/
|
|
int Run(void);
|
|
|
|
|
|
|
|
|
|
/* FBF Added for new synchro with engine thread*/
|
|
public:
|
|
BOOL m_bEngineIsStopped; /* set when the engine has been stoped by the appli*/
|
|
/* CANNOT be changed by engine */
|
|
|
|
BOOL m_bEditorsAreActive; /* set when the Editors are active*/
|
|
/* CANNOT be changed by engine */
|
|
|
|
BOOL m_bAppliAskedToStopEngine; /* Set when the appli asked to stop the engine*/
|
|
/* CANNOT be changed by engine */
|
|
BOOL m_bAppliPulsedOneStep; /* Set when appli ask to do one step*/
|
|
/* reset by engine after engine restart*/
|
|
|
|
BOOL m_bAppliAskedToActivateEditors; /* Set when the appli asked to activate editors*/
|
|
/* CANNOT be changed by engine */
|
|
BOOL m_bEngineAskedToForceEditors; /* Set when the appli asked to force activation of editors*/
|
|
/* MUST be set by engine and reset by appli*/
|
|
BOOL m_bAppliAskedToEndGame; /* Set when the appli asked to end the game*/
|
|
/* CANNOT be changed by engine */
|
|
BOOL m_bEngineIsOver; /* set when the engine is finished*/
|
|
/* CANNOT be changed by engine*/
|
|
BOOL m_bFinishEngine; /* when the engine is over, setting this to TRUE will close engine thread*/
|
|
/* CANNOT be changed by engine*/
|
|
|
|
|
|
/* User Message definition*/
|
|
#define USERM_STOP_ENGINE 100
|
|
#define USERM_FORCE_START_EDITORS 101
|
|
#define USERM_START_EDITORS 102
|
|
#define USERM_ENGINE_IS_DONE 103
|
|
#define USERM_ENGINE_IS_CLOSING 104
|
|
#define USERM_SWAP_FULLSCREEN 105
|
|
|
|
/* functions called by Appli*/
|
|
public:
|
|
void fn_vAppliAskToStartEditors(void);
|
|
void fn_vAppliAskToStopEditors(void);
|
|
void fn_vAppliAskToStartEngine(void);
|
|
void fn_vAppliAskToStopEngine(void);
|
|
void fn_vAppliAskOneStep(void);
|
|
void fn_vAppliAskToEndGame(void);
|
|
|
|
void fn_vRestartEngine();
|
|
void fn_vStopEngine();
|
|
|
|
private:
|
|
void fn_vStartEditors();
|
|
|
|
|
|
/* message map */
|
|
afx_msg void OnUserMsg(UINT wParam,LONG lParam);
|
|
|
|
|
|
|
|
/* end FBF*/
|
|
|
|
|
|
/*{{AFX_MSG(CPA_ProjectApp)*/
|
|
|
|
/*}}AFX_MSG*/
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
|
|
/*///////////////////////////////////////////////////////////////////////////*/
|
|
|
|
|
|
/*///////////////////////////////////////////////////////////////////////////*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif /* __CPAPROJ_HPP__*/
|