mirror of
https://github.com/electronicarts/CnC_Renegade.git
synced 2025-12-16 07:31:40 -05:00
Initial commit of Command & Conquer Renegade source code.
This commit is contained in:
484
Code/Tests/movietest/WINMAIN.CPP
Normal file
484
Code/Tests/movietest/WINMAIN.CPP
Normal file
@@ -0,0 +1,484 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Header: /Commando/Code/Tests/movietest/WINMAIN.CPP 2 3/21/98 12:08p Greg_h $ */
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : Commando *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tests/movietest/WINMAIN.CPP $*
|
||||
* *
|
||||
* $Author:: Greg_h $*
|
||||
* *
|
||||
* $Modtime:: 3/06/98 2:47p $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* WinMain -- Win32 Program Entry Point! *
|
||||
* WIN_resize -- Surrender-required function which resizes the main window *
|
||||
* WIN_set_fullscreen -- Surrender-required function for toggling full-screen mode *
|
||||
* Main_Window_Proc -- Windows Proc for the main game window *
|
||||
* Create_Main_Window -- Creates the main game window *
|
||||
* Focus_Loss -- this function is called when the application loses focus *
|
||||
* Focus_Restore -- This function is called when the application gets focus *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
#include "winmain.h"
|
||||
#include <sr.hpp>
|
||||
#include "win.h"
|
||||
#include "wwmouse.h"
|
||||
#include "init.h"
|
||||
#include "mainloop.h"
|
||||
#include "shutdown.h"
|
||||
#include "_globals.h"
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Globals
|
||||
//----------------------------------------------------------------------------
|
||||
extern "C"
|
||||
{
|
||||
HWND hWndMain;
|
||||
bool WIN_fullscreen = true;
|
||||
|
||||
//PORT130 SRBOOL SRCALL WIN_resize(SRLONG width, SRLONG height);
|
||||
//PORT130 SRBOOL SRCALL WIN_set_fullscreen(SRBOOL state);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Local functions
|
||||
//----------------------------------------------------------------------------
|
||||
static BOOL Create_Main_Window(HANDLE hInstance, int nCmdShow);
|
||||
long FAR PASCAL Main_Window_Proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
void Focus_Loss(void);
|
||||
void Focus_Restore(void);
|
||||
void Split_Command_Line_Args(HINSTANCE instance, char *path_to_exe, char *command_line);
|
||||
void Set_Working_Directory(char *old_path, char *new_path);
|
||||
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* WinMain -- Win32 Program Entry Point! *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* Standard WinMain inputs :-) *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* Standard WinMain output *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 07/18/1997 GH : Created. *
|
||||
*=============================================================================================*/
|
||||
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
|
||||
{
|
||||
LPSTR command;
|
||||
HANDLE prev;
|
||||
char path_to_exe[_MAX_PATH];
|
||||
char oldpath[_MAX_PATH];
|
||||
|
||||
command = lpCmdLine;
|
||||
prev = hPrevInstance;
|
||||
|
||||
if (!Create_Main_Window(hInstance, nCmdShow)) return 0;
|
||||
|
||||
// Setup the keyboard system
|
||||
Keyboard = new WWKeyboardClass();
|
||||
|
||||
// Setup the mouse system and take over the mouse.
|
||||
MouseCursor = new WWMouseClass(NULL, MainWindow);
|
||||
|
||||
Split_Command_Line_Args(hInstance, &path_to_exe[0], lpCmdLine);
|
||||
Set_Working_Directory(oldpath, &path_to_exe[0]);
|
||||
|
||||
Init();
|
||||
|
||||
Main_Loop();
|
||||
|
||||
Shutdown();
|
||||
|
||||
delete Keyboard;
|
||||
delete MouseCursor;
|
||||
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/***********************************************************************************************
|
||||
* WIN_resize -- Surrender-required function which resizes the main window *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* width -- desired new width *
|
||||
* height -- desired new height *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* SRTRUE = success SRFALSE = error *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 07/18/1997 GH : Created. *
|
||||
*=============================================================================================*/
|
||||
#ifdef PORT130
|
||||
SRBOOL SRCALL WIN_resize( SRLONG width, SRLONG height )
|
||||
{
|
||||
RECT rc;
|
||||
RECT rcWork;
|
||||
SRLONG xp,yp;
|
||||
|
||||
SetRect( &rc, 0,0, width,height);
|
||||
AdjustWindowRectEx( &rc, GetWindowStyle(hWndMain),
|
||||
GetMenu(hWndMain)!=NULL,
|
||||
GetWindowExStyle(hWndMain));
|
||||
|
||||
xp = (GetSystemMetrics(SM_CXSCREEN) - (rc.right-rc.left))/2;
|
||||
yp = (GetSystemMetrics(SM_CYSCREEN) - (rc.bottom-rc.top))/2;
|
||||
|
||||
SetWindowPos( hWndMain, HWND_NOTOPMOST, xp, yp, rc.right-rc.left, rc.bottom-rc.top,
|
||||
SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
|
||||
// make sure the window does not hang outside work area
|
||||
SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWork, 0);
|
||||
GetWindowRect(hWndMain, &rc);
|
||||
|
||||
if (rc.left < rcWork.left) rc.left = rcWork.left;
|
||||
if (rc.top < rcWork.top) rc.top = rcWork.top;
|
||||
|
||||
SetWindowPos( hWndMain, NULL, rc.left, rc.top, 0, 0,
|
||||
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
|
||||
UpdateWindow( hWndMain);
|
||||
|
||||
return SRTRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************
|
||||
* WIN_set_fullscreen -- Surrender-required function for toggling full-screen mode *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* state -- if SRTRUE, go into fullscreen mode, else go to windowed mode *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* SRTRUE = sucess SRFALSE = failure *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 07/18/1997 GH : Created. *
|
||||
*=============================================================================================*/
|
||||
#ifdef PORT130
|
||||
SRBOOL SRCALL WIN_set_fullscreen( SRBOOL state )
|
||||
{
|
||||
DWORD dwStyle;
|
||||
|
||||
if (state == SRFALSE) {
|
||||
|
||||
// change window style to popup
|
||||
dwStyle = GetWindowStyle( hWndMain);
|
||||
dwStyle |= WS_POPUP;
|
||||
dwStyle |= WS_OVERLAPPED | WS_CAPTION | WS_MINIMIZEBOX;
|
||||
SetWindowLong( hWndMain, GWL_STYLE, dwStyle);
|
||||
|
||||
} else {
|
||||
|
||||
// change window style to exclusive
|
||||
dwStyle = GetWindowStyle( hWndMain);
|
||||
dwStyle |= WS_POPUP | WS_VISIBLE;
|
||||
dwStyle &= ~(WS_OVERLAPPED | WS_CAPTION | WS_MINIMIZEBOX);
|
||||
SetWindowLong( hWndMain, GWL_STYLE, dwStyle);
|
||||
}
|
||||
|
||||
// set state flag accordingly
|
||||
WIN_fullscreen = state;
|
||||
|
||||
return SRTRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************
|
||||
* Main_Window_Proc -- Windows Proc for the main game window *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* Standard Windows Proc inputs *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* Standard Windows Proc output *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 07/18/1997 GH : Created. *
|
||||
*=============================================================================================*/
|
||||
long FAR PASCAL Main_Window_Proc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc;
|
||||
|
||||
/*
|
||||
** Pass this message through to the keyboard handler. If the message
|
||||
** was processed and requires no further action, then return with
|
||||
** this information.
|
||||
*/
|
||||
// if (Keyboard && Keyboard->Message_Handler(hwnd, message, wParam, lParam)) {
|
||||
// return(1);
|
||||
// }
|
||||
if (Keyboard) {
|
||||
Keyboard->Message_Handler(hwnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
switch (message )
|
||||
{
|
||||
/*
|
||||
** basic management messages
|
||||
*/
|
||||
case WM_ACTIVATEAPP:
|
||||
|
||||
if (WIN_fullscreen) {
|
||||
|
||||
GameInFocus = (wParam != 0);
|
||||
if (!GameInFocus) {
|
||||
Focus_Loss();
|
||||
} else {
|
||||
Focus_Restore();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
GameInFocus = true;
|
||||
if (wParam != 0) {
|
||||
if (MouseCursor != NULL) MouseCursor->Capture_Mouse();
|
||||
} else {
|
||||
if (MouseCursor != NULL) MouseCursor->Release_Mouse();
|
||||
}
|
||||
|
||||
}
|
||||
return(0);
|
||||
|
||||
case WM_SETCURSOR:
|
||||
SetCursor(NULL);
|
||||
return 1;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
return 1;
|
||||
|
||||
case WM_PAINT:
|
||||
hdc = BeginPaint( hwnd, &ps);
|
||||
EndPaint( hwnd, &ps);
|
||||
return 1;
|
||||
|
||||
/*
|
||||
** minimize/maximize
|
||||
*/
|
||||
case WM_SYSKEYDOWN:
|
||||
|
||||
if (wParam == VK_RETURN && ((lParam>>16) & KF_ALTDOWN) && !((lParam>>16) & KF_REPEAT))
|
||||
{
|
||||
WIN_fullscreen = !WIN_fullscreen;
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
** interface open and close
|
||||
*/
|
||||
case WM_CREATE:
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
ReleaseCapture();
|
||||
PostQuitMessage( 0);
|
||||
break;
|
||||
|
||||
case WM_SYSCOMMAND:
|
||||
switch (wParam) {
|
||||
|
||||
case SC_CLOSE:
|
||||
/*
|
||||
** Windows sent us a close message. Probably in response to Alt-F4. Ignore it by
|
||||
** pretending to handle the message and returning true;
|
||||
*/
|
||||
return (0);
|
||||
|
||||
case SC_SCREENSAVE:
|
||||
/*
|
||||
** Windoze is about to start the screen saver. If we just return without passing
|
||||
** this message to DefWindowProc then the screen saver will not be allowed to start.
|
||||
*/
|
||||
return (0);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* Create_Main_Window -- Creates the main game window *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* hInstance -- Instance handle of the application *
|
||||
* nCmdShow -- how the window is to be shown *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* TRUE = success, FALSE = failure *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 07/18/1997 GH : Created. *
|
||||
*=============================================================================================*/
|
||||
static BOOL Create_Main_Window(HANDLE hInstance, int nCmdShow)
|
||||
{
|
||||
WNDCLASS wc;
|
||||
BOOL rc;
|
||||
|
||||
ProgramInstance = hInstance;
|
||||
|
||||
wc.style = CS_DBLCLKS;
|
||||
wc.lpfnWndProc = Main_Window_Proc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = LoadIcon( NULL, IDI_APPLICATION);
|
||||
wc.hCursor = LoadCursor( NULL, IDC_ARROW);
|
||||
wc.hbrBackground = GetStockObject( BLACK_BRUSH);
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = "SRCLASS";
|
||||
|
||||
rc = RegisterClass( &wc);
|
||||
if (!rc ) return FALSE;
|
||||
|
||||
MainWindow = hWndMain = CreateWindowEx(
|
||||
0, // WS_EX_TOPMOST,
|
||||
"SRClass",
|
||||
"Commando",
|
||||
WS_VISIBLE | // so we don't have to call ShowWindow
|
||||
WS_POPUP | // non-app window
|
||||
WS_SYSMENU, // so we get an icon in the tray
|
||||
0, 0, // top left corner
|
||||
GetSystemMetrics(SM_CXSCREEN), // bottom right corner
|
||||
GetSystemMetrics(SM_CYSCREEN),
|
||||
NULL, // no parent handle
|
||||
NULL, // no menu handle
|
||||
ProgramInstance, // main program instance
|
||||
NULL); // creation parameters
|
||||
|
||||
if (!hWndMain) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* Focus_Loss -- this function is called when the application loses focus *
|
||||
* *
|
||||
* INPUT: Nothing *
|
||||
* *
|
||||
* OUTPUT: Nothing *
|
||||
* *
|
||||
* WARNINGS: None *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 07/18/1997 GH : Created. *
|
||||
*=============================================================================================*/
|
||||
void Focus_Loss(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* Focus_Restore -- This function is called when the application gets focus *
|
||||
* *
|
||||
* INPUT: Nothing *
|
||||
* *
|
||||
* OUTPUT: Nothing *
|
||||
* *
|
||||
* WARNINGS: None *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 07/18/1997 GH : Created. *
|
||||
*=============================================================================================*/
|
||||
void Focus_Restore(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void Prog_End(void)
|
||||
{
|
||||
// Sound_End();
|
||||
MouseCursor->Release_Mouse();
|
||||
delete MouseCursor;
|
||||
MouseCursor = NULL;
|
||||
}
|
||||
|
||||
|
||||
void Split_Command_Line_Args(HINSTANCE instance, char *path_to_exe, char *command_line)
|
||||
{
|
||||
// first arguement is the path to the executable including file name
|
||||
GetModuleFileName (instance, &path_to_exe[0], 132);
|
||||
Argv[0] = path_to_exe;
|
||||
|
||||
char * token = strtok(command_line, " ");
|
||||
Argc = 1;
|
||||
while (Argc < ARRAY_SIZE(Argv) && token != NULL) {
|
||||
Argv[Argc++] = token;
|
||||
token = strtok(NULL, " ");
|
||||
}
|
||||
}
|
||||
|
||||
void Set_Working_Directory(char *old_path, char *new_path)
|
||||
{
|
||||
char drive[_MAX_DRIVE];
|
||||
char path[_MAX_PATH];
|
||||
char dir[_MAX_DIR];
|
||||
/*
|
||||
** Remember the current working directory and drive.
|
||||
*/
|
||||
GetCurrentDirectory(_MAX_PATH, old_path);
|
||||
|
||||
/*
|
||||
** Change directory to the where the executable is located. Handle the
|
||||
** case where there is no path attached to argv[0].
|
||||
*/
|
||||
_splitpath(new_path, drive, dir, NULL, NULL);
|
||||
_makepath(path, drive, dir, NULL, NULL);
|
||||
SetCurrentDirectory(path);
|
||||
}
|
||||
|
||||
46
Code/Tests/movietest/WINMAIN.H
Normal file
46
Code/Tests/movietest/WINMAIN.H
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef WINMAIN_H
|
||||
#define WINMAIN_H
|
||||
|
||||
#ifndef ALWAYS_H
|
||||
#include "always.h"
|
||||
#endif
|
||||
|
||||
#ifndef WIN_H
|
||||
#include "win.h"
|
||||
#endif
|
||||
|
||||
#include <sr.hpp>
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
extern HWND hWndMain;
|
||||
|
||||
extern bool WIN_fullscreen;
|
||||
|
||||
#ifdef PORT130
|
||||
SRBOOL SRCALL WIN_resize(SRLONG width, SRLONG height);
|
||||
SRBOOL SRCALL WIN_set_fullscreen(SRBOOL state);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
50
Code/Tests/movietest/_GLOBALS.CPP
Normal file
50
Code/Tests/movietest/_GLOBALS.CPP
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Header: /Commando/Code/Tests/movietest/_GLOBALS.CPP 2 3/21/98 12:08p Greg_h $ */
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : Commando *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tests/movietest/_GLOBALS.CPP $*
|
||||
* *
|
||||
* $Author:: Greg_h $*
|
||||
* *
|
||||
* $Modtime:: 2/27/98 10:57a $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
#include "_globals.h"
|
||||
|
||||
bool GameInFocus;
|
||||
Mouse * MouseCursor = NULL;
|
||||
WWKeyboardClass * Keyboard = NULL;
|
||||
SystemTimerClass SystemTimer;
|
||||
|
||||
int Argc;
|
||||
char * Argv[20];
|
||||
|
||||
|
||||
|
||||
79
Code/Tests/movietest/_GLOBALS.H
Normal file
79
Code/Tests/movietest/_GLOBALS.H
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Header: /Commando/Code/Tests/movietest/_GLOBALS.H 2 3/21/98 12:08p Greg_h $ */
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : Commando *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tests/movietest/_GLOBALS.H $*
|
||||
* *
|
||||
* $Author:: Greg_h $*
|
||||
* *
|
||||
* $Modtime:: 2/27/98 10:57a $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef _GLOBALS_H
|
||||
#define _GLOBALS_H
|
||||
|
||||
#ifndef ALWAYS_H
|
||||
#include "always.h"
|
||||
#endif
|
||||
|
||||
#ifndef KEYBOARD_H
|
||||
#include "keyboard.h"
|
||||
#endif
|
||||
|
||||
#ifndef XMOUSE_H
|
||||
#include "xmouse.h"
|
||||
#endif
|
||||
|
||||
#ifndef STIMER_H
|
||||
#include "stimer.h"
|
||||
#endif
|
||||
|
||||
#ifndef WORLD_H
|
||||
#include "world.h"
|
||||
#endif
|
||||
|
||||
extern bool GameInFocus;
|
||||
extern Mouse * MouseCursor;
|
||||
extern WWKeyboardClass * Keyboard;
|
||||
|
||||
extern int Argc;
|
||||
extern char * Argv[20];
|
||||
|
||||
|
||||
#if 0
|
||||
// 60 Hz Timer
|
||||
extern SystemTimerClass SystemTimer;
|
||||
#define SYSTEM_TIMER_RATE TIMER_SECOND
|
||||
#else
|
||||
// 1 KHz Timer
|
||||
#define SystemTimer() (int)timeGetTime()
|
||||
#define SYSTEM_TIMER_RATE 1000
|
||||
#endif
|
||||
|
||||
#endif
|
||||
67
Code/Tests/movietest/_viewpt.cpp
Normal file
67
Code/Tests/movietest/_viewpt.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Header: /Commando/Code/Tests/movietest/_viewpt.cpp 2 3/21/98 12:08p Greg_h $ */
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : Commando *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tests/movietest/_viewpt.cpp $*
|
||||
* *
|
||||
* $Author:: Greg_h $*
|
||||
* *
|
||||
* $Modtime:: 2/27/98 10:57a $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
#include "_viewpt.h"
|
||||
|
||||
|
||||
/*
|
||||
** Current resolution of the screen / game window.
|
||||
** (only the Width and Height fields are valid...)
|
||||
*/
|
||||
Rect ScreenResolution;
|
||||
|
||||
/*
|
||||
** Rectangle within main window for the main viewport
|
||||
*/
|
||||
Rect MainViewport;
|
||||
|
||||
/*
|
||||
** Rectangle within the main window for the status bar
|
||||
*/
|
||||
Rect StatusViewport;
|
||||
|
||||
/*
|
||||
** Rectangle within the main window for the radar / map
|
||||
*/
|
||||
Rect RadarViewport;
|
||||
|
||||
/*
|
||||
** Rectangle within the main window for the PIP viewport
|
||||
*/
|
||||
Rect PIPViewport;
|
||||
|
||||
72
Code/Tests/movietest/_viewpt.h
Normal file
72
Code/Tests/movietest/_viewpt.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Header: /Commando/Code/Tests/movietest/_viewpt.h 2 3/21/98 12:08p Greg_h $ */
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : Commando *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tests/movietest/_viewpt.h $*
|
||||
* *
|
||||
* $Author:: Greg_h $*
|
||||
* *
|
||||
* $Modtime:: 2/27/98 10:57a $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
#ifndef _VIEWPT_H
|
||||
#define _VIEWPT_H
|
||||
|
||||
#ifndef RECT_H
|
||||
#include "rect.h"
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** Current resolution of the screen / game window.
|
||||
*/
|
||||
extern Rect ScreenResolution;
|
||||
|
||||
/*
|
||||
** Rectangle within main window for the main viewport
|
||||
*/
|
||||
extern Rect MainViewport;
|
||||
|
||||
/*
|
||||
** Rectangle within the main window for the status bar
|
||||
*/
|
||||
extern Rect StatusViewport;
|
||||
|
||||
/*
|
||||
** Rectangle within the main window for the radar / map
|
||||
*/
|
||||
extern Rect RadarViewport;
|
||||
|
||||
/*
|
||||
** Rectangle within the main window for the PIP viewport
|
||||
*/
|
||||
extern Rect PIPViewport;
|
||||
|
||||
#endif
|
||||
41
Code/Tests/movietest/_world.cpp
Normal file
41
Code/Tests/movietest/_world.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : Mesh Test *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tests/movietest/_world.cpp $*
|
||||
* *
|
||||
* $Author:: Greg_h $*
|
||||
* *
|
||||
* $Modtime:: 3/23/98 9:43a $*
|
||||
* *
|
||||
* $Revision:: 3 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
#include "_world.h"
|
||||
|
||||
//WorldClass TheWorld;
|
||||
SimpleSceneClass * TheScene;
|
||||
50
Code/Tests/movietest/_world.h
Normal file
50
Code/Tests/movietest/_world.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : Mesh Test *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tests/movietest/_world.h $*
|
||||
* *
|
||||
* $Author:: Greg_h $*
|
||||
* *
|
||||
* $Modtime:: 3/24/98 10:42a $*
|
||||
* *
|
||||
* $Revision:: 4 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
#ifndef _WORLD_H
|
||||
#define _WORLD_H
|
||||
|
||||
#ifndef SCENE_H
|
||||
#include "scene.h"
|
||||
#endif
|
||||
|
||||
|
||||
//extern WorldClass TheWorld;
|
||||
extern SimpleSceneClass * TheScene;
|
||||
|
||||
|
||||
#endif
|
||||
98
Code/Tests/movietest/init.cpp
Normal file
98
Code/Tests/movietest/init.cpp
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Header: /Commando/Code/Tests/movietest/init.cpp 4 5/06/98 3:10p Greg_h $ */
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : Commando *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tests/movietest/init.cpp $*
|
||||
* *
|
||||
* $Author:: Greg_h $*
|
||||
* *
|
||||
* $Modtime:: 3/24/98 10:43a $*
|
||||
* *
|
||||
* $Revision:: 4 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
#include "init.h"
|
||||
#include <sr.hpp>
|
||||
#include "_viewpt.h"
|
||||
#include "_world.h"
|
||||
#include "winmain.h"
|
||||
#include "ww3d.h"
|
||||
|
||||
bool Init(void)
|
||||
{
|
||||
|
||||
ScreenResolution.X = 0;
|
||||
ScreenResolution.Y = 0;
|
||||
ScreenResolution.Width = 640;
|
||||
ScreenResolution.Height = 480;
|
||||
|
||||
MainViewport.X = 16;
|
||||
MainViewport.Y = 16;
|
||||
MainViewport.Width = 640-32;
|
||||
MainViewport.Height = 480-32;
|
||||
|
||||
WW3D::Init(hWndMain);
|
||||
WW3D::Set_Resolution(ScreenResolution.Width,ScreenResolution.Height,16,false);
|
||||
|
||||
const DynamicVectorClass<RenderDeviceDescClass> & RDDescriptions = WW3D::Enumerate_Render_Devices();
|
||||
|
||||
char buf[1024];
|
||||
char tmp[64];
|
||||
char title[64];
|
||||
|
||||
for (int ri=0; ri<RDDescriptions.Count(); ri++) {
|
||||
|
||||
sprintf(title,"Render Device: %d",ri);
|
||||
buf[0] = 0;
|
||||
sprintf(tmp,"Device Name: %s\n",RDDescriptions[ri].Get_Device_Name());
|
||||
strcat(buf,tmp);
|
||||
sprintf(tmp,"Device Vendor: %s\n",RDDescriptions[ri].Get_Device_Vendor());
|
||||
strcat(buf,tmp);
|
||||
sprintf(tmp,"Device Platform: %s\n",RDDescriptions[ri].Get_Device_Platform());
|
||||
strcat(buf,tmp);
|
||||
|
||||
sprintf(tmp,"Driver Name: %s\n",RDDescriptions[ri].Get_Driver_Name());
|
||||
strcat(buf,tmp);
|
||||
sprintf(tmp,"Driver Vendor: %s\n",RDDescriptions[ri].Get_Driver_Vendor());
|
||||
strcat(buf,tmp);
|
||||
sprintf(tmp,"Driver Version: %s\n",RDDescriptions[ri].Get_Driver_Version());
|
||||
strcat(buf,tmp);
|
||||
|
||||
sprintf(tmp,"Hardware Name: %s\n",RDDescriptions[ri].Get_Hardware_Name());
|
||||
strcat(buf,tmp);
|
||||
sprintf(tmp,"Hardware Vendor: %s\n",RDDescriptions[ri].Get_Hardware_Vendor());
|
||||
strcat(buf,tmp);
|
||||
sprintf(tmp,"Hardware Chipset: %s\n",RDDescriptions[ri].Get_Hardware_Chipset());
|
||||
strcat(buf,tmp);
|
||||
|
||||
MessageBox(NULL,buf,title,MB_OK);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
43
Code/Tests/movietest/init.h
Normal file
43
Code/Tests/movietest/init.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Header: /Commando/Code/Tests/movietest/init.h 2 3/21/98 12:08p Greg_h $ */
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : Commando *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tests/movietest/init.h $*
|
||||
* *
|
||||
* $Author:: Greg_h $*
|
||||
* *
|
||||
* $Modtime:: 2/27/98 10:57a $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef INIT_H
|
||||
#define INIT_H
|
||||
|
||||
bool Init(void);
|
||||
|
||||
#endif
|
||||
364
Code/Tests/movietest/mainloop.cpp
Normal file
364
Code/Tests/movietest/mainloop.cpp
Normal file
@@ -0,0 +1,364 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Header: /Commando/Code/Tests/movietest/mainloop.cpp 4 5/06/98 3:10p Greg_h $ */
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : Commando *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tests/movietest/mainloop.cpp $*
|
||||
* *
|
||||
* $Author:: Greg_h $*
|
||||
* *
|
||||
* $Modtime:: 3/24/98 10:44a $*
|
||||
* *
|
||||
* $Revision:: 4 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
#include "mainloop.h"
|
||||
#include "mono.h"
|
||||
#include "msgloop.h"
|
||||
#include "wwfile.h"
|
||||
#include "rawfile.h"
|
||||
#include "_globals.h"
|
||||
#include "_viewpt.h"
|
||||
#include <sr.hpp>
|
||||
#include <assert.h>
|
||||
#include "assetmgr.h"
|
||||
#include "sr_util.h"
|
||||
#include "dynamesh.h"
|
||||
#include "material.h"
|
||||
#include "world.h"
|
||||
#include "_world.h"
|
||||
#include "rendobj.h"
|
||||
#include "r2dobj.h"
|
||||
#include "r3dobj.h"
|
||||
#include "mesh.h"
|
||||
#include "hmodel.h"
|
||||
#include "light.h"
|
||||
#include "wwdebug.h"
|
||||
#include "ww3d.h"
|
||||
|
||||
|
||||
/*
|
||||
** Globals
|
||||
*/
|
||||
|
||||
WW3DAssetManager The3DAssetManager;
|
||||
|
||||
CameraClass * Camera;
|
||||
MeshClass * Mesh;
|
||||
LightClass * Light;
|
||||
LightClass * Light2;
|
||||
|
||||
HModelClass * TestModel = NULL;
|
||||
HAnimClass * TestAnim = NULL;
|
||||
HAnimClass * CameraAnim = NULL;
|
||||
|
||||
Quaternion ViewOrientation(1);
|
||||
Quaternion ViewMotion(1);
|
||||
Vector3 ViewCenter(0,0,0);
|
||||
float ViewDist = 55.0f;
|
||||
|
||||
/*
|
||||
** Local functions
|
||||
*/
|
||||
|
||||
void Render(void);
|
||||
void Create_Scene(void);
|
||||
void Create_Objects(void);
|
||||
void Destroy_Scene(void);
|
||||
void Destroy_Objects(void);
|
||||
void Load_Data(void);
|
||||
void Render_Scene(void);
|
||||
void Time_Step(void);
|
||||
void Init_Debug(void);
|
||||
void Shutdown_Debug(void);
|
||||
void wwdebug_message_handler(const char * message);
|
||||
void wwdebug_assert_handler(const char * message);
|
||||
bool wwdebug_trigger_handler(int trigger_num);
|
||||
void Debug_Refs(void);
|
||||
|
||||
|
||||
/*
|
||||
** delay for time milliseconds
|
||||
*/
|
||||
void Wait( int time )
|
||||
{
|
||||
int start = SystemTimer();
|
||||
while ( 1000 * ( SystemTimer() - start ) < ( time * SYSTEM_TIMER_RATE ) ) ;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** MAIN GAME LOOP
|
||||
*/
|
||||
void Main_Loop(void)
|
||||
{
|
||||
Init_Debug();
|
||||
Create_Scene();
|
||||
Load_Data();
|
||||
Create_Objects();
|
||||
|
||||
while (!Keyboard->Down(VK_ESCAPE)) {
|
||||
|
||||
Time_Step();
|
||||
Render();
|
||||
Windows_Message_Handler();
|
||||
|
||||
// if (Keyboard->Down(VK_F1)) {
|
||||
// while(Keyboard->Down(VK_F1));
|
||||
// TheWorld.Next_Render_Device();
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
Destroy_Objects();
|
||||
WW3DAssetManager::Get_Instance()->Free_Assets();
|
||||
Destroy_Scene();
|
||||
Shutdown_Debug();
|
||||
Debug_Refs();
|
||||
}
|
||||
|
||||
void Render(void)
|
||||
{
|
||||
WW3D::Begin_Render(true,Vector3(0,0,0.5));
|
||||
WW3D::Render(TheScene,Camera);
|
||||
WW3D::End_Render();
|
||||
}
|
||||
|
||||
void Create_Scene(void)
|
||||
{
|
||||
// TheWorld.Init_Scene(ScreenResolution,8,1);
|
||||
TheScene = new SimpleSceneClass;
|
||||
}
|
||||
|
||||
/*
|
||||
** Load initial game data
|
||||
*/
|
||||
void Load_Data(void)
|
||||
{
|
||||
WW3DAssetManager::Get_Instance()->Load_3D_Assets(RawFileClass("CAMERA.W3D"));
|
||||
WW3DAssetManager::Get_Instance()->Load_3D_Assets(RawFileClass("MOVIE.W3D"));
|
||||
}
|
||||
|
||||
/*
|
||||
**
|
||||
*/
|
||||
void Create_Objects(void)
|
||||
{
|
||||
Camera = new CameraClass("CAMERA");
|
||||
// TheWorld.Set_Camera(Camera);
|
||||
// Camera->Set_Depth(5000.0f);
|
||||
// Camera->Set_Clip_Planes(1.0f,5000.0f);
|
||||
Camera->Set_Focal_Length(0.060f);
|
||||
Camera->Set_Viewport(Vector2(0.3,0.3),Vector2(0.5,0.5));
|
||||
|
||||
CameraAnim = WW3DAssetManager::Get_Instance()->Get_HAnim("Camera.Camera");
|
||||
TestModel = WW3DAssetManager::Get_Instance()->Create_HModel("Movie");
|
||||
assert(TestModel);
|
||||
TestAnim = WW3DAssetManager::Get_Instance()->Get_HAnim("Movie.Movie");
|
||||
// TestModel->Add(&TheWorld);
|
||||
TestModel->Add(TheScene);
|
||||
|
||||
Light = new LightClass();
|
||||
Light->Set_Transform(Matrix3D(1));
|
||||
// Light->Add(&TheWorld);
|
||||
Light->Add(TheScene);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
**
|
||||
*/
|
||||
void Destroy_Scene(void)
|
||||
{
|
||||
// TheWorld.Set_Camera(NULL);
|
||||
// TheWorld.Shutdown_Scene();
|
||||
delete TheScene;
|
||||
TheScene = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
**
|
||||
*/
|
||||
void Destroy_Objects(void)
|
||||
{
|
||||
if (Mesh) {
|
||||
Mesh->Release_Ref();
|
||||
Mesh = NULL;
|
||||
}
|
||||
|
||||
if (TestModel) {
|
||||
TestModel->Remove();
|
||||
TestModel->Release_Ref();
|
||||
TestModel = NULL;
|
||||
}
|
||||
|
||||
if (Camera) {
|
||||
Camera->Release_Ref();
|
||||
Camera = NULL;
|
||||
}
|
||||
|
||||
if (Light) {
|
||||
Light->Remove();
|
||||
Light->Release_Ref();
|
||||
Light = NULL;
|
||||
}
|
||||
|
||||
if (Light2) {
|
||||
Light2->Remove();
|
||||
Light2->Release_Ref();
|
||||
Light2 = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Time_Step(void)
|
||||
{
|
||||
static int _frame = 0;
|
||||
static int _camframe = 0;
|
||||
static float _t = 0.0f;
|
||||
static float _dt = 0.01f;
|
||||
|
||||
_t += _dt;
|
||||
if (_t > 1.0f) {
|
||||
_t = 1.0f;
|
||||
_dt = -0.01f;
|
||||
}
|
||||
if (_t < 0.0f) {
|
||||
_t = 0.0f;
|
||||
_dt = 0.01f;
|
||||
}
|
||||
|
||||
if (Mesh) {
|
||||
Mesh->Apply_Damage(0,_t);
|
||||
}
|
||||
|
||||
if (TestAnim) {
|
||||
_frame++;
|
||||
if (_frame >= TestAnim->Get_Num_Frames()) {
|
||||
_frame = 0;
|
||||
}
|
||||
|
||||
TestModel->Set_Transform(Matrix3D(1));
|
||||
TestModel->Set_Animation(TestAnim,_frame);
|
||||
} else {
|
||||
TestModel->Set_Transform(Matrix3D(1));
|
||||
TestModel->Set_Animation();
|
||||
}
|
||||
|
||||
if (CameraAnim) {
|
||||
_camframe++;
|
||||
if (_camframe >= CameraAnim->Get_Num_Frames()) {
|
||||
_camframe = 0;
|
||||
}
|
||||
|
||||
Camera->Set_Transform(Matrix3D(1));
|
||||
Camera->Set_Animation(CameraAnim,_camframe);
|
||||
} else {
|
||||
Matrix3D cam(1);
|
||||
cam.Translate(ViewCenter);
|
||||
cam = cam * Build_Matrix3D(ViewOrientation);
|
||||
cam.Translate(Vector3(0,0,ViewDist));
|
||||
Camera->Set_Transform(cam);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Init_Debug(void)
|
||||
{
|
||||
/*
|
||||
** Install message handler functions for the WWDebug messages
|
||||
** and assertion failures.
|
||||
*/
|
||||
WWDebug_Install_Message_Handler(wwdebug_message_handler);
|
||||
WWDebug_Install_Assert_Handler(wwdebug_assert_handler);
|
||||
WWDebug_Install_Trigger_Handler(wwdebug_trigger_handler);
|
||||
|
||||
}
|
||||
|
||||
void Shutdown_Debug(void)
|
||||
{
|
||||
/*
|
||||
** Remove message handler functions for the WWDebug messages
|
||||
** and assertion failures.
|
||||
*/
|
||||
WWDebug_Install_Message_Handler(NULL);
|
||||
WWDebug_Install_Assert_Handler(NULL);
|
||||
WWDebug_Install_Trigger_Handler(NULL);
|
||||
}
|
||||
|
||||
void wwdebug_message_handler(const char * message)
|
||||
{
|
||||
/*
|
||||
** Hand the message off to the scrolling debug screen
|
||||
*/
|
||||
// Debug_Say((message));
|
||||
}
|
||||
|
||||
void wwdebug_assert_handler(const char * message)
|
||||
{
|
||||
/*
|
||||
** Hand the message off to the scrolling debug screen
|
||||
*/
|
||||
// Debug_Say((message));
|
||||
|
||||
/*
|
||||
** break into the debugger
|
||||
*/
|
||||
_asm int 0x03;
|
||||
}
|
||||
|
||||
bool wwdebug_trigger_handler(int trigger_num)
|
||||
{
|
||||
return Keyboard->Down(trigger_num);
|
||||
}
|
||||
|
||||
void Debug_Refs(void)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
char buf[1024];
|
||||
|
||||
if (RefCountClass::Total_Refs() > 0) {
|
||||
sprintf(buf,"Main Looop End %d refs\n", RefCountClass::Total_Refs());
|
||||
MessageBox(NULL,buf,"Ref Debugging",MB_OK);
|
||||
}
|
||||
|
||||
SList<ActiveRefStruct> * reflist = RefCountClass::Get_Active_Ref_List();
|
||||
|
||||
SLNode<ActiveRefStruct> * objnode;
|
||||
|
||||
for ( objnode = reflist->Head(); objnode; objnode = objnode->Next()) {
|
||||
|
||||
ActiveRefStruct * ref = objnode->Data();
|
||||
|
||||
sprintf(buf,"Active Ref: %s Line: %d Pointer: %p\n", ref->File,ref->Line,ref->Object);
|
||||
if (MessageBox(NULL,buf,"Ref Debugging",MB_OKCANCEL) == IDCANCEL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
43
Code/Tests/movietest/mainloop.h
Normal file
43
Code/Tests/movietest/mainloop.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Header: /Commando/Code/Tests/movietest/mainloop.h 2 3/21/98 12:08p Greg_h $ */
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : Commando *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tests/movietest/mainloop.h $*
|
||||
* *
|
||||
* $Author:: Greg_h $*
|
||||
* *
|
||||
* $Modtime:: 2/27/98 10:57a $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef MAINLOOP_H
|
||||
#define MAINLOOP_H
|
||||
|
||||
void Main_Loop(void);
|
||||
|
||||
#endif
|
||||
158
Code/Tests/movietest/movietest.dsp
Normal file
158
Code/Tests/movietest/movietest.dsp
Normal file
@@ -0,0 +1,158 @@
|
||||
# Microsoft Developer Studio Project File - Name="movietest" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 5.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=movietest - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "movietest.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "movietest.mak" CFG="movietest - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "movietest - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "movietest - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP Scc_ProjName ""$/Commando/Code/Tests/movietest", TCOAAAAA"
|
||||
# PROP Scc_LocalPath "."
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "movietest - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\sr130\sr.h" /I "..\..\Library" /I "..\..\WWMath" /I "..\..\ww3d" /I "..\..\wwdebug" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib ddraw.lib winmm.lib library.lib wwmath.lib ww3d.lib sr.lib /nologo /subsystem:windows /machine:I386 /out:"Run/movietest.exe" /libpath:"..\..\libs\Release" /libpath:"..\..\sr130\release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "movietest - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\sr130\sr.h" /I "..\..\Library" /I "..\..\WWMath" /I "..\..\ww3d" /I "..\..\wwdebug" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib ddraw.lib winmm.lib library.lib wwmath.lib ww3d.lib srdb.lib /nologo /subsystem:windows /profile /map /debug /machine:I386 /out:"Run/movietest_d.exe" /libpath:"..\..\libs\Debug" /libpath:"..\..\sr130\debug"
|
||||
# Begin Special Build Tool
|
||||
SOURCE=$(InputPath)
|
||||
PostBuild_Cmds=copy debug\movietest.map run\
|
||||
# End Special Build Tool
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "movietest - Win32 Release"
|
||||
# Name "movietest - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp,c"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\_GLOBALS.CPP
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\_viewpt.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\_world.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\init.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mainloop.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shutdown.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\WINMAIN.CPP
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\_GLOBALS.H
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\_viewpt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\_world.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\init.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mainloop.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shutdown.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\WINMAIN.H
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
51
Code/Tests/movietest/shutdown.cpp
Normal file
51
Code/Tests/movietest/shutdown.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Header: /Commando/Code/Tests/movietest/shutdown.cpp 4 5/06/98 3:10p Greg_h $ */
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : Commando *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tests/movietest/shutdown.cpp $*
|
||||
* *
|
||||
* $Author:: Greg_h $*
|
||||
* *
|
||||
* $Modtime:: 3/24/98 10:44a $*
|
||||
* *
|
||||
* $Revision:: 4 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
#include "shutdown.h"
|
||||
#include "ww3d.h"
|
||||
|
||||
|
||||
void Shutdown(void)
|
||||
{
|
||||
#ifdef PORT130
|
||||
TheWorld.Shutdown();
|
||||
#else
|
||||
WW3D::Shutdown();
|
||||
#endif
|
||||
}
|
||||
|
||||
46
Code/Tests/movietest/shutdown.h
Normal file
46
Code/Tests/movietest/shutdown.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Header: /Commando/Code/Tests/movietest/shutdown.h 2 3/21/98 12:08p Greg_h $ */
|
||||
/***********************************************************************************************
|
||||
*** Confidential - Westwood Studios ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : Commando *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tests/movietest/shutdown.h $*
|
||||
* *
|
||||
* $Author:: Greg_h $*
|
||||
* *
|
||||
* $Modtime:: 2/27/98 10:57a $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
#ifndef SHUTDOWN_H
|
||||
#define SHUTDOWN_H
|
||||
|
||||
|
||||
void Shutdown(void);
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user