// AnimScript.cpp : Defines the class behaviors for the application. // #include "stdafx.h" #include "AnimScript.h" #include "MainFrm.h" #include "AnimScriptDoc.h" #include "AnimScriptView.h" #if !defined(STUFF_STUFF_HPP) #include "Stuff\Stuff.hpp" #endif #include #include #if !defined(MW4ANIMATIONSYSTEM_HPP) #include #endif #include "mw4.hpp" #include "..\buildnum\buildnum.h" // current version and build number //#include "AnimDetail.h" #include "mw4headers.hpp" #include "Vehicle.hpp" #include "MechAnimationState.hpp" #include "mlr\mlr.hpp" #include "gosfx\gosfx.hpp" #include "compost\compost.hpp" // jcem - start #include "ctcls.h" #include "ctcl.h" // jcem extern Time g_fLastGameStart; #pragma data_seg(".SHARED_DATA") // all data in this section must be INITIALIZED!!!!!!!!!!!!! BOOL g_bLaunched = FALSE; #pragma data_seg() #pragma comment(linker, "/section:.SHARED_DATA,RWS") #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif char *LocalIPAddress; int __stdcall Mech4ReconnectGame(void) { gosASSERT(FALSE); return 0; } void __cdecl CDedicatedServerUI::EnterRunningGameState(void) { gosASSERT(FALSE); } void __cdecl CDedicatedServerUI::EnterStoppingGameState(void) { gosASSERT(FALSE); } void __cdecl CDedicatedServerUI::EnterRecyclingGameState(void) { gosASSERT(FALSE); } void __cdecl CDedicatedServerUI::EnterLoadingGameState(void) { gosASSERT(FALSE); } SCRIPTVAR_INT(ConnectionIndex) = 0; void RegisterData(void) { gosASSERT(FALSE); } void UnRegisterData(void) { gosASSERT(FALSE); } SCRIPTCALLBACK(PreConnect) { gosASSERT(FALSE); return 0; } SCRIPTCALLBACK(InitConnectionWizard) { gosASSERT(FALSE); return 0; } SCRIPTCALLBACK(LoadMPConnectionSettings) { gosASSERT(FALSE); return 0; } SCRIPTCALLBACK(CancelDialup) { gosASSERT(FALSE); return 0; } void _stdcall InitializeGameEngine() { Stuff::ArmorLevel = 4; Stuff::InitializeClasses(); MidLevelRenderer::InitializeClasses(); gosFX::InitializeClasses(); ElementRenderer::InitializeClasses(); Compost::InitializeClasses(); Adept::InitializeClasses(); MechWarrior4::InitializeClasses(); } void _stdcall TerminateGameEngine() { } void __stdcall GetGameOSEnvironment(char* CommandLine) { // //---------------------------------------------------------- // This is where to set GOS environment settings. //---------------------------------------------------------- // Environment.applicationName = "AnimationScript"; Environment.screenWidth = 640; Environment.screenHeight = 480; Environment.bitDepth = 16; // Environment.InitializeGameEngine = InitializeGameEngine; // Environment.TerminateGameEngine = TerminateGameEngine; } ///////////////////////////////////////////////////////////////////////////// // CAnimScriptApp BEGIN_MESSAGE_MAP(CAnimScriptApp, CWinApp) //{{AFX_MSG_MAP(CAnimScriptApp) ON_COMMAND(ID_APP_ABOUT, OnAppAbout) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG_MAP // Standard file based document commands ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) // Standard print setup command ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CAnimScriptApp construction CAnimScriptApp::CAnimScriptApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance } ///////////////////////////////////////////////////////////////////////////// // The one and only CAnimScriptApp object CAnimScriptApp theApp; ///////////////////////////////////////////////////////////////////////////// // CAnimScriptApp initialization CString g_strRoot; BOOL CAnimScriptApp::InitInstance() { InitGameOS( AfxGetInstanceHandle(), NULL, "\0" ); Stuff::ArmorLevel = 4; Stuff::InitializeClasses(); MidLevelRenderer::InitializeClasses(); gosFX::InitializeClasses(); ElementRenderer::InitializeClasses(); Compost::InitializeClasses(); //Adept::InitializeClasses(); //MechWarrior4::InitializeClasses(); AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif SetRegistryKey(_T("Animation Scripter")); LoadStdProfileSettings(); // Load standard INI file options (including MRU) // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views. CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CAnimScriptDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CAnimScriptView)); AddDocTemplate(pDocTemplate); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; char dir[MAX_PATH]; GetCurrentDirectory(MAX_PATH,dir); g_strRoot = dir; // The one and only window has been initialized, so show and update it. m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); return TRUE; } int CAnimScriptApp::ExitInstance() { //MechWarrior4::TerminateClasses(); //Adept::TerminateClasses(); Compost::TerminateClasses(); ElementRenderer::TerminateClasses(); gosFX::TerminateClasses(); MidLevelRenderer::TerminateClasses(); Stuff::TerminateClasses(); ExitGameOS(); return CWinApp::ExitInstance(); } ///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About class CAboutDlg : public CDialog { public: CAboutDlg(); // Dialog Data //{{AFX_DATA(CAboutDlg) enum { IDD = IDD_ABOUTBOX }; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: //{{AFX_MSG(CAboutDlg) // No message handlers //}}AFX_MSG DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { //{{AFX_DATA_INIT(CAboutDlg) //}}AFX_DATA_INIT } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAboutDlg) //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) //{{AFX_MSG_MAP(CAboutDlg) // No message handlers //}}AFX_MSG_MAP END_MESSAGE_MAP() // App command to run the dialog void CAnimScriptApp::OnAppAbout() { CAboutDlg aboutDlg; aboutDlg.DoModal(); } ///////////////////////////////////////////////////////////////////////////// // CAnimScriptApp message handlers // jcem - start int __stdcall CTCL_GetType(void* instance, int args, void* data[]) { ASSERT(FALSE); return 0; } int __stdcall CTCL_IsConsole(void* instance, int args, void* data[]) { ASSERT(FALSE); return 0; } int __stdcall CTCL_IsConsoleX(void* instance, int args, void* data[]) { ASSERT(FALSE); return 0; } int __stdcall CTCL_Get(void* instance, int args, void* data[]) { ASSERT(FALSE); return 0; } int __stdcall CTCL_Set(void* instance, int args, void* data[]) { ASSERT(FALSE); return 0; } BOOL __stdcall CTCL_Before() { ASSERT(FALSE); return FALSE; } void __stdcall CTCL_After() { ASSERT(FALSE); } void __stdcall CTCL_Proc() { ASSERT(FALSE); } void CTCL_API CTCL_DoTerminateAppl() { ASSERT(FALSE); } void CTCL_API CTCL_DoMainShell() { ASSERT(FALSE); } void CTCL_API CTCL_DoCreateGame() { ASSERT(FALSE); } void CTCL_API CTCL_DoJoinGame() { ASSERT(FALSE); } void CTCL_API CTCL_CheckJoinGame() { ASSERT(FALSE); } void CTCL_API CTCL_DoGame1st() { ASSERT(FALSE); } void CTCL_API CTCL_StartGame(BOOL bRealLaunch) { ASSERT(FALSE); } SCRIPTVAR_INT(AdvertiseThisGame) = 1; SCRIPTCALLBACK(SetGameNameDefault) { DWORD dwSize = 256; FREE_PTR(GameName); GameName = (char *) gos_Malloc(dwSize); strcpy(GameName, "Server"); return 0; } //======================================================================== // Sets the global variable 'PlayerName' to the default player name. //======================================================================== SCRIPTCALLBACK(SetPlayerNameDefault) { DWORD dwSize = 256; FREE_PTR(PlayerName); PlayerName = (char *) gos_Malloc(dwSize); strcpy(PlayerName, "Player"); return 0; } // jcem - end