Add rayman2 source files
This commit is contained in:
138
Rayman_X/cpa/main/Src/P5/DlgOpt.cpp
Normal file
138
Rayman_X/cpa/main/Src/P5/DlgOpt.cpp
Normal file
@@ -0,0 +1,138 @@
|
||||
// DlgOpt.cpp: implementation of the CDlgUpdateOptions class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "MainCPA.h"
|
||||
#include "StdAfx.h"
|
||||
#include "DlgOpt.h"
|
||||
|
||||
extern "C" tdstPreferences g_stPreferences;
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CDlgUpdateOptions::CDlgUpdateOptions(CWnd* pParent /*=NULL*/) : CDialog(CDlgUpdateOptions::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CDlgUpdateOptions)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : Message Map
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BEGIN_MESSAGE_MAP(CDlgUpdateOptions, CDialog)
|
||||
//{{AFX_MSG_MAP(CDlgUpdateOptions)
|
||||
ON_BN_CLICKED(IDC_CHECK_BINARYDATA, OnCheckUseBinaryData)
|
||||
//ON_BN_CLICKED(IDC_CHECK_ASK, OnCheckAskAtEachTime)
|
||||
//ON_BN_CLICKED(IDC_CHECK_SAVE, OnCheckSavePrgPreferences)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CUpdateOptionsDlg message handlers
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_INITDIALOG
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CDlgUpdateOptions::OnInitDialog()
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
CButton *p_oBtBinary, *p_oBtAsk, *p_oBtSave, *p_oBtBinaryDsc;
|
||||
CEdit *p_EditDirectory;
|
||||
BOOL bBinary, bAsk, bSave, bBinaryDsc;
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
p_oBtBinary = (CButton *) GetDlgItem( IDC_CHECK_BINARYDATA );
|
||||
p_oBtAsk = (CButton *) GetDlgItem( IDC_CHECK_ASK );
|
||||
p_oBtSave = (CButton *) GetDlgItem( IDC_CHECK_SAVE );
|
||||
p_oBtBinaryDsc = (CButton *) GetDlgItem( IDC_CHECK_BINARYDSC );
|
||||
|
||||
bBinary = (BOOL)g_stPreferences.cBinary;
|
||||
bAsk = (BOOL)g_stPreferences.cAsk;
|
||||
bSave = (BOOL)g_stPreferences.cSave;
|
||||
bBinaryDsc = (BOOL)g_stPreferences.cBinaryDsc;
|
||||
|
||||
p_oBtBinary->SetCheck( bBinary ? 1 : 0 );
|
||||
p_oBtAsk->SetCheck( bAsk ? 1 : 0 );
|
||||
p_oBtSave->SetCheck( bSave ? 1 : 0 );
|
||||
p_oBtBinaryDsc->SetCheck( bBinaryDsc ? 1 : 0 );
|
||||
|
||||
p_EditDirectory = (CEdit *) GetDlgItem( IDC_EDIT_DIRECTORY);
|
||||
if (bBinary)
|
||||
p_EditDirectory -> SetWindowText(g_stPreferences.szBinaryDirectory);
|
||||
else
|
||||
p_EditDirectory -> SetWindowText("GameData");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDOK button
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CDlgUpdateOptions::OnOK()
|
||||
{
|
||||
g_stPreferences.cBinary =(char)((CButton *) GetDlgItem( IDC_CHECK_BINARYDATA))->GetCheck() == 1;
|
||||
g_stPreferences.cAsk = (char)((CButton *) GetDlgItem( IDC_CHECK_ASK ))->GetCheck() == 1;
|
||||
g_stPreferences.cSave = (char)((CButton *) GetDlgItem( IDC_CHECK_SAVE ))->GetCheck() == 1;
|
||||
g_stPreferences.cBinaryDsc =(char)((CButton *) GetDlgItem( IDC_CHECK_BINARYDSC))->GetCheck() == 1;
|
||||
|
||||
if (g_stPreferences.cSave)
|
||||
GAM_fn_vSavePreferences();
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDC_CHECK_BINARYDATA
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void CDlgUpdateOptions::OnCheckUseBinaryData(void)
|
||||
{
|
||||
CEdit *p_EditDirectory;
|
||||
p_EditDirectory = (CEdit *) GetDlgItem( IDC_EDIT_DIRECTORY);
|
||||
if (((CButton *) GetDlgItem( IDC_CHECK_BINARYDATA))->GetCheck() == 1)
|
||||
p_EditDirectory -> SetWindowText(g_stPreferences.szBinaryDirectory);
|
||||
else
|
||||
p_EditDirectory -> SetWindowText("GameData");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDC_CHECK_ASK
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
void CDlgUpdateOptions::OnCheckAskAtEachTime(void)
|
||||
{
|
||||
g_stPreferences.cAsk = (char)((CButton *) GetDlgItem( IDC_CHECK_ASK ))->GetCheck() == 1;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDC_CHECK_SAVE
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
void CDlgUpdateOptions::OnCheckSavePrgPreferences(void)
|
||||
{
|
||||
g_stPreferences.cSave = (char)((CButton *) GetDlgItem( IDC_CHECK_SAVE ))->GetCheck() == 1;
|
||||
}
|
||||
*/
|
431
Rayman_X/cpa/main/Src/P5/GameITF.cpp
Normal file
431
Rayman_X/cpa/main/Src/P5/GameITF.cpp
Normal file
@@ -0,0 +1,431 @@
|
||||
|
||||
#include "MainCPA.h"
|
||||
#include "ITF.h"
|
||||
#include "SND.h"
|
||||
#ifdef USE_PROFILER
|
||||
#include "prf.h"
|
||||
#endif
|
||||
#include "GameITF.h"
|
||||
|
||||
#include "DlgOpt.h"
|
||||
#include "acp_driver.h"
|
||||
|
||||
// ANNECY AV {
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void MOR_fn_vRemoveAllMorphedObjects (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
// ENDANNECY AV }
|
||||
|
||||
//************************************************************************************
|
||||
|
||||
void fn_vChangeWindowTitle(char *szWindowName)
|
||||
{
|
||||
M_GetMainWnd()->SetWindowText(szWindowName);
|
||||
#ifdef ACTIVE_EDITOR
|
||||
CString act;
|
||||
char actc[255], *p;
|
||||
g_oBaseFrame.GetWindowText(act);
|
||||
strcpy(actc, (char *) (LPCSTR) act);
|
||||
p = strchr(actc, ']') + 1;
|
||||
*p = '\0';
|
||||
act = actc;
|
||||
act += " ("+CString(szWindowName)+")";
|
||||
g_oBaseFrame.SetWindowText(act);
|
||||
#endif
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
|
||||
void fn_vForceToCloseApplication()
|
||||
{
|
||||
M_GetMainWnd()->PostMessage(WM_CLOSE);
|
||||
Sleep(0);
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
|
||||
void fn_vSetEngineWorldForITF(HIE_tdxHandleToSuperObject _hActualWorld)
|
||||
{
|
||||
M_GetMainDevice3D()->SetEngineWorld(_hActualWorld);
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
|
||||
GLD_tdhDevice fn_hGetGLDDevice(unsigned long _ulValue)
|
||||
{
|
||||
return(M_GetMainGLDDevice(_ulValue));
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
|
||||
GLD_tdhViewport fn_hGetGLDViewport(unsigned long _ulValue)
|
||||
{
|
||||
return(M_GetMainGLDViewport(_ulValue));
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
|
||||
void * fn_hGetDrawSemaphore(void)
|
||||
{
|
||||
return(M_GetMainApp()->m_hDrawSem);
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
|
||||
void GAMITF_fn_vResizeGameViewport(void)
|
||||
{
|
||||
GAM_fn_vActualizeAllGameViewportSize();
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
|
||||
#if defined(ACTIVE_EDITOR)
|
||||
void fn_vEditorDrawObjectExpect0(void)
|
||||
{
|
||||
M_GetMainDevice()->SendMessage(CPA_MSG_DRAWOBJECTEXCEPT0);
|
||||
}
|
||||
#endif /* ACTIVE_EDITOR */
|
||||
|
||||
//************************************************************************************
|
||||
|
||||
#if defined(ACTIVE_EDITOR)
|
||||
void fn_vEditorDataHasChange(void)
|
||||
{
|
||||
M_GetMainApp()->fn_vDataHasChanged();
|
||||
}
|
||||
#endif /* ACTIVE_EDITOR */
|
||||
|
||||
//************************************************************************************
|
||||
|
||||
#if defined(ACTIVE_EDITOR)
|
||||
void fn_vEnableEditorsMainWnd(unsigned char _ulValue)
|
||||
{
|
||||
M_GetMainWnd()->fn_vEnableEditors(_ulValue);
|
||||
}
|
||||
#endif /* ACTIVE_EDITOR */
|
||||
|
||||
//************************************************************************************
|
||||
|
||||
#if defined(ACTIVE_EDITOR)
|
||||
void fn_vEditorSetCurrentMap(char *_szCurrentMap)
|
||||
{
|
||||
M_GetMainApp()->fn_vSetCurrentMap(_szCurrentMap);
|
||||
}
|
||||
#endif /* ACTIVE_EDITOR */
|
||||
|
||||
//************************************************************************************
|
||||
HWND fn_hGetBaseFrameWnd(void)
|
||||
{
|
||||
#if defined(ACTIVE_EDITOR)
|
||||
return g_oBaseFrame . m_hWnd;
|
||||
#else
|
||||
return fn_hGetApplicationWindow();
|
||||
#endif /* ACTIVE_EDITOR */
|
||||
}
|
||||
//************************************************************************************
|
||||
void fn_vInitSoundStruct(void *SndInit)
|
||||
{
|
||||
((SND_tdstInitStruct*)SndInit)->hProcessInstance=AfxGetInstanceHandle();
|
||||
#if defined(ACTIVE_EDITOR)
|
||||
((SND_tdstInitStruct*)SndInit)->hMainWindow=g_oBaseFrame.GetSafeHwnd();
|
||||
#else
|
||||
((SND_tdstInitStruct*)SndInit)->hMainWindow=fn_hGetApplicationWindow();
|
||||
#endif /* ACTIVE_EDITOR */
|
||||
((SND_tdstInitStruct*)SndInit)->hMutexDX=NULL;
|
||||
}
|
||||
//************************************************************************************
|
||||
void fn_vSwapDeviceToFullScreen(void)
|
||||
{
|
||||
M_GetMainApp()->PostThreadMessage(WM_USER,USERM_SWAP_FULLSCREEN,0);
|
||||
}
|
||||
|
||||
void fn_vChangeDeviceResolution(void)
|
||||
{
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
BOOL fn_bInFullScreen() // MR1106
|
||||
{
|
||||
return M_GetMainDevice()->GetDevice(0)->IsFullScreen();
|
||||
}
|
||||
//************************************************************************************
|
||||
BOOL fn_bBadRes()
|
||||
{
|
||||
return M_GetMainApp()->m_bBadResolution;
|
||||
}
|
||||
//ANNECY VL SPOFLAG 04/12/97{
|
||||
//************************************************************************************
|
||||
BOOL fn_bIsEditorsActive(void)
|
||||
{
|
||||
return M_GetMainApp()->m_bEditorsAreActive;
|
||||
}
|
||||
//ENDANNECY VL SPOFLAG}
|
||||
//************************************************************************************
|
||||
HINSTANCE fn_hGetApplicationInstance(void)
|
||||
{
|
||||
return(AfxGetInstanceHandle());
|
||||
}
|
||||
//************************************************************************************
|
||||
#ifndef USE_DIRECTX
|
||||
HWND fn_hGetApplicationWindow(void)
|
||||
{
|
||||
return(AfxGetMainWnd()->m_hWnd);
|
||||
}
|
||||
#else
|
||||
// In fact, this should work also under DX7 version
|
||||
HWND fn_hGetApplicationWindow(void)
|
||||
{
|
||||
HWND hResult;
|
||||
CWnd * hCwnd;
|
||||
|
||||
hCwnd = (CWnd *)M_GetMainDevice()->GetDevice(0)->GetViewPort();;
|
||||
hResult = hCwnd->m_hWnd;
|
||||
|
||||
HWND hwnd0=(AfxGetMainWnd()->m_hWnd);
|
||||
static int kk=0;
|
||||
if(kk==0)
|
||||
{
|
||||
return( hResult );
|
||||
}else
|
||||
return hwnd0;
|
||||
|
||||
}
|
||||
HWND fn_hGetApplicationWindowWithChoise(BOOL _isFullScreen)
|
||||
{
|
||||
HWND hResult;
|
||||
CWnd * hCwnd;
|
||||
|
||||
hCwnd = (CWnd *)M_GetMainDevice()->GetDevice(0)->GetViewPort();;
|
||||
hResult = hCwnd->m_hWnd;
|
||||
|
||||
HWND hwnd0=(AfxGetMainWnd()->m_hWnd);
|
||||
|
||||
if(_isFullScreen)
|
||||
{
|
||||
return hwnd0;
|
||||
}else
|
||||
return( hResult );
|
||||
|
||||
}
|
||||
|
||||
#endif /* USE8DX8 */
|
||||
//************************************************************************************
|
||||
char *fn_szGetExeCommandLine(void)
|
||||
{
|
||||
return (AfxGetApp()->m_lpCmdLine);
|
||||
}
|
||||
//************************************************************************************
|
||||
unsigned long g_ulDeviceWidth,g_ulDeviceHeight;
|
||||
//VL0
|
||||
unsigned long g_ulDeviceMode;
|
||||
//EVL
|
||||
|
||||
void MAIN_fn_vSetDeviceWidth(unsigned long ulWidth,unsigned long ulHeight)
|
||||
{
|
||||
g_ulDeviceWidth = ulWidth;
|
||||
g_ulDeviceHeight = ulHeight;
|
||||
}
|
||||
|
||||
|
||||
//VL0
|
||||
void MAIN_fn_vSetDeviceMode(unsigned long ulIsFullScreen )
|
||||
{
|
||||
g_ulDeviceMode = ulIsFullScreen;
|
||||
}
|
||||
//EVL
|
||||
|
||||
|
||||
//************************************************************************************
|
||||
unsigned long MAIN_fn_ulGetDeviceWidth(void)
|
||||
{
|
||||
return(g_ulDeviceWidth);
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
unsigned long MAIN_fn_ulGetDeviceHeight(void)
|
||||
{
|
||||
return(g_ulDeviceHeight);
|
||||
}
|
||||
|
||||
//VL
|
||||
//************************************************************************************
|
||||
unsigned long MAIN_fn_ulDeviceIsFullScreen(void)
|
||||
{
|
||||
return(g_ulDeviceMode);
|
||||
}
|
||||
//EVL
|
||||
|
||||
//************************************************************************************
|
||||
|
||||
//************************************************************************************
|
||||
//************************************************************************************
|
||||
//************************** nouvelle synchro ****************************************
|
||||
//************************************************************************************
|
||||
//************************************************************************************
|
||||
//************************************************************************************
|
||||
//************************************************************************************
|
||||
|
||||
|
||||
//************************************************************************************
|
||||
//************************************************************************************
|
||||
// check if appli asked to end the game
|
||||
// if not, return
|
||||
// if yes, change the engine mode to stop program
|
||||
// tell the appli that engine is leaving
|
||||
// return...
|
||||
void fn_vCheckEnd()
|
||||
{
|
||||
// if no close was asked, return
|
||||
if (M_GetMainApp()->m_bAppliAskedToEndGame == FALSE)
|
||||
return;
|
||||
|
||||
// change engine mode to stop program
|
||||
fn_vChangeEngineMode(EM_ModeStoppingProgram);
|
||||
|
||||
// tells the appli that the engine is beginning the closing procedure
|
||||
M_GetMainApp()->PostThreadMessage(WM_USER,USERM_ENGINE_IS_CLOSING,0);
|
||||
// and that's all
|
||||
}
|
||||
|
||||
// Call fn_vCheckEnd and return TRUE if detected "End of Appli"
|
||||
// return FALSE otherelse
|
||||
ACP_tdxBool fn_bTestIfEndOfAppliAsked()
|
||||
{
|
||||
fn_vCheckEnd();
|
||||
|
||||
if (fn_eGetEngineMode()==EM_ModeStoppingProgram)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
//************************************************************************************
|
||||
//**********************************************************************************
|
||||
// tells the appli that the engine has finished
|
||||
// it will tell the appli that
|
||||
// this function will return when appli is OK
|
||||
void fn_vEngineHasFinished()
|
||||
{
|
||||
// tells the appli that the engine has finished
|
||||
M_GetMainApp()->PostThreadMessage(WM_USER,USERM_ENGINE_IS_DONE,0);
|
||||
// and wait until the engine is OK
|
||||
while (M_GetMainApp()->m_bFinishEngine == FALSE)
|
||||
Sleep(0);
|
||||
}
|
||||
|
||||
|
||||
//************************************************************************************
|
||||
//************************************************************************************
|
||||
// check if appli asked for a pause
|
||||
// if no pause --> return
|
||||
// if pause, stop engine and return when engine restart
|
||||
void fn_vCheckPause()
|
||||
{
|
||||
// if no pause was asked, return
|
||||
if (M_GetMainApp()->m_bAppliAskedToStopEngine == FALSE)
|
||||
return;
|
||||
|
||||
fn_vSetEngineInPaused();
|
||||
|
||||
// reset one step pulse
|
||||
M_GetMainApp()->m_bAppliPulsedOneStep = FALSE;
|
||||
|
||||
// tells appli to stop engine, and wait to restart
|
||||
M_GetMainApp()->PostThreadMessage(WM_USER,USERM_STOP_ENGINE,0);
|
||||
while ((M_GetMainApp()->m_bAppliAskedToStopEngine) && (M_GetMainApp()->m_bAppliPulsedOneStep == FALSE))
|
||||
{
|
||||
Sleep(0);
|
||||
}
|
||||
// reset one step pulse
|
||||
M_GetMainApp()->m_bAppliPulsedOneStep = FALSE;
|
||||
|
||||
fn_vResetEngineFromPaused();
|
||||
|
||||
fn_vCheckEditor();
|
||||
}
|
||||
|
||||
|
||||
//************************************************************************************
|
||||
//************************************************************************************
|
||||
// check if appli asked to go in editor
|
||||
// if no editor --> return
|
||||
// if editor, stop engine, pass in editor and return when engine restart
|
||||
void fn_vCheckEditor()
|
||||
{
|
||||
// if appli didn't ask to launch editor, return
|
||||
if (M_GetMainApp()->m_bAppliAskedToActivateEditors == FALSE)
|
||||
return;
|
||||
|
||||
// ANNECY AV {
|
||||
// Remove all the morphed objects
|
||||
MOR_fn_vRemoveAllMorphedObjects ();
|
||||
#if defined(ACTIVE_EDITOR)
|
||||
GAM_fn_vFillHierarchyBeforeEditor();
|
||||
#endif
|
||||
// ENDANNECY AV }
|
||||
|
||||
// Notify the engine for timer reinit
|
||||
fn_vSetEngineInPaused();
|
||||
|
||||
// tells appli to go in editors.
|
||||
// this will stop the engine
|
||||
M_GetMainApp()->PostThreadMessage(WM_USER,USERM_START_EDITORS,0);
|
||||
// wait for editors to stop
|
||||
while (M_GetMainApp()->m_bAppliAskedToActivateEditors)
|
||||
{
|
||||
Sleep(0);
|
||||
}
|
||||
#if defined(ACTIVE_EDITOR)
|
||||
if (g_DEMO_KeybTest == DEMO_PLAY)
|
||||
{
|
||||
DEMO_fn_vStopWhenPlaying();
|
||||
if (! M_GetMainApp() -> m_bAutoReinitTheMap)
|
||||
fn_vReinitTheMap ();
|
||||
}
|
||||
GAM_fn_vFillHierarchyAfterEditor();
|
||||
#endif
|
||||
#ifdef USE_PROFILER
|
||||
// stop rasters until beginning of next frame
|
||||
PRF_fn_vReinitAllChrono();
|
||||
#endif
|
||||
|
||||
fn_vResetEngineFromPaused();
|
||||
}
|
||||
|
||||
|
||||
//************************************************************************************
|
||||
//************************************************************************************
|
||||
// force appli to start editor
|
||||
// stop engine, pass in editor and return when engine restart
|
||||
void fn_vForceEditor()
|
||||
{
|
||||
#if defined(ACTIVE_EDITOR)
|
||||
// tells engine that the appli wants to go in editor
|
||||
// the editors will be activated as soon as possible
|
||||
M_GetMainApp()->m_bEngineAskedToForceEditors = TRUE;
|
||||
M_GetMainApp()->m_bAppliAskedToActivateEditors = TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
//************************************************************************************
|
||||
ACP_tdxBool fn_bTestIfEditorRunning()
|
||||
{
|
||||
return (unsigned char)M_GetMainApp()->m_bAppliAskedToActivateEditors;
|
||||
}
|
||||
//************************************************************************************
|
||||
//************************************************************************************
|
||||
//************************************************************************************
|
||||
//************************************************************************************
|
||||
void fn_vChoicePreferences(void)
|
||||
{
|
||||
CDlgUpdateOptions dlgPreferences;
|
||||
dlgPreferences.DoModal();
|
||||
}
|
6
Rayman_X/cpa/main/Src/P5/StdAfx.cpp
Normal file
6
Rayman_X/cpa/main/Src/P5/StdAfx.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// ACPProject.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
805
Rayman_X/cpa/main/Src/P5/_ProjApp.cpp
Normal file
805
Rayman_X/cpa/main/Src/P5/_ProjApp.cpp
Normal file
@@ -0,0 +1,805 @@
|
||||
/*=========================================================================
|
||||
* _ProjApp.cpp : Main CPP project.
|
||||
* This is a part of the CPA project.
|
||||
*
|
||||
* Version 1.0
|
||||
* Creation date 09/09/96
|
||||
* Revision date
|
||||
*
|
||||
* (c) Ubi Studios 1996
|
||||
*=======================================================================*/
|
||||
|
||||
/* here are the directive you must respect when changing this file :
|
||||
|
||||
* === don't use malloc, but use memory module functions
|
||||
* === absolutely no file handling in this file
|
||||
* === always specify 'void' keyword for functions parameters and return value
|
||||
* === take care of upper / lower case for #include and other filenames
|
||||
* === NO C++ style comentary
|
||||
* === NO ASSERT, use error module equivalent function
|
||||
|
||||
*/
|
||||
|
||||
#include "MainCPA.h"
|
||||
#include "ITF.h"
|
||||
#include "GAM.h"
|
||||
#include "sif.h"
|
||||
#include "snd.h"
|
||||
#include "VDO.h"
|
||||
|
||||
#include "_projapp.hpp"
|
||||
#include "_projid.h"
|
||||
#include "_EditId.h"
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
/* One instance of application*/
|
||||
_ProjectApp theApp;
|
||||
|
||||
#ifdef ACTIVE_EDITOR
|
||||
/*
|
||||
Keyboard config for application
|
||||
*/
|
||||
|
||||
// add by jt 8/6/97
|
||||
#include "ray.h"
|
||||
// end jt 8/6/97
|
||||
|
||||
#define KA_APP_SWAP 1
|
||||
#define KA_APP_RASTERS 2
|
||||
#define KA_WD_DBACKWARD 3
|
||||
#define KA_WD_DFORWARD 4
|
||||
#define KA_WD_EBACKWARD 5
|
||||
#define KA_WD_EFORWARD 6
|
||||
|
||||
#define KA_HED_HIERARCHY 7
|
||||
#define KA_HED_ACTOR 8
|
||||
#define KA_HED_GEOMETRY 9
|
||||
#define KA_HED_PHYSICAL 10
|
||||
#define KA_HED_IPO 11
|
||||
#define KA_HED_LIGHT 12
|
||||
#define KA_HED_SECTOR 13
|
||||
#define KA_HED_WPWAYS 14
|
||||
#define KA_HED_ZONE 15
|
||||
#define KA_HED_ACTION 16
|
||||
#define KA_HED_MATERIAL 17
|
||||
#define KA_HED_MECHANIC 18
|
||||
#define KA_HED_PARTICLE 19
|
||||
|
||||
#define KA_HED_UNDO 20
|
||||
#define KA_HED_REDO 21
|
||||
|
||||
#define KA_APP_SWAPNOPREF 22
|
||||
|
||||
#define KA_APP_PAUSEENGINE 23
|
||||
#define KA_APP_ONESTEPENGINE 24
|
||||
#define KA_APP_FORCE3DVIEW 25
|
||||
//CPA2 Corneliu Babiuc 06-05-98
|
||||
#define KA_HED_SOUND 26
|
||||
#define KA_APP_OPTIONS 27
|
||||
#define KA_APP_SAVEALL 28
|
||||
#define KA_APP_EXIT 29
|
||||
#define KA_HED_IPT 30
|
||||
//END CPA2 Corneliu Babiuc 20-05-98
|
||||
#define KA_APP_REINIT 31
|
||||
#define KA_APP_KEYBOARD 32
|
||||
|
||||
static tdstKeyboardActionDef gs_a_stAppKeys[] =
|
||||
{
|
||||
{"Swap between Editor and Engine", KA_APP_SWAP},
|
||||
{"Swap to Editor without Preferences", KA_APP_SWAPNOPREF},
|
||||
{"Activate Hierarchy Editor", KA_HED_HIERARCHY},
|
||||
{"Activate Actor Editor", KA_HED_ACTOR},
|
||||
{"Activate Geometric Object Editor", KA_HED_GEOMETRY},
|
||||
{"Activate Physical Object Editor", KA_HED_PHYSICAL},
|
||||
{"Activate IPO Editor", KA_HED_IPO},
|
||||
{"Activate Light Editor", KA_HED_LIGHT},
|
||||
{"Activate Sector Editor", KA_HED_SECTOR},
|
||||
{"Activate Waypoints & Ways Editor", KA_HED_WPWAYS},
|
||||
{"Activate Zone Editor", KA_HED_ZONE},
|
||||
{"Activate Actions Editor", KA_HED_ACTION},
|
||||
{"Activate Material Editor", KA_HED_MATERIAL},
|
||||
{"Activate Mechanic Editor", KA_HED_MECHANIC},
|
||||
{"Activate Particle Editor", KA_HED_PARTICLE},
|
||||
{"Activate Sound Editor", KA_HED_SOUND},
|
||||
{"Activate IPT Editor", KA_HED_IPT},
|
||||
{"Save All", KA_APP_SAVEALL},
|
||||
{"Reinit the map", KA_APP_REINIT},
|
||||
{"Undo", KA_HED_UNDO},
|
||||
{"Redo", KA_HED_REDO},
|
||||
{"Options", KA_APP_OPTIONS},
|
||||
{"Keyboard", KA_APP_KEYBOARD},
|
||||
{"Exit", KA_APP_EXIT},
|
||||
{"Pause Engine", KA_APP_PAUSEENGINE},
|
||||
{"One Step Engine", KA_APP_ONESTEPENGINE},
|
||||
{"Force 3D View", KA_APP_FORCE3DVIEW},
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* ACTIVE_EDITOR*/
|
||||
|
||||
BOOL bFocusLost=FALSE;
|
||||
BOOL bManagingFocus=FALSE;
|
||||
BOOL gbForce3DView=FALSE;
|
||||
|
||||
/*===========================================================================
|
||||
/ Description: Inits
|
||||
/ Creation date: 09 Sep 96
|
||||
/ Author: CB
|
||||
/---------------------------------------------------------------------------
|
||||
/ Revision date:
|
||||
/ Author:
|
||||
/===========================================================================*/
|
||||
BOOL _ProjectApp::InitApplication (void)
|
||||
{
|
||||
if (!fn_bInitApplication())
|
||||
return FALSE;
|
||||
|
||||
GMT_fn_vInitFor3DOS();
|
||||
SCR_fn_v_RdL0_Init();
|
||||
|
||||
fn_vInitEngineWhenInitApplication();
|
||||
|
||||
#ifdef ACTIVE_EDITOR
|
||||
HIE_fn_vCreateMatrixStack();
|
||||
|
||||
/* Create keyboard config*/
|
||||
mp_oAppKeyboard = new CPA_KeyActionConfiguration("CPAApp.ini", gs_a_stAppKeys);
|
||||
mp_oAppKeyboard->mfn_vSetObjectName("Application");
|
||||
m_csApplicationName = C_szMainFullName;
|
||||
m_csApplicationVersion = C_szMainVersion;
|
||||
#endif
|
||||
|
||||
return CPA_ProjectApp::InitApplication();
|
||||
}
|
||||
|
||||
BOOL _ProjectApp::InitInstance (void)
|
||||
{
|
||||
return CPA_ProjectApp::InitInstance();
|
||||
}
|
||||
|
||||
void _ProjectApp::ExitApplication (void)
|
||||
{
|
||||
#ifdef ACTIVE_EDITOR
|
||||
/* Delete keyboard config*/
|
||||
delete mp_oAppKeyboard;
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// BIDOUILLE : To force some functions to be in export.LIB
|
||||
// FORCE LINK
|
||||
/////////////////////////////////////////////////////////////
|
||||
int a = -1;
|
||||
if (++a)
|
||||
{
|
||||
// Bidouilles are here (the "a" is just here to avoid
|
||||
// following code to be executed)
|
||||
WP_tdhWayPoint hWayPoint = WP_fnh_WayPoint_Create();
|
||||
WP_fnv_WayPoint_Destroy(hWayPoint);
|
||||
|
||||
CSplitFrame split;
|
||||
DD_bSearchReference(NULL,NULL,0,NULL);
|
||||
CPA_ToolDLLBase *p_oDLL;
|
||||
DEV_SingleDevice3D oSgl3D(MD_ONEDEVICE);
|
||||
|
||||
p_oDLL->fn_vSetReceivingEvtEditorMessages();
|
||||
p_oDLL->fn_vSetReceivingWindowMessages();
|
||||
GEO_xGetCenterPointOfIndexedSphere(NULL,NULL,NULL);
|
||||
|
||||
g_oCoherenceManager.m_fn_vAddALink( NULL, NULL);
|
||||
|
||||
DNM_fn_vInitLinkTableOfMecMatCharacteristics();
|
||||
|
||||
SIF_fn_iGetSoundInfosCount();
|
||||
|
||||
RAY_vComputeAllSector(NULL);
|
||||
|
||||
SAI_fn_p_vGetTableValuePointerOf(NULL, SAI_eTypeXX);
|
||||
|
||||
GLI_xDraw3DLine16(NULL,NULL,NULL,NULL);
|
||||
|
||||
//ANNECY CT 20/02/98{
|
||||
// fn_vFreeJustStructAnim( NULL );
|
||||
//ENDANNECY CT}
|
||||
|
||||
#if defined(ACTIVE_AIDEBUG)
|
||||
fn_pstSetValidBreakPoint( NULL, NULL, 0 );
|
||||
#endif
|
||||
|
||||
}
|
||||
///////////////// END BIDOUILLE /////////////////////////////
|
||||
#endif
|
||||
|
||||
fn_vExitApplication();
|
||||
|
||||
CPA_ProjectApp::ExitApplication();
|
||||
fn_vDesinitEngineWhenLeaveApplication();
|
||||
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Description: To activate the given DLL
|
||||
// Creation date: 13 Feb 97
|
||||
// Author: MT
|
||||
//---------------------------------------------------------------------------
|
||||
// szDLLName Name of DLL to activate
|
||||
// Return BOOL to indicate if dll has to be activated
|
||||
//---------------------------------------------------------------------------
|
||||
// Revision date:
|
||||
// Author:
|
||||
//===========================================================================
|
||||
#ifdef ACTIVE_EDITOR
|
||||
BOOL _ProjectApp::fn_bActivateDLL(char *szDLLName)
|
||||
{
|
||||
if ( M_bEditorsActive() )
|
||||
{
|
||||
CPA_DLLBase *p_oDLL = m_p_oMainWorld->GetObjectDLLWithName(szDLLName);
|
||||
if ( p_oDLL ) // DLL founded
|
||||
{
|
||||
m_p_oMainWorld->fn_bActivateEditor(p_oDLL,NULL);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_oDLL = m_p_oMainWorld->GetToolDLLWithName(szDLLName);
|
||||
if ( p_oDLL ) // DLL founded
|
||||
{
|
||||
m_p_oMainWorld->fn_bActivateEditor(p_oDLL,NULL);
|
||||
return TRUE;
|
||||
}
|
||||
else // there's no DLL with that name!!
|
||||
{
|
||||
CString oCst;
|
||||
oCst . Format ( "the DLL ' %s ' does not exist!" , szDLLName);
|
||||
AfxMessageBox(oCst,MB_ICONEXCLAMATION | MB_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Description: To update dynamic lights
|
||||
// Creation date:
|
||||
// Author:
|
||||
//---------------------------------------------------------------------------
|
||||
// Revision date:
|
||||
// Author:
|
||||
//===========================================================================
|
||||
void _ProjectApp::fn_vUpdateDynamicLights (void)
|
||||
{
|
||||
m_p_oMainWorld->m_lNbDynamicLights = 0;
|
||||
fn_vFindDynamicLights(gp_stDynamicWorld, &m_p_oMainWorld->m_lNbDynamicLights, m_p_oMainWorld->m_a_tdxhArrayOfDynamicLights);
|
||||
}
|
||||
|
||||
void _ProjectApp::fn_vFindDynamicLights (HIE_tdxHandleToSuperObject hCharacter, long *lNbLights, GLI_tdxHandleToLight a_hLights[])
|
||||
{
|
||||
HIE_tdxHandleToSuperObject hChild;
|
||||
long i;
|
||||
|
||||
if (!hCharacter)
|
||||
return;
|
||||
|
||||
// character ?
|
||||
if (HIE_fn_ulGetSuperObjectType(hCharacter) == HIE_C_ulActor)
|
||||
{
|
||||
// is there dynamic light ?
|
||||
if ((M_GetEngineObject(hCharacter)->h_MSLight)&&(fn_ucMSLightGetOnOff(M_GetEngineObject(hCharacter)->h_MSLight)))
|
||||
{
|
||||
a_hLights[(*lNbLights)++] = fn_p_stMSLightGetLight(M_GetEngineObject(hCharacter)->h_MSLight);
|
||||
}
|
||||
}
|
||||
|
||||
// next level of dynamic hierarchy
|
||||
HIE_M_ForEachChildOf(hCharacter, hChild, i)
|
||||
{
|
||||
fn_vFindDynamicLights(hChild, lNbLights, a_hLights);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ACTIVE_EDITOR
|
||||
|
||||
//===========================================================================
|
||||
// Description: To treat application keys even if engine is running.
|
||||
// Creation date: 17 Jul 96
|
||||
// Author: CB
|
||||
//---------------------------------------------------------------------------
|
||||
// nChar Key to treat
|
||||
// Return BOOL to indicate if key has been treated
|
||||
//---------------------------------------------------------------------------
|
||||
// Revision date:
|
||||
// Author:
|
||||
//===========================================================================
|
||||
#ifdef ACTIVE_EDITOR
|
||||
BOOL _ProjectApp::fn_bTreatAppKeyboard(UINT nChar)
|
||||
{
|
||||
CPA_EditorBase *p_oEditor;
|
||||
BOOL bUp = FALSE;
|
||||
BOOL bShint = FALSE;
|
||||
|
||||
if(nChar & 0x40000000)
|
||||
{
|
||||
nChar &= 0xbfffffff;
|
||||
bShint = TRUE;
|
||||
}
|
||||
|
||||
if (!M_bEditorsActive())
|
||||
gbForce3DView = FALSE;
|
||||
|
||||
if(nChar & 0x80000000)
|
||||
{
|
||||
bUp = TRUE;
|
||||
nChar &= 0x7FFFFFFF;
|
||||
if(mp_oAppKeyboard->mfn_uwKeyToAction(nChar) == KA_APP_FORCE3DVIEW)
|
||||
{
|
||||
gbForce3DView = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if(gbForce3DView)
|
||||
{
|
||||
if(bUp)
|
||||
M_GetMainDevice2()->GetDevice(0)->GetViewPort()->SendMessage(WM_KEYUP, nChar);
|
||||
else
|
||||
M_GetMainDevice2()->GetDevice(0)->GetViewPort()->SendMessage(WM_KEYDOWN, nChar);
|
||||
return TRUE;
|
||||
}
|
||||
if(bUp)
|
||||
return FALSE;
|
||||
|
||||
// In edit mode, transform key to action
|
||||
switch(mp_oAppKeyboard->mfn_uwKeyToAction(nChar))
|
||||
{
|
||||
// To swap beetween edit and engine mode
|
||||
case KA_APP_SWAP:
|
||||
// if(M_GetMainWnd()->m_bEnableEditors)
|
||||
// {
|
||||
// if (!(M_GetMainDevice()->GetDevice(0)->IsFullScreen()))
|
||||
M_GetMainWnd()->SendMessage(WM_COMMAND, CPA_IDCB_SWAPTOEDITORS, 0);
|
||||
// }
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case KA_APP_FORCE3DVIEW:
|
||||
if (!M_bEditorsActive())
|
||||
return TRUE;
|
||||
gbForce3DView = TRUE;
|
||||
return TRUE;
|
||||
|
||||
case KA_APP_PAUSEENGINE:
|
||||
if (M_bEditorsActive())
|
||||
return FALSE;
|
||||
M_GetMainWnd()->SendMessage(WM_COMMAND, CPA_IDCB_PAUSEENGINE, 0);
|
||||
return TRUE;
|
||||
|
||||
case KA_APP_ONESTEPENGINE:
|
||||
if (M_bEditorsActive())
|
||||
return FALSE;
|
||||
M_GetMainWnd()->SendMessage(WM_COMMAND, CPA_IDCB_ONESTEPENGINE, 0);
|
||||
return TRUE;
|
||||
|
||||
case KA_APP_SWAPNOPREF:
|
||||
GetInterface()->fn_vUseUserPreferences(FALSE);
|
||||
M_GetMainWnd()->SendMessage(WM_COMMAND, CPA_IDCB_SWAPTOEDITORS, 0);
|
||||
return TRUE;
|
||||
break;
|
||||
// the next 4 are for walking through the datas and the editors
|
||||
// in the reverse order they were edited or open
|
||||
/* case KA_WD_DBACKWARD:
|
||||
if (!M_bEditorsActive())
|
||||
return FALSE;
|
||||
m_oAppliWalkDataMgr.DBackward();
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case KA_WD_DFORWARD:
|
||||
if (!M_bEditorsActive())
|
||||
return FALSE;
|
||||
m_oAppliWalkDataMgr.DForward();
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case KA_WD_EBACKWARD:
|
||||
if (!M_bEditorsActive())
|
||||
return FALSE;
|
||||
m_oAppliWalkDataMgr.EBackward();
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case KA_WD_EFORWARD:
|
||||
if (!M_bEditorsActive())
|
||||
return FALSE;
|
||||
m_oAppliWalkDataMgr.EForward();
|
||||
return TRUE;
|
||||
break;*/
|
||||
|
||||
// undo/redo
|
||||
case KA_HED_UNDO:
|
||||
if(bShint)
|
||||
return FALSE;
|
||||
if (!M_bEditorsActive())
|
||||
return FALSE;
|
||||
if(M_GetEditManager()->CanUndo())
|
||||
M_GetEditManager()->Undo();
|
||||
GetInterface()->GetFrameBase()->fn_vInitGeneralDialogBarWithContext();
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case KA_HED_REDO:
|
||||
if(bShint)
|
||||
return FALSE;
|
||||
if (!M_bEditorsActive())
|
||||
return FALSE;
|
||||
if(M_GetEditManager()->CanRedo())
|
||||
M_GetEditManager()->Redo();
|
||||
GetInterface()->GetFrameBase()->fn_vInitGeneralDialogBarWithContext();
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
// and now, editors activation
|
||||
case KA_HED_HIERARCHY:
|
||||
if (!M_bEditorsActive())
|
||||
return FALSE;
|
||||
|
||||
//ANNECY Shaitan Correction 03/02/98 {
|
||||
p_oEditor = m_p_oMainWorld -> GetEditorByName("Hierarchy");
|
||||
//ENDANNECY Shaitan Correction }
|
||||
if(p_oEditor)
|
||||
{
|
||||
m_p_oMainWorld->fn_bActivateEditor(p_oEditor,NULL);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
case KA_HED_ACTOR:
|
||||
return fn_bActivateDLL ( C_szDLLActorName );
|
||||
break;
|
||||
case KA_HED_GEOMETRY:
|
||||
return fn_bActivateDLL ( C_szDLLGeometryName );
|
||||
break;
|
||||
case KA_HED_PHYSICAL:
|
||||
return fn_bActivateDLL ( C_szDLLPhysicalObjectName );
|
||||
break;
|
||||
//ANNECY Shaitan NewInterface 24/03/98 {
|
||||
case KA_HED_IPO:
|
||||
return fn_bActivateDLL ( C_szDLLInstanciatedPhysicalObjectName );
|
||||
break;
|
||||
//ENDANNECY Shaitan NewInterface }
|
||||
case KA_HED_LIGHT:
|
||||
return fn_bActivateDLL ( C_szDLLLightName );
|
||||
break;
|
||||
case KA_HED_SECTOR:
|
||||
return fn_bActivateDLL ( C_szDLLSectorName );
|
||||
break;
|
||||
case KA_HED_WPWAYS:
|
||||
return fn_bActivateDLL ( C_szDLLWayPointName );
|
||||
break;
|
||||
case KA_HED_ZONE:
|
||||
return fn_bActivateDLL ( C_szDLLZDxName );
|
||||
break;
|
||||
|
||||
// tool editor activation
|
||||
case KA_HED_ACTION:
|
||||
return fn_bActivateDLL ( C_szDLLActionName );
|
||||
break;
|
||||
case KA_HED_MATERIAL:
|
||||
return fn_bActivateDLL ( C_szDLLMaterialName );
|
||||
break;
|
||||
case KA_HED_MECHANIC:
|
||||
return fn_bActivateDLL ( C_szDLLMecaName );
|
||||
break;
|
||||
//ANNECY Shaitan NewInterface 24/03/98 {
|
||||
case KA_HED_PARTICLE:
|
||||
return fn_bActivateDLL ( C_szDLLPartGenName );
|
||||
break;
|
||||
//ENDANNECY Shaitan NewInterface }
|
||||
//CPA2 Corneliu Babiuc 06-05-98
|
||||
case KA_HED_SOUND:
|
||||
return fn_bActivateDLL ( C_szDLLSoundName );
|
||||
case KA_HED_IPT:
|
||||
return fn_bActivateDLL ( "IPTEditor" );
|
||||
case KA_APP_OPTIONS:
|
||||
GetInterface()->fn_vDoDialogOptions();
|
||||
return TRUE;
|
||||
case KA_APP_KEYBOARD:
|
||||
{
|
||||
A3d_KeyboardAllConfDlg oDialog;
|
||||
|
||||
oDialog.DoModal();
|
||||
return TRUE;
|
||||
}
|
||||
case KA_APP_SAVEALL:
|
||||
GetInterface()->GetFrameBase()->SendMessage(WM_COMMAND, CPA_IDM_SAVEALL);
|
||||
return TRUE;
|
||||
case KA_APP_REINIT:
|
||||
GetInterface()->GetFrameBase()->SendMessage(WM_COMMAND, CPA_IDM_INITMAP);
|
||||
return TRUE;
|
||||
case KA_APP_EXIT:
|
||||
M_GetMainWnd()->SendMessage(WM_COMMAND, CPA_ID_APP_EXIT);
|
||||
return TRUE;
|
||||
//END CPA2 Corneliu Babiuc 20-05-98
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif // ACTIVE_EDITOR
|
||||
|
||||
//===========================================================================
|
||||
// Description: Get the project name and version.
|
||||
// Creation date: 09 Sep 96
|
||||
// Author: CB
|
||||
//---------------------------------------------------------------------------
|
||||
// Revision date:
|
||||
// Author:
|
||||
//===========================================================================
|
||||
void _ProjectApp::fn_vUpdateFrameTitle(void)
|
||||
{
|
||||
#ifdef ACTIVE_EDITOR
|
||||
sprintf(M_GetMainWnd()->m_szProjectName, "Rayman II - %s", __DATE__);
|
||||
#endif
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Description: Create a thread for engine.
|
||||
// Creation date: 11 Jun 96
|
||||
// Author: CB
|
||||
//---------------------------------------------------------------------------
|
||||
// Return void
|
||||
//---------------------------------------------------------------------------
|
||||
// Revision date:
|
||||
// Author:
|
||||
//===========================================================================
|
||||
UINT fn_uiPCEngineInterface(LPVOID pt)
|
||||
{
|
||||
UINT uiRes;
|
||||
|
||||
#ifdef ACTIVE_EDITOR
|
||||
// Bidouille (je suis pouss<73> <20> ces extr<74>mit<69>s)
|
||||
// Permet <20> la thread courante d'acc<63>der aux objets C++ de la thread
|
||||
// interface.
|
||||
AFX_MODULE_THREAD_STATE *pState = AfxGetModuleThreadState();
|
||||
CHandleMap *pLast = pState->m_pmapHWND;
|
||||
pState->m_pmapHWND = ((AFX_MODULE_THREAD_STATE*)pt)->m_pmapHWND;
|
||||
#endif // ACTIVE_EDITOR
|
||||
|
||||
// Call main C engine loop
|
||||
fn_vResetEngineFromPaused();
|
||||
uiRes = fn_uiEngineMainLoop();
|
||||
|
||||
#ifdef ACTIVE_EDITOR
|
||||
pState->m_pmapHWND = pLast;
|
||||
#endif // ACTIVE_EDITOR
|
||||
return uiRes;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Description: Create a thread for engine.
|
||||
// Creation date: 11 Jun 96
|
||||
// Author: CB
|
||||
//---------------------------------------------------------------------------
|
||||
// Return void
|
||||
//---------------------------------------------------------------------------
|
||||
// Revision date:
|
||||
// Author:
|
||||
//===========================================================================
|
||||
void _ProjectApp::fn_vCreateEngineThread(void)
|
||||
{
|
||||
// Task will be run at the first pain update of the directdraw surface.
|
||||
// It will avoid some strange bug in some PCs.
|
||||
// => So task ic created suspended
|
||||
m_p_oEngineThread = AfxBeginThread
|
||||
(fn_uiPCEngineInterface, (LPVOID)AfxGetModuleThreadState(), THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Description: When main window gains or loose windows focus.
|
||||
// Creation date: 09 Sep 96
|
||||
// Author: CB
|
||||
//---------------------------------------------------------------------------
|
||||
// Revision date:
|
||||
// Author:
|
||||
//===========================================================================
|
||||
void _ProjectApp::fn_vWhenAppGainFocus(void)
|
||||
{
|
||||
if (!bManagingFocus && bFocusLost)
|
||||
{
|
||||
//SND
|
||||
bManagingFocus=TRUE;
|
||||
bFocusLost=FALSE;
|
||||
SND_fn_vRestoreDriverSound();
|
||||
bManagingFocus=FALSE;
|
||||
|
||||
#ifdef GAM_VIDEO
|
||||
//AVI
|
||||
VDO_fn_xResumeVideoAVI();
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void _ProjectApp::fn_vWhenAppLooseFocus(void)
|
||||
{
|
||||
if (!bManagingFocus && !bFocusLost)
|
||||
{
|
||||
//AVI
|
||||
#ifdef GAM_VIDEO
|
||||
VDO_fn_xPauseVideoAVI();
|
||||
#endif
|
||||
|
||||
//SND
|
||||
bManagingFocus=TRUE;
|
||||
bFocusLost=TRUE;
|
||||
SND_fn_vReleaseDriverSound();
|
||||
bManagingFocus=FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Description: called when engine is about to start
|
||||
// Creation date: 04 feb 97
|
||||
// Author: FBF
|
||||
//---------------------------------------------------------------------------
|
||||
// Revision date:
|
||||
// Author:
|
||||
//===========================================================================
|
||||
void _ProjectApp::fn_vBeforeEngineStarts(void)
|
||||
{
|
||||
// resume all sound
|
||||
SND_fn_vResumeSound();
|
||||
// TODO : Add your code here
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Description: called just after engine stops
|
||||
// Creation date: 04 feb 97
|
||||
// Author: FBF
|
||||
//---------------------------------------------------------------------------
|
||||
// Revision date:
|
||||
// Author:
|
||||
//===========================================================================
|
||||
void _ProjectApp::fn_vAfterEngineStops(void)
|
||||
{
|
||||
// stop all sound
|
||||
SND_fn_vPauseSound();
|
||||
|
||||
#if defined(ACTIVE_EDITOR)
|
||||
fn_vKillAllAlways();
|
||||
#endif /* ACTIVE_EDITOR */
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// Description: Do a fatal error.
|
||||
// Display a message box et exit application with code -1.
|
||||
// Creation date: 25 Jun 96
|
||||
// Author: CB
|
||||
//---------------------------------------------------------------------------
|
||||
// p_szError Error message
|
||||
// Return void
|
||||
//---------------------------------------------------------------------------
|
||||
// Revision date:
|
||||
// Author:
|
||||
//===========================================================================
|
||||
void _ProjectApp::fn_vDynaFatalError(char *p_szError)
|
||||
{
|
||||
char szTemp[512];
|
||||
|
||||
sprintf(szTemp, "%s says fatal error !\n\n%s", C_szMainFullName, p_szError);
|
||||
AfxMessageBox((LPCTSTR) szTemp, MB_ICONEXCLAMATION | MB_OK);
|
||||
if(m_p_oEngineThread)
|
||||
::TerminateThread(m_p_oEngineThread->m_hThread, 255);
|
||||
::ExitThread(255);
|
||||
}
|
||||
|
||||
#else // WIN32 : other platform than WIN32
|
||||
|
||||
/*===========================================================================
|
||||
/ Description: main function : project entrance for non WIN32 platform
|
||||
/ Creation date: 13 January 1997
|
||||
/ Author: VL
|
||||
/---------------------------------------------------------------------------
|
||||
/ argc number of args
|
||||
/ argv array of args
|
||||
/ return application exit code
|
||||
/---------------------------------------------------------------------------
|
||||
/ Revision date:
|
||||
/ Author:
|
||||
/===========================================================================*/
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
/* initialize application*/
|
||||
if (!fn_bInitApplication())
|
||||
return -1;
|
||||
/* create screen display*/
|
||||
if (!fn_bCreateMainDisplayScreen())
|
||||
return -1;
|
||||
/* call engine loop*/
|
||||
fn_uiEngineMainLoop();
|
||||
/* exit application*/
|
||||
fn_vExitApplication();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*===========================================================================
|
||||
/ Description: initialize/create main viewport
|
||||
/ Creation date: 13 January 1997
|
||||
/ Author: VL
|
||||
/---------------------------------------------------------------------------
|
||||
/ Return TRUE if success
|
||||
/---------------------------------------------------------------------------
|
||||
/ Revision date:
|
||||
/ Author:
|
||||
/===========================================================================*/
|
||||
GLD_tdhDevice g_hDeviceHandle;
|
||||
GLD_tdhViewport g_hViewport;
|
||||
|
||||
BOOL fn_bCreateMainDisplayScreen( void )
|
||||
{
|
||||
/* variable for Device*/
|
||||
GLD_tdstDeviceAttributes stDevAttrib;
|
||||
/*GLD_tdhDevice hDeviceHandle; */
|
||||
|
||||
/* variable for ViewPort*/
|
||||
GLD_tdstViewportAttributes stViewAttrib;
|
||||
/*GLD_tdhViewport hViewport;*/
|
||||
|
||||
/* create device*/
|
||||
stDevAttrib.dwFullScreenModeX = C_dwScreenWidth;
|
||||
stDevAttrib.dwFullScreenModeY = C_dwScreenHeight;
|
||||
stDevAttrib.dwFullScreenModeBpp = C_dwScreenDepth;
|
||||
|
||||
if (!GLD_bCreateDevice( &stDevAttrib, &g_hDeviceHandle ))
|
||||
return FALSE;
|
||||
|
||||
/* create viewport*/
|
||||
stViewAttrib.dwTopInPercent = 0;
|
||||
stViewAttrib.dwBottomInPercent = 100;
|
||||
stViewAttrib.dwLeftInPercent = 0;
|
||||
stViewAttrib.dwRightInPercent = 100;
|
||||
|
||||
if (!GLD_bCreateViewport( g_hDeviceHandle, &stViewAttrib, &g_hViewport ))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /*WIN32*/
|
||||
|
||||
/*===========================================================================
|
||||
/ Description: Initialize appliaction
|
||||
/ Creation date: 13 January 1997
|
||||
/ Author: VL
|
||||
/---------------------------------------------------------------------------
|
||||
/ Return state of initialization (TRUE = success, FALSE : error)
|
||||
/---------------------------------------------------------------------------
|
||||
/ Revision date:
|
||||
/ Author:
|
||||
/===========================================================================*/
|
||||
BOOL fn_bInitApplication( void )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
/ Description: called before application ends
|
||||
/ Creation date: 13 January 1997
|
||||
/ Author: VL
|
||||
/---------------------------------------------------------------------------
|
||||
/ Return void
|
||||
/---------------------------------------------------------------------------
|
||||
/ Revision date:
|
||||
/ Author:
|
||||
/===========================================================================*/
|
||||
void fn_vExitApplication( void )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void _ProjectApp::fn_vReinitCurrentMap(void)
|
||||
{
|
||||
#if defined(ACTIVE_EDITOR)
|
||||
fn_vReinitTheMap();
|
||||
#endif /* ACTIVE_EDITOR */
|
||||
}
|
Reference in New Issue
Block a user