Initial commit of Command & Conquer Red Alert source code.

This commit is contained in:
LFeenanEA
2025-02-27 16:15:05 +00:00
parent b685cea758
commit 5e733d5dcc
2082 changed files with 797727 additions and 0 deletions

2053
WINVQ/VQAVIEW/DEBUG.CPP Normal file

File diff suppressed because it is too large Load Diff

67
WINVQ/VQAVIEW/DEBUG.RC Normal file
View File

@@ -0,0 +1,67 @@
/*
** Command & Conquer Red Alert(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 : Virtual Monopoly *
* *
* File Name : DEBUG.RC *
* *
* Programmer : Michael Legg *
* *
* Start Date : February 9, 1995 *
* *
* Last Update : May 30, 1995 [ML] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include "defines.h"
#include "debug.rh"
#if( RIG_ROLL_FOR_PLAYTEST )
DebugDiceDlgBox DIALOG 152, 52, 109, 85
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Deciding Next Roll..."
FONT 8, "MS Sans Serif"
{
PUSHBUTTON "Ready to roll...", IDOK, 18, 59, 72, 16
EDITTEXT DIE_EDIT1, 57, 15, 25, 12
EDITTEXT DIE_EDIT2, 57, 35, 25, 12
LTEXT "Bone #2", -1, 26, 36, 29, 8
LTEXT "Bone #1", -1, 26, 18, 29, 9
}
#endif
#if( DEBUG_CODE )
DebugSetCashDlgBox DIALOG 152, 52, 106, 64
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Set Player's Cash"
FONT 8, "MS Sans Serif"
{
DEFPUSHBUTTON "OK", IDOK, 31, 39, 43, 13
EDITTEXT CASH_EDIT1, 32, 15, 41, 12
}
#endif

48
WINVQ/VQAVIEW/DIALOGS.RC Normal file
View File

@@ -0,0 +1,48 @@
/*
** Command & Conquer Red Alert(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 : VQA VIEWER *
* *
* File Name : DIALOGS.RC *
* *
* Programmer : Mike Grayford *
* *
* Start Date : Dec 5, 1995 *
* *
* Last Update : Dec 5, 1995 [MG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include "windows.h"
#include "dialogs.rh"
GEEB DIALOG 152, 52, 106, 64
//STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
STYLE WS_POPUP
CAPTION "Hi"
{
DEFPUSHBUTTON "OK", IDOK, 31, 39, 43, 13
EDITTEXT FRAME_RATE, 32, 15, 41, 12
}

38
WINVQ/VQAVIEW/DIALOGS.RH Normal file
View File

@@ -0,0 +1,38 @@
/*
** Command & Conquer Red Alert(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 : VQA VIEWER *
* *
* File Name : DIALOGS.RH *
* *
* Programmer : Mike Grayford *
* *
* Start Date : Dec 5, 1995 *
* *
* Last Update : Dec 5, 1995 [MG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#define FRAME_RATE 100

115
WINVQ/VQAVIEW/GAMETIME.CPP Normal file
View File

@@ -0,0 +1,115 @@
/*
** Command & Conquer Red Alert(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 : VQAVIEW *
* *
* File Name : GAMETIME.CPP *
* *
* Programmer : Michael Grayford *
* *
* Start Date : *
* *
* Last Update : Nov 22, 1995 [MG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//==========================================================================
// INCLUDES
//==========================================================================
#include <windows.h>
#include <gametime.h>
//==========================================================================
// PUBLIC DATA
//==========================================================================
GameTimeClass Game_Time;
/***************************************************************************
* GameTimeClass - Constructor function for GameTimeClass *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 11/22/1995 MG : Created. *
*=========================================================================*/
GameTimeClass::GameTimeClass( void )
{
game_start_time = timeGetTime();
}
/***************************************************************************
* Get_Time - returns the time in ms elapsed since game was started *
* *
* INPUT: *
* *
* OUTPUT: *
* unsigned long - time in milliseconds since game was started *
* *
* WARNINGS: *
* *
* HISTORY: *
* 11/22/1995 MG : Created. *
*=========================================================================*/
unsigned long GameTimeClass::Get_Time( void )
{
unsigned long curr_windows_time;
unsigned long game_time;
curr_windows_time = timeGetTime();
if ( curr_windows_time <= game_start_time ) {
// Handles the case if the windows time wraps while playing the game.
game_time = MAX_ULONG - game_start_time + curr_windows_time;
}
else {
game_time = curr_windows_time - game_start_time;
}
return( game_time );
}
/***************************************************************************
* Get_Game_Time - returns the time in ms elapsed since game was started *
* *
* INPUT: *
* *
* OUTPUT: *
* unsigned long - time in milliseconds since game was started *
* *
* WARNINGS: *
* *
* HISTORY: *
* 11/22/1995 MG : Created. *
*=========================================================================*/
unsigned long Get_Game_Time( void )
{
return( Game_Time.Get_Time() );
}

71
WINVQ/VQAVIEW/GAMETIME.H Normal file
View File

@@ -0,0 +1,71 @@
/*
** Command & Conquer Red Alert(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 : VQAVIEW *
* *
* File Name : GAMETIME.H *
* *
* Programmer : Michael Grayford *
* *
* Start Date : *
* *
* Last Update : Nov 22, 1995 [MG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//==========================================================================
// PUBLIC FUNCTIONS
//==========================================================================
extern unsigned long Get_Game_Time();
//==========================================================================
// PUBLIC DEFINES
//==========================================================================
#define MAX_ULONG 0xFFFFFFFF
//==========================================================================
// CLASSES
//==========================================================================
class GameTimeClass {
private:
unsigned long game_start_time;
public:
GameTimeClass( void );
unsigned long Get_Time( void );
}; /* VQAClass */
//==========================================================================
// PUBLIC DATA
//==========================================================================
extern GameTimeClass Game_Time;

162
WINVQ/VQAVIEW/INTERPAL.ASM Normal file
View File

@@ -0,0 +1,162 @@
;
; Command & Conquer Red Alert(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 I N C **
;**********************************************************************************************
;* *
;* Project Name : VQA Viewer *
;* *
;* File Name : INTERPAL.ASM *
;* *
;* Programmer : Steve Tall *
;* *
;* Start Date : December 15th, 1995 *
;* *
;* Last Update : December 22nd, 1995 [ST] *
;* *
;*--------------------------------------------------------------------------------------------*
;* Functions: *
;* *
;* Asm_Interpolate -- interpolate a 320x200 buffer to a 640x400 screen *
;* *
;* *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
IDEAL
P386
MODEL USE32 FLAT
segment mycode page public use32 'code' ; Need stricter segment alignment
global C Asm_Interpolate:near
global C Palette_Interpolation_Table:byte
;*********************************************************************************************
;* Asm_Interpolate -- interpolate a 320x200 buffer to a 640x400 screen *
;* *
;* INPUT: ptr to source buffer (320x200 image) *
;* ptr to dest buffer (640x400) *
;* height of source buffer *
;* width f source buffer *
;* width of dest buffer *
;* *
;* *
;* OUTPUT: none *
;* *
;* Warnings: *
;* *
;* HISTORY: *
;* 12/15/95 ST : Created. *
;*===========================================================================================*
PROC Asm_Interpolate C near
ARG src_ptr:dword
ARG dest_ptr:dword
ARG source_height:dword
ARG source_width:dword
ARG dest_width:dword
LOCAL old_dest:dword
LOCAL width_counter:dword
pushad
mov eax,[dest_ptr]
mov [old_dest],eax
mov esi,[src_ptr]
??each_line_loop:
mov [width_counter],0
mov ecx,[source_width]
sub ecx,2
shr ecx,1
mov edi,[old_dest]
jmp ??interpolate_loop
align 32
;
; convert 2 pixels of source into 4 pixels of destination
; so we can write to video memory with dwords
;
??interpolate_loop:
mov eax,[esi]
lea esi,[esi+2]
mov edx,eax
mov ebx,eax
and edx,65535
ror ebx,8
mov bl,[edx+Palette_Interpolation_Table]
mov bh,ah
and eax,000ffff00h
ror ebx,8
;1st 3 pixels now in ebx
shr eax,8
mov bh,[eax+Palette_Interpolation_Table]
ror ebx,16
mov [edi],ebx
add edi,4
dec ecx
jnz ??interpolate_loop
; do the last three pixels and a blank on the end of a row
xor eax,eax
mov ax,[esi]
mov [edi],al
inc edi
lea esi,[esi+2]
mov al,[eax+Palette_Interpolation_Table]
mov [edi],al
inc edi
mov [edi],ah
inc edi
mov [byte edi],0
mov edi,[dest_width]
add [old_dest],edi
dec [source_height]
jnz ??each_line_loop
popad
ret
endp Asm_Interpolate
ends mycode
end

142
WINVQ/VQAVIEW/MAIN.CPP Normal file
View File

@@ -0,0 +1,142 @@
/*
** Command & Conquer Red Alert(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 : VQAVIEW *
* *
* File Name : MAIN.CPP *
* *
* Programmer : Mike Grayford *
* *
* Start Date : November 14, 1995 *
* *
* Last Update : November 20, 1995 [MG] *
* *
*--------------------------------------------------------------------------------------------*
* Functions: *
* WinMain -- Program entry point *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
//---------------------------------------------------------------------------------------------
// INCLUDES
//---------------------------------------------------------------------------------------------
#include <windows.h>
#include <windowsx.h>
#include <gbuffer.h>
#include <ddraw.h>
#include <file.h>
#include <wwmem.h>
#include <westwood.h>
#include <main.h>
#include <vidmode.h>
#include <mainwind.h>
#include <monochrm.h>
#include <movies.h>
extern void VQA_Test( char *filename );
//==========================================================================
// Public data
//==========================================================================
GraphicBufferClass *Screen_Buffer = NULL;
int ScreenWidth = VIDEO_MODE_WIDTH;
BOOL GameInFocus = TRUE;
void Block_Mouse(GraphicBufferClass*){}
void Unblock_Mouse(GraphicBufferClass*){}
/***********************************************************************************************
* WinMain -- Program entry point *
* *
* *
* *
* INPUT: Standard Windows startup parameters *
* *
* OUTPUT: wParam of the message queue *
* *
* WARNINGS: None *
* *
* HISTORY: *
* 11/15/95 1:28PM ST : Created *
*=============================================================================================*/
int WINAPI WinMain (
Handle instance_handle,
Handle prev_instance_handle,
String command_line_string,
int show_window_command )
{
if (!prev_instance_handle){
//
// If the program is already running, bail.
//
if ( prev_instance_handle ) {
return( 0 );
}
//
// Create the main window.
//
Main_Window.Create_Main_Window( instance_handle );
//
// Show the window.
//
Main_Window.Display_Window();
//
// Create the GraphicBufferClass that will be the screen buffer
//
Screen_Buffer = new GraphicBufferClass ( VIDEO_MODE_WIDTH, VIDEO_MODE_HEIGHT, (GBC_Enum)(GBC_VIDEOMEM | GBC_VISIBLE) );
//
// Initialize Movie system.
//
Initialize_Movie_System();
if (*command_line_string){
VQA_Test(command_line_string);
}else{
//
// Windows message loop
//
while ( Main_Window.Update_Windows_Messages() ) ;
}
//
// Free the Movie system.
//
Free_Movie_System();
return( Main_Window.Get_Message_Queue_wParam() );
}else{
return (-1);
}
}

49
WINVQ/VQAVIEW/MAIN.H Normal file
View File

@@ -0,0 +1,49 @@
/*
** Command & Conquer Red Alert(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 : VQAVIEW *
* *
* File Name : MAIN.H *
* *
* Programmer : Mike Grayford *
* *
* Start Date : November 20, 1995 *
* *
* Last Update : November 20, 1995 [MG] *
* *
*--------------------------------------------------------------------------------------------*
* *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
//==========================================================================
// INCLUDES
//==========================================================================
#include <gbuffer.h>
//==========================================================================
// PUBLIC DATA
//==========================================================================
extern GraphicBufferClass *Screen_Buffer;

209
WINVQ/VQAVIEW/MAINWIND.CPP Normal file
View File

@@ -0,0 +1,209 @@
/*
** Command & Conquer Red Alert(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 : VQAVIEW *
* *
* File Name : MAINWIND.CPP *
* *
* Programmer : Mike Grayford *
* *
* Start Date : Nov 15, 1995 *
* *
* Last Update : Nov 15, 1995 [MG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include <windows.h>
#include <westwood.h>
#include <mainwind.h>
#include <vidmode.h>
#include <wm.h>
#include <misc.h>
#include <wwlib.h>
//==========================================================================
// Private defines
//==========================================================================
#define APPLICATION_NAME "VQAVIEW"
#define APPLICATION_TITLE "VQA Movie Viewer"
//==========================================================================
// Public data
//==========================================================================
MainWindowClass Main_Window;
//==========================================================================
// Private functions
//==========================================================================
long WINAPI Main_Window_Message_Handler(
WindowHandle window_handle,
unsigned int message,
unsigned int w_param,
long l_param );
/***************************************************************************
* MainWindowClass::MainWindowClass -- Constructor for MainWindowClass *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: See PVCS log *
*=========================================================================*/
MainWindowClass::MainWindowClass( void )
{
// Much ado about nothing.
}
void MainWindowClass::Create_Main_Window( InstanceHandle instance_handle )
{
WindowClass window_class;
//
// Register the window class.
//
window_class.style = CS_OWNDC;
window_class.lpfnWndProc = Main_Window_Message_Handler;
window_class.cbClsExtra = 0;
window_class.cbWndExtra = 0;
window_class.hInstance = instance_handle;
window_class.hIcon = LoadIcon ( NULL, IDI_APPLICATION );
window_class.hCursor = LoadCursor ( NULL, IDC_ARROW );
window_class.hbrBackground = GetStockObject( BLACK_BRUSH );
window_class.lpszMenuName = APPLICATION_NAME;
window_class.lpszClassName = APPLICATION_NAME;
RegisterClass ( &window_class );
//
// Create our main window
//
main_window_handle = CreateWindowEx (
WS_EX_TOPMOST, // extended window info
APPLICATION_NAME, // window class name
APPLICATION_TITLE, // window caption
// WS_POPUP | WS_MAXIMIZE, // window style
WS_OVERLAPPED, // window style
0, // initial x position
0, // initial y position
VIDEO_MODE_WIDTH, // initial width
VIDEO_MODE_HEIGHT, // initial height
NULL, // parent window handle
NULL, // window menu handle
instance_handle, // program instance handle
NULL ); // creation parameters
MainWindow = main_window_handle;
global_instance_handle = instance_handle;
}
void MainWindowClass::Display_Window( void )
{
//
// Bring up the window, force a paint, and make sure we are the foreground window.
//
ShowWindow( main_window_handle, SW_SHOWMAXIMIZED );
UpdateWindow( main_window_handle );
SetForegroundWindow( main_window_handle );
//
// Via direct draw, set the video mode.
//
Set_Video_Mode( main_window_handle, VIDEO_MODE_WIDTH, VIDEO_MODE_HEIGHT, VIDEO_MODE_BITS_PER_PIXEL );
}
BOOL MainWindowClass::Update_Windows_Messages( void )
{
if ( PeekMessage( &message_queue, NULL, 0, 0, PM_NOREMOVE ) ) {
if ( GetMessage( &message_queue, NULL, 0, 0 ) ) {
TranslateMessage( &message_queue );
DispatchMessage( &message_queue );
}
else {
return( FALSE );
}
}
return( TRUE );
}
int MainWindowClass::Get_Message_Queue_wParam( void )
{
return( message_queue.wParam );
}
WindowHandle MainWindowClass::Get_Window_Handle( void )
{
return( main_window_handle );
}
long WINAPI Main_Window_Message_Handler(
WindowHandle window_handle,
unsigned int message,
unsigned int w_param,
long l_param )
{
switch ( message ) {
case WM_COMMAND:
return( WM_Command_Func( window_handle, message, w_param, l_param ) );
case WM_TIMER:
break;
case WM_ACTIVATEAPP:
WM_ActivateApp_Func( window_handle, message, w_param, l_param );
break;
case WM_DESTROY:
WM_Destroy_Func( window_handle, message, w_param, l_param );
return( 0 );
}
return( DefWindowProc( window_handle, message, w_param, l_param ) );
}
InstanceHandle MainWindowClass::Get_Instance_Handle( void )
{
return( global_instance_handle );
}

80
WINVQ/VQAVIEW/MAINWIND.H Normal file
View File

@@ -0,0 +1,80 @@
/*
** Command & Conquer Red Alert(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 : VQAVIEW *
* *
* File Name : MAINWIND.H *
* *
* Programmer : Michael Grayford *
* *
* Start Date : Nov 15, 1995 *
* *
* Last Update : Nov 15, 1995 [MG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//==========================================================================
// Public classes
//==========================================================================
class MainWindowClass {
public:
//==========================================================================
// Public functions
//==========================================================================
MainWindowClass( void );
void Create_Main_Window( InstanceHandle instance_handle );
WindowHandle Get_Window_Handle( void );
void Display_Window( void );
BOOL Update_Windows_Messages( void );
int Get_Message_Queue_wParam( void );
InstanceHandle Get_Instance_Handle( void );
private:
//==========================================================================
// Private data
//==========================================================================
WindowHandle main_window_handle;
InstanceHandle global_instance_handle;
MessageQueue message_queue;
//==========================================================================
// Private functions
//==========================================================================
}; /* VQAClass */
//==========================================================================
// Public data
//==========================================================================
extern MainWindowClass Main_Window;

200
WINVQ/VQAVIEW/MAKEFILE Normal file
View File

@@ -0,0 +1,200 @@
#
# Command & Conquer Red Alert(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 : Blade Runner *
#* *
#* File Name : MAKEFILE *
#* *
#* Programmer : Mike Grayford *
#* *
#* Start Date : Nov 14, 1995 *
#* *
#* Last Update : *
#* *
#*-------------------------------------------------------------------------*
#* *
#* Required environment variables: *
#* WIN32LIB = the root of the WW library *
#* WIN32VCS = root directory for WW library version control archive *
#* COMPILER = your Watcom installation path *
#* *
#* *
#* Required changes to makefile: *
#* PROJ_NAME = name of the executable program you're building *
#* PROJ_LIBS = Westwood libraries to link your EXE to *
#* OBJECTS = list of objects in your current working directory *
#* *
#* Optional changes to makefile: *
#* PROJ_DIR = full pathname of your working directory *
#* .xxx: = full pathname where various file types live *
#* *
#***************************************************************************
#---------------------------------------------------------------------------
# Verify user's environment
#---------------------------------------------------------------------------
!ifndef %WIN32LIB
!error WIN32LIB Environment var not configured.
!endif
!ifndef %WIN32VCS
!error WIN32VCS Environment var not configured.
!endif
!ifndef %WATCOM
!error WATCOM Environment var not configured.
!endif
#===========================================================================
# User-defined section: the user should tailor this section for each project
#===========================================================================
#---------------------------------------------------------------------------
# PROJ_NAME = library name
# PROJ_DIR = directory containing source & objects
#---------------------------------------------------------------------------
PROJ_NAME = VQAVIEW
PROJ_DIR = $(%BLADE)\VQA\VQAVIEW
LIB_DIR = $(%WIN32LIB)\LIB
VQA_LIB_DIR = $(%BLADE)\VQA\LIB
!include $(%WIN32LIB)\project.cfg
#---------------------------------------------------------------------------
# Project-dependent variables
#---------------------------------------------------------------------------
OBJECTS = &
gametime.obj &
main.obj &
mainwind.obj &
monochrm.obj &
movies.obj &
pal.obj &
vq.obj &
wm.obj &
interpal.obj
RESOURCES = &
dialogs.res &
menus.res
PROJ_LIBS = &
drawbuff.lib &
mem.lib &
misc.lib &
rawfile.lib
VQA_LIBS = &
vqa32wp.lib &
vqm32wp.lib
#---------------------------------------------------------------------------
# Path macros: one path for each file type.
# These paths are used to tell make where to find/put each file type.
#---------------------------------------------------------------------------
.EXTENSIONS: .res .rc
.asm: $(PROJ_DIR)
.c: $(PROJ_DIR)
.cpp: $(PROJ_DIR)
.h: $(PROJ_DIR)
.obj: $(PROJ_DIR)
.lib: $(%WIN32LIB)\lib;$(VQA_LIB_DIR)
.exe: $(PROJ_DIR)
.rc: $(PROJ_DIR)
.res: $(PROJ_DIR)
#---------------------------------------------------------------------------
# Tools/commands
#---------------------------------------------------------------------------
C_CMD = wcc386
CPP_CMD = wpp386
LIB_CMD = wlib
LINK_CMD = wlink
ASM_CMD = tasm
RC_CMD = wrc
#---------------------------------------------------------------------------
# Include & library paths
# If LIB & INCLUDE are already defined, they are used in addition to the
# WWLIB32 lib & include; otherwise, they're constructed from
# BCDIR
#---------------------------------------------------------------------------
LIBPATH = $(%WIN32LIB)\LIB;$(%WATCOM)\LIB386\NT;$(BLADE)\VQA\LIB
INCLUDEPATH = $(PROJ_DIR);$(%WIN32LIB)\INCLUDE;$(%WATCOM)\H;$(PROJ_DIR)\..;$(PROJ_DIR)\..\VQA32
#---------------------------------------------------------------------------
# Implicit rules
# Compiler:
# ($< = full dependent with path)
# Assembler:
# output obj's are constructed from .obj: & the $& macro
# ($< = full dependent with path)
# tasm's cfg file is not invoked as a response file.
#---------------------------------------------------------------------------
.c.obj: $(%WIN32LIB)\project.cfg .AUTODEPEND
$(C_CMD) $(CC_CFG) $<
.cpp.obj: $(%WIN32LIB)\project.cfg .AUTODEPEND
$(CPP_CMD) -db $(CC_CFG) /i=$(INCLUDEPATH) $<
.asm.obj: $(%WIN32LIB)\project.cfg
$(ASM_CMD) $(ASM_CFG) $<
.rc.res:
$(RC_CMD) /r $<
#---------------------------------------------------------------------------
# Default target
#---------------------------------------------------------------------------
all: $(PROJ_NAME).exe
#---------------------------------------------------------------------------
# Build the EXE
#---------------------------------------------------------------------------
$(PROJ_NAME).exe: $(OBJECTS) $(PROJ_NAME).lnk $(PROJ_LIBS) $(VQA_LIBS) $(RESOURCES)
$(LINK_CMD) $(LINK_CFG) name $^@ @$(PROJ_NAME).lnk
for %index in ($(RESOURCES)) do $(RC_CMD) -t %index $(PROJ_NAME).exe
#$(PROJ_LIBS):
# echo updating base library $^@
# cd ..
# wmake
# cd $(PROJ_DIR)
$(PROJ_NAME).lnk : $(OBJECTS) makefile
%create $^@
for %index in ($(OBJECTS)) do %append $^@ file %index
for %index in ($(PROJ_LIBS)) do %append $^@ library $(LIB_DIR)\%index
%append $^@ library $(LIB_DIR)\ddraw.lib
%append $^@ library $(LIB_DIR)\dsound.lib
for %index in ($(VQA_LIBS)) do %append $^@ library $(VQA_LIB_DIR)\%index
#**************************** End of makefile ******************************

52
WINVQ/VQAVIEW/MENUS.RC Normal file
View File

@@ -0,0 +1,52 @@
/*
** Command & Conquer Red Alert(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 : VQAVIEW *
* *
* File Name : MENUS.RC *
* *
* Programmer : Mike Grayford *
* *
* Start Date : November 22, 1995 *
* *
* Last Update : Nov 22, 1995 [MG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include "menus.rh"
VQAVIEW MENU
BEGIN
POPUP "File"
BEGIN
MENUITEM "&Open movie...", MENU_OPEN
MENUITEM SEPARATOR
MENUITEM "E&xit", MENU_EXIT
END
POPUP "Options"
BEGIN
MENUITEM "Set Movie Frame &Rate", MENU_SET_MOVIE_FRAME_RATE
END
END

48
WINVQ/VQAVIEW/MENUS.RH Normal file
View File

@@ -0,0 +1,48 @@
/*
** Command & Conquer Red Alert(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 : Virtual Monopoly *
* *
* File Name : MENUS.RH *
* *
* Programmer : Mike Grayford *
* *
* Start Date : November 22, 1995 *
* *
* Last Update : Nov 22, 1995 [MG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* MENU BAR */
#define MENU_BAR_FILE 0
/* FILE */
#define MENU_OPEN 100
#define MENU_EXIT 110
/* OPTIONS */
#define MENU_SET_MOVIE_FRAME_RATE 200

261
WINVQ/VQAVIEW/MONOCHRM.CPP Normal file
View File

@@ -0,0 +1,261 @@
/*
** Command & Conquer Red Alert(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 : VQAVIEW *
* *
* File Name : MONOCHRM.CPP *
* *
* Programmer : Michael Legg *
* *
* Start Date : May 10, 1995 *
* *
* Last Update : May 30, 1995 [ML] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* *
* These are not our functions, but Microsoft's from DBWIN.EXE *
* *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include <mem.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <monochrm.h>
#include <westwood.h>
typedef struct
{
char ch;
char attr;
} CA;
#define CCOLMAX 80
#define CROWMAX 25
#define ESC 27
#define BELL 7
#define DEFATTR 0x07
#define CA_SPACE ((DEFATTR << 8) | ' ')
// row+1 = DBWIN
#define PCA(row, col) (0xB0000 + ( (((row+0)*CCOLMAX)+col) * sizeof(CA)))
static void Monochrome_Output( char *string );
static void CACopy( CA *pcaDst, CA *pcaSrc, int cca );
static void CAFill( CA *pcaDst, int cca, int ca );
int rowCur = 0;
int colCur = 0;
/***************************************************************************
* DEBUG_PRINTF - works like printf, with limit of 10 variable args *
* *
* INPUT: same as printf *
* *
* OUTPUT: a message on the monochrome monitor display *
* *
* WARNINGS: try to end messages with \r\n! *
* *
* HISTORY: see PVCS log *
*=========================================================================*/
void Debug_Printf( char *format_string, ... )
{
va_list ap;
int arg[ 10 ];
char output_string[ 255 ];
va_start( ap, format_string );
arg[ 0 ] = va_arg( ap, int );
arg[ 1 ] = va_arg( ap, int );
arg[ 2 ] = va_arg( ap, int );
arg[ 3 ] = va_arg( ap, int );
arg[ 4 ] = va_arg( ap, int );
arg[ 5 ] = va_arg( ap, int );
arg[ 6 ] = va_arg( ap, int );
arg[ 7 ] = va_arg( ap, int );
arg[ 8 ] = va_arg( ap, int );
arg[ 9 ] = va_arg( ap, int );
va_end( ap );
sprintf( (char *) output_string,
(char *) format_string,
arg[ 0 ],
arg[ 1 ],
arg[ 2 ],
arg[ 3 ],
arg[ 4 ],
arg[ 5 ],
arg[ 6 ],
arg[ 7 ],
arg[ 8 ],
arg[ 9 ] );
Debug_Mono_Message( (char *) output_string );
}
/***************************************************************************
* DEBUG_MONO_MESSAGE -- Post a line to the monochrome monitor *
* *
* INPUT: the message to print *
* *
* OUTPUT: a message on the monochrome monitor display *
* *
* WARNINGS: try to end messages with \r\n! *
* *
* HISTORY: see PVCS log *
*=========================================================================*/
void Debug_Mono_Message( char *message )
{
char *temp_string;
char *temp_null_position;
char temp_char;
int length_left;
length_left = strlen( message );
temp_null_position = message;
while ( length_left > CCOLMAX ) {
temp_string = temp_null_position;
temp_null_position += CCOLMAX;
temp_char = *temp_null_position;
temp_null_position[ 0 ] = '\0';
Monochrome_Output( temp_string );
*temp_null_position = temp_char;
length_left -= CCOLMAX;
}
temp_string = temp_null_position;
Monochrome_Output( temp_string );
}
static void Monochrome_Output( char *string )
{
CA *pca;
char ch;
static int _initialized = FALSE;
pca = (CA *) PCA(rowCur, colCur);
if ( ! _initialized ) {
CAFill( (CA *) PCA(0, 0),
(CCOLMAX * CROWMAX),
CA_SPACE );
colCur = 0;
rowCur = 0;
_initialized = TRUE;
}
while ( TRUE ) {
ch = *string++;
if ( ! ch ) {
break;
}
switch (ch) {
case '\b':
if (colCur > 0)
{
colCur--;
pca--;
pca->ch = ' ';
pca->attr = DEFATTR;
}
break;
case BELL:
// MessageBeep(0);
break;
case '\t':
pca += 8 - colCur % 8;
colCur += 8 - colCur % 8;
break;
case '\r':
colCur = 0;
pca = (CA *) PCA(rowCur, colCur);
break;
default:
pca->ch = ch;
pca->attr = DEFATTR;
pca++;
colCur++;
if (colCur < CCOLMAX)
break;
// fall through to handle LF
case '\n':
colCur = 0;
rowCur++;
if (rowCur >= CROWMAX)
{
CACopy( (CA *) PCA(0, 0), (CA *) PCA(1, 0), CCOLMAX * (CROWMAX - 1));
CAFill( (CA *) PCA(CROWMAX - 1, 0), CCOLMAX, CA_SPACE);
rowCur = CROWMAX - 1;
}
pca = (CA *) PCA(rowCur, colCur);
break;
case ESC:
//
// ANSI clear screen escape
//
if (string[1] == '[' && string[2] == '2' && string[3] == 'J')
{
CAFill( (CA *)PCA(0,0), CCOLMAX * CROWMAX, CA_SPACE);
rowCur = colCur = 0;
string += 3;
}
}
}
}
static void CACopy( CA *pcaDst, CA *pcaSrc, int cca )
{
int i;
for ( i = 0; i < cca; i ++ ) {
*pcaDst = *pcaSrc;
pcaDst ++;
pcaSrc ++;
}
}
static void CAFill( CA *pcaDst, int cca, int ca )
{
int i;
for ( i = 0; i < cca; i ++ ) {
memcpy( pcaDst, &ca, sizeof( int ) );
pcaDst ++;
}
}

47
WINVQ/VQAVIEW/MONOCHRM.H Normal file
View File

@@ -0,0 +1,47 @@
/*
** Command & Conquer Red Alert(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 : VQAVIEW *
* *
* File Name : MONOCHRM.H *
* *
* Programmer : Michael Grayford *
* *
* Start Date : *
* *
* Last Update : Nov 24, 1995 [ML] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef MONOCHRM_H
#define MONOCHRM_H
//==========================================================================
// PUBLIC FUNCTIONS
//==========================================================================
void Debug_Printf( char *format_string, ... );
void Debug_Mono_Message( char *message );
#endif

739
WINVQ/VQAVIEW/MOVIES.CPP Normal file
View File

@@ -0,0 +1,739 @@
/*
** Command & Conquer Red Alert(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 : VQAVIEW *
* *
* File Name : MOVIES.CPP *
* *
* Programmer : Michael Grayford *
* *
* Start Date : *
* *
* Last Update : Nov 29, 1995 [MG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//==========================================================================
// INCLUDES
//==========================================================================
#include <windows.h>
#include <westwood.h>
#include <vq.h>
#include <movies.h>
#include <mainwind.h>
#include <main.h>
#include <pal.h>
//==========================================================================
// PRIVATE FUNCTIONS
//==========================================================================
void VQA_Test( char *filename );
void Create_Palette_Interpolation_Table( void );
void Interpolate_2X_Scale( GraphicBufferClass *source, GraphicBufferClass *dest );
//==========================================================================
// PRIVATE GLOBALS
//==========================================================================
extern "C"{
extern unsigned char *InterpolationPalette;
extern unsigned char Palette_Interpolation_Table[SIZE_OF_PALETTE][SIZE_OF_PALETTE];
extern void __cdecl Asm_Create_Palette_Interpolation_Table(void);
extern void __cdecl Asm_Interpolate (unsigned char* src_ptr ,
unsigned char* dest_ptr ,
int lines ,
int src_width ,
int dest_width);
}
unsigned char Palette_Interpolation_Table[ SIZE_OF_PALETTE ][ SIZE_OF_PALETTE ];
unsigned char *InterpolationPalette;
VQAClass *TestVqa;
#if( ! DRAW_TO_VIDEO )
GraphicBufferClass *Draw_Page = NULL;
GraphicBufferClass *Back_Page = NULL;
GraphicBufferClass *Hid_Page = NULL;
#endif
/***************************************************************************
* Initialize_Movie_System - Allocate memory needed for caching and any *
* permanent Movie data. *
* *
* INPUT: NONE *
* *
* OUTPUT: int - an error value *
* *
* WARNINGS: Yellow alert! *
* *
* HISTORY: *
* 09/29/1995 MG : Created. *
*=========================================================================*/
int Initialize_Movie_System( void )
{
#if( ! DRAW_TO_VIDEO )
//
// Set up the graphic pages:
// Draw_Page - the page that the VQA library draws to. (Normal RAM)
// Back_Page - the page that the drawn image is scaled to. (Normal RAM)
// Hid_Page - the page in video RAM that the scaled image is copied to before copy to screen.
//
Draw_Page = new GraphicBufferClass ( MOVIE_WIDTH, MOVIE_HEIGHT );
Back_Page = new GraphicBufferClass ( VIDEO_MODE_WIDTH, VIDEO_MODE_HEIGHT );
Hid_Page = new GraphicBufferClass ( VIDEO_MODE_WIDTH, VIDEO_MODE_HEIGHT, (GBC_Enum)(GBC_VIDEOMEM) );
#endif
//
// Okay, we're cool.
//
return( VQA_INIT_NO_ERROR );
}
/***************************************************************************
* Free_Movie_System - Free up memory used by Movie cache system and any *
* permanent Movie data. *
* *
* INPUT: NONE *
* *
* OUTPUT: NONE *
* *
* WARNINGS: Red alert! *
* *
* HISTORY: *
* 09/29/1995 MG : Created. *
*=========================================================================*/
void Free_Movie_System( void )
{
#if( ! DRAW_TO_VIDEO )
if ( Draw_Page ) {
delete( Draw_Page );
}
if ( Back_Page ) {
delete( Back_Page );
}
if ( Hid_Page ) {
delete( Hid_Page );
}
Draw_Page = NULL;
Back_Page = NULL;
Hid_Page = NULL;
#endif
return;
}
/***************************************************************************
* Choose_Movie - Brings up choice of VQA files. *
* *
* INPUT: NONE *
* *
* OUTPUT: NONE *
* *
* WARNINGS: *
* *
* HISTORY: *
* 05/15/1995 MG : Created. *
*=========================================================================*/
void Choose_Movie( WindowHandle window_handle )
{
int i;
char temp_file[_MAX_FNAME + _MAX_EXT];
static OPENFILENAME open_file_dlg;
static char path_filename[ _MAX_PATH*500 ];
static char filename[ _MAX_FNAME + _MAX_EXT ];
static char *filters[] = {
"VQA files (*.VQA)", "*.vqa",
"All Files", "*.*",
"" } ;
filename[0]=0;
memset (&path_filename[0],0,_MAX_PATH*500);
open_file_dlg.lStructSize = sizeof( OPENFILENAME );
open_file_dlg.hwndOwner = window_handle;
open_file_dlg.hInstance = NULL;
open_file_dlg.lpstrFilter = filters[ 0 ];
open_file_dlg.lpstrCustomFilter = NULL;
open_file_dlg.nMaxCustFilter = 0;
open_file_dlg.nFilterIndex = 1;
open_file_dlg.lpstrFile = path_filename;
open_file_dlg.nMaxFile = _MAX_PATH*500;
open_file_dlg.lpstrFileTitle = filename;
open_file_dlg.nMaxFileTitle = _MAX_FNAME + _MAX_EXT;
open_file_dlg.lpstrInitialDir = NULL;
open_file_dlg.lpstrTitle = "Choose a VQA to run";
open_file_dlg.Flags = OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT;
open_file_dlg.nFileOffset = 0;
open_file_dlg.nFileExtension = 0;
open_file_dlg.lpstrDefExt = "vqa";
open_file_dlg.lCustData = 0l;
open_file_dlg.lpfnHook = NULL;
open_file_dlg.lpTemplateName = NULL;
if ( GetOpenFileName( &open_file_dlg ) ) {
if ( filename[ 0 ] != '\0' ) {
VQA_Test( filename );
} else {
int last_file=0;
for (i=0 ; i<open_file_dlg.nMaxFile ; i++){
if (path_filename[i]==0 || path_filename[i]==' '){
if (!(i-last_file)) break;
memcpy( &temp_file[0] , &path_filename[last_file] , i-last_file);
temp_file[i-last_file]=0;
if (last_file){
VQA_Test(temp_file);
}else{
SetCurrentDirectory(temp_file);
}
if (path_filename[i]==0){
break;
}else{
last_file = i+1;
}
}
}
}
}
}
/***************************************************************************
* VQA_Test - plays a generic VQA *
* *
* INPUT: char *filename *
* *
* OUTPUT: NONE *
* *
* WARNINGS: Red alert! *
* *
* HISTORY: *
* 11/22/1995 MG : Created. *
*=========================================================================*/
void VQA_Test( char *filename )
{
char *temp_ptr;
int i;
char *draw_surface_ptr;
GraphicBufferClass *draw_buffer_ptr;
long (*callback_function_ptr) (unsigned char *, long);
//
// Handle windows messages so that any repaint occurs before we start
// playing the movie.
//
Main_Window.Update_Windows_Messages();
// Strip the extension off the filename.
filename = strtok( filename, "." );
#if( DRAW_TO_VIDEO )
draw_buffer_ptr = Screen_Buffer;
callback_function_ptr = Draw_To_Video_Callback;
#else
draw_buffer_ptr = Draw_Page;
callback_function_ptr = Draw_To_Buffer_Callback;
#endif
//
// Get the draw buffer.
//
draw_buffer_ptr->Lock();
draw_surface_ptr = (char *) draw_buffer_ptr->Get_Offset();
draw_buffer_ptr->Unlock();
//
// Clear the drawing surface with color 0.
//
draw_buffer_ptr->Lock();
temp_ptr = draw_surface_ptr;
for ( i = 0; i < (MOVIE_WIDTH * MOVIE_HEIGHT); i ++ ) {
*temp_ptr = COLOR_BLACK;
temp_ptr ++;
}
draw_buffer_ptr->Unlock();
//
// Create a new VQA object.
//
TestVqa = new VQAClass(
filename,
draw_surface_ptr,
FROM_DISK,
callback_function_ptr );
//
// Allocate the buffers for the VQA.
//
if ( TestVqa->Open_And_Load_Buffers() ) {
TestVqa->Read_Palettes();
//
// Play the VQA.
//
TestVqa->Play_VQA( PLAY_ALL_FRAMES );
//
// Close the VQA.
//
TestVqa->Close_And_Free_VQA();
TestVqa->Write_Palettes();
delete TestVqa;
}
}
/***************************************************************************
* DRAW_TO_VIDEO_CALLBACK -- Callback after a VQA frame is drawn to video *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 11/22/1995 MG : Created. *
*=========================================================================*/
long Draw_To_Video_Callback( unsigned char *buffer, long frame_number )
{
return( 0 );
}
/***************************************************************************
* DRAW_TO_BUFFER_CALLBACK -- Copies the drawn frame to the screen *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 11/22/1995 MG : Created. *
*=========================================================================*/
long Draw_To_Buffer_Callback( unsigned char *buffer, long frame_number )
{
//
// Frame was skipped, bail.
//
if ( buffer == NULL ) {
return( 0 );
}
#if( ! DRAW_TO_VIDEO )
//
// Do the cool interpolated, interlaced scale.
//
#if( 1 )
Interpolate_2X_Scale( Draw_Page, Back_Page );
Back_Page->Blit( *Screen_Buffer, 0, 0, 0, 100, 640, 314 );
#endif
//
// Draw 320x200 to Normal RAM, scale to Screen.
//
#if( 0 )
Draw_Page->Scale( *Screen_Buffer );
#endif
//
// Draw 320x200 to Normal RAM, scale to Normal RAM, Blit to Hid, Blit to Screen.
//
#if( 0 )
Draw_Page->Scale( *Back_Page );
Back_Page->Blit( *Hid_Page );
Hid_Page->Blit( *Screen_Buffer );
#endif
//
// Draw 320x200 to Normal RAM, scale to Normal RAM, Blit to Screen.
//
#if( 0 )
Draw_Page->Scale( *Back_Page );
Back_Page->Blit( *Screen_Buffer );
#endif
//
// Draw 320x200 to Normal RAM, Blit to Screen.
//
#if( 0 )
Draw_Page->Blit( *Screen_Buffer );
#endif
#endif
return( 0 );
}
/***************************************************************************
* CREATE_PALETTE_INTERPOLATION_TABLE *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 12/06/1995 MG : Created. *
*=========================================================================*/
void Create_Palette_Interpolation_Table( void )
{
// InterpolationPalette = (unsigned char*)CurrentPalette;
// Asm_Create_Palette_Interpolation_Table();
//#if 0
int i;
int j;
int p;
unsigned char *first_palette_ptr;
unsigned char *second_palette_ptr;
unsigned char *match_pal_ptr;
int first_r;
int first_g;
int first_b;
int second_r;
int second_g;
int second_b;
int diff_r;
int diff_g;
int diff_b;
int dest_r;
int dest_g;
int dest_b;
int distance;
int closest_distance;
int index_of_closest_color;
//
// Create an interpolation table for the current palette.
//
first_palette_ptr = (unsigned char *) CurrentPalette;
for ( i = 0; i < SIZE_OF_PALETTE; i ++ ) {
//
// Get the first palette entry's RGB.
//
first_r = *first_palette_ptr;
first_palette_ptr ++;
first_g = *first_palette_ptr;
first_palette_ptr ++;
first_b = *first_palette_ptr;
first_palette_ptr ++;
second_palette_ptr = (unsigned char *) CurrentPalette;
for ( j = 0; j < SIZE_OF_PALETTE; j ++ ) {
//
// Get the second palette entry's RGB.
//
second_r = *second_palette_ptr;
second_palette_ptr ++;
second_g = *second_palette_ptr;
second_palette_ptr ++;
second_b = *second_palette_ptr;
second_palette_ptr ++;
//
// Now calculate the RGB halfway between the first and second colors.
//
dest_r = ( first_r + second_r ) >> 1;
dest_g = ( first_g + second_g ) >> 1;
dest_b = ( first_b + second_b ) >> 1;
//
// Now find the color in the palette that most closely matches the interpolated color.
//
index_of_closest_color = 0;
// closest_distance = (256 * 256) * 3;
closest_distance = 500000;
match_pal_ptr = (unsigned char *) CurrentPalette;
for ( p = 0; p < SIZE_OF_PALETTE; p ++ ) {
diff_r = ( ((int) (*match_pal_ptr)) - dest_r );
match_pal_ptr ++;
diff_g = ( ((int) (*match_pal_ptr)) - dest_g );
match_pal_ptr ++;
diff_b = ( ((int) (*match_pal_ptr)) - dest_b );
match_pal_ptr ++;
distance = ( diff_r * diff_r ) + ( diff_g * diff_g ) + ( diff_b * diff_b );
if ( distance < closest_distance ) {
closest_distance = distance;
index_of_closest_color = p;
}
}
Palette_Interpolation_Table[ i ][ j ] = (unsigned char) index_of_closest_color;
}
}
return;
//#endif
}
#if( 1 )
/***************************************************************************
* INTERPOLATE_2X_SCALE *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 12/06/1995 MG : Created. *
*=========================================================================*/
void Interpolate_2X_Scale( GraphicBufferClass *source, GraphicBufferClass *dest)
{
unsigned char *src_ptr;
unsigned char *dest_ptr;
unsigned char *last_dest_ptr;
unsigned char *end_of_source;
int src_width;
int dest_width;
// int width_counter;
BOOL source_locked = FALSE;
BOOL dest_locked = FALSE;
/*
** Lock video surfaces if requred
*/
if (source->Get_IsDirectDraw()){
if (!source->Lock()) return;
source_locked = TRUE;
}
if (dest->Get_IsDirectDraw()){
if (!dest->Lock()) {
if (source_locked){
source->Unlock();
}
return;
}
dest_locked = TRUE;
}
//
// Get pointers to the source and destination buffers.
//
src_ptr = (unsigned char *) source->Get_Offset();
dest_ptr = (unsigned char *) dest->Get_Offset();
end_of_source = src_ptr + ( source->Get_Width() * source->Get_Height() );
//
// Get width of source and dest buffers.
//
src_width = source->Get_Width();
dest_width = 2*(dest->Get_Width() + dest->Get_XAdd() + dest->Get_Pitch());
last_dest_ptr = dest_ptr;
Asm_Interpolate ( src_ptr , dest_ptr , source->Get_Height() , src_width , dest_width);
if (source_locked) source->Unlock();
if (dest_locked) dest->Unlock();
return;
}
#endif
#if( 0 )
/***************************************************************************
* INTERPOLATE_2X_SCALE *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 12/06/1995 MG : Created. *
*=========================================================================*/
void Interpolate_2X_Scale( GraphicBufferClass *source, GraphicBufferClass *dest )
{
unsigned char *src_ptr;
unsigned char *dest_ptr;
unsigned char *end_of_source;
int src_width;
int dest_width;
int width_counter;
//
// Get pointers to the source and destination buffers.
//
src_ptr = (unsigned char *) source->Get_Offset();
dest_ptr = (unsigned char *) dest->Get_Offset();
end_of_source = src_ptr + ( source->Get_Width() * source->Get_Height() );
//
// Get width of source and dest buffers.
//
src_width = source->Get_Width();
dest_width = dest->Get_Width();
//
// Copy over the first pixel (upper left).
//
*dest_ptr = *src_ptr;
src_ptr ++;
dest_ptr ++;
//
// Scale copy.
//
width_counter = 0;
while ( src_ptr < end_of_source ) {
//
// Blend this pixel with the one to the left and place this new color in the dest buffer.
//
*dest_ptr = Palette_Interpolation_Table[ (*src_ptr) ][ (*( src_ptr - 1 )) ];
dest_ptr ++;
//
// Now place the source pixel into the dest buffer.
//
*dest_ptr = *src_ptr;
src_ptr ++;
dest_ptr ++;
width_counter ++;
if ( width_counter == src_width ) {
width_counter = 0;
dest_ptr += dest_width;
}
}
return;
}
#endif
#if( 0 )
/***************************************************************************
* INTERPOLATE_2X_SCALE *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 12/06/1995 MG : Created. *
*=========================================================================*/
void Interpolate_2X_Scale( GraphicBufferClass *source, GraphicBufferClass *dest )
{
unsigned char *src_ptr;
unsigned char *dest_ptr;
unsigned char *dest2_ptr;
unsigned char *end_of_source;
int src_width;
int dest_width;
int width_counter;
//
// Get pointers to the source and destination buffers.
//
src_ptr = (unsigned char *) source->Get_Offset();
dest_ptr = (unsigned char *) dest->Get_Offset();
end_of_source = src_ptr + ( source->Get_Width() * source->Get_Height() );
//
// Get width of source and dest buffers.
//
src_width = source->Get_Width();
dest_width = dest->Get_Width();
//
// Copy over the first pixel (upper left).
//
*dest_ptr = *src_ptr;
src_ptr ++;
dest_ptr += 2;
dest2_ptr = dest_ptr + dest_width + 1;
//
// Scale copy.
//
width_counter = 0;
while ( src_ptr < end_of_source ) {
//
// Blend this pixel with the one to the left and place this new color in the dest buffer.
//
*dest2_ptr = Palette_Interpolation_Table[ (*src_ptr) ][ (*( src_ptr - 1 )) ];
dest2_ptr += 2;
//
// Now place the source pixel into the dest buffer.
//
*dest_ptr = *src_ptr;
src_ptr ++;
dest_ptr += 2;
width_counter ++;
if ( width_counter == src_width ) {
width_counter = 0;
dest_ptr += dest_width;
dest2_ptr += dest_width;
}
}
return;
}
#endif

74
WINVQ/VQAVIEW/MOVIES.H Normal file
View File

@@ -0,0 +1,74 @@
/*
** Command & Conquer Red Alert(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 : VQAVIEW *
* *
* File Name : VQ.CPP *
* *
* Programmer : Michael Grayford *
* *
* Start Date : *
* *
* Last Update : May 31, 1995 [MG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* Choose_VQA - Brings up choice of VQA files. *
* Draw_To_Video_Callback -- callback after draw VQA frame to video *
* Draw_To_Buffer_Callback -- callback after draw VQA frame to buffer *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//==========================================================================
// PUBLIC FUNCTIONS
//==========================================================================
extern int Initialize_Movie_System( void );
extern void Free_Movie_System( void );
extern void Choose_Movie( WindowHandle window_handle );
extern long Draw_To_Video_Callback( unsigned char *buffer, long frame_number );
extern long Draw_To_Buffer_Callback( unsigned char *buffer, long frame_number );
extern void Create_Palette_Interpolation_Table( void );
//==========================================================================
// PRIVATE DEFINES
//==========================================================================
#define DRAW_TO_VIDEO FALSE
//==========================================================================
// PUBLIC FUNCTIONS
//==========================================================================
#if( DRAW_TO_VIDEO )
#define MOVIE_WIDTH 640
#define MOVIE_HEIGHT 480
#else
#define MOVIE_WIDTH 320
#define MOVIE_HEIGHT 200
#endif

114
WINVQ/VQAVIEW/PAL.CPP Normal file
View File

@@ -0,0 +1,114 @@
/*
** Command & Conquer Red Alert(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 : VQAVIEW *
* *
* File Name : PAL.CPP *
* *
* Programmer : Mike Grayford *
* *
* Start Date : November 20, 1995 *
* *
* Last Update : Nov 20, 1995 [MG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* *
* Update_Full_Palette -- Modifies the Windows palette *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include <windows.h>
#include <westwood.h>
#include <vidmode.h>
#include <pal.h>
#include <gbuffer.h>
#include <main.h>
#include <monochrm.h>
#include <wwlib.h>
#include <memflag.h>
#include <vq.h>
//---------------------------------------------------------------------------------------------
// PUBLIC DATA
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
// PRIVATE GLOBALS
//---------------------------------------------------------------------------------------------
/***************************************************************************
* Update_Full_Palette -- Modifies the Windows palette *
* *
* INPUT: unsigned char *palette - pointer to the entire raw palette *
* *
* OUTPUT: NONE *
* *
* WARNINGS: Watch out for falling bricks. *
* *
* HISTORY: *
* 11/27/1995 MG : Created. *
*=========================================================================*/
void Update_Full_Palette( unsigned char *palette )
{
PALETTEENTRY pe[ SIZE_OF_PALETTE ];
unsigned char *pal_pos;
int i;
pal_pos = palette;
for ( i = 0; i < SIZE_OF_PALETTE; i ++ ) {
pe[ i ].peRed = *pal_pos;
pal_pos ++;
pe[ i ].peGreen = *pal_pos;
pal_pos ++;
pe[ i ].peBlue = *pal_pos;
pal_pos ++;
}
Mem_Copy( palette, CurrentPalette, SIZE_OF_PALETTE * 3 );
DirectDrawObject->CreatePalette( DDPCAPS_8BIT, &pe[ 0 ], &PalettePtr, NULL );
Screen_Buffer->Get_Graphic_Buffer()->Get_DD_Surface()->SetPalette( PalettePtr );
PalettePtr->SetEntries( DDPSETPAL_VSYNC , 0 , SIZE_OF_PALETTE , &pe[ 0 ] );
}
extern VQAClass *TestVqa;
extern "C"{
void __cdecl SetPalette(unsigned char *palette,long ,unsigned long );
}
void __cdecl SetPalette(unsigned char *palette,long ,unsigned long )
{
TestVqa->Update_Palette(palette);
}

57
WINVQ/VQAVIEW/PAL.H Normal file
View File

@@ -0,0 +1,57 @@
/*
** Command & Conquer Red Alert(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 : VQAVIEW *
* *
* File Name : PAL.H *
* *
* Programmer : Michael Grayford *
* *
* Start Date : Nov 27, 1995 *
* *
* Last Update : Nov 22, 1995 [MG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//==========================================================================
// PUBLIC FUNCTIONS
//==========================================================================
void Update_Full_Palette( unsigned char *palette );
//==========================================================================
// PUBLIC FUNCTIONS
//==========================================================================
extern "C" {
char CurrentPalette[ SIZE_OF_PALETTE * 3 ];
}
//==========================================================================
// PUBLIC DEFINES
//==========================================================================
#define COLOR_BLACK 0

21
WINVQ/VQAVIEW/TEST.MAK Normal file
View File

@@ -0,0 +1,21 @@
#
# Command & Conquer Red Alert(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/>.
#
.rc.res:
hello


25
WINVQ/VQAVIEW/VIDMODE.H Normal file
View File

@@ -0,0 +1,25 @@
/*
** Command & Conquer Red Alert(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/>.
*/
#define VIDEO_MODE_WIDTH 640
#define VIDEO_MODE_HEIGHT 480
#define VIDEO_MODE_BITS_PER_PIXEL 8
#define SIZE_OF_PALETTE 256

1066
WINVQ/VQAVIEW/VQ.CPP Normal file

File diff suppressed because it is too large Load Diff

161
WINVQ/VQAVIEW/VQ.H Normal file
View File

@@ -0,0 +1,161 @@
/*
** Command & Conquer Red Alert(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 : VQAVIEW *
* *
* File Name : VQ.H *
* *
* Programmer : Michael Grayford *
* *
* Start Date : *
* *
* Last Update : Nov 22, 1995 [MG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//==========================================================================
// INCLUDES
//==========================================================================
#include <vqa32\vqaplay.h>
#include <vidmode.h>
#define bool BOOL
#define true 1
#define false 0
#include <rawfile.h>
//==========================================================================
// PUBLIC FUNCTIONS
//==========================================================================
void Set_Movie_Frame_Rate( void );
//==========================================================================
// PRIVATE DEFINES
//==========================================================================
//--------------------------------------------------------------------------
// GENERAL DEFINES
//--------------------------------------------------------------------------
#define VQ_BLOCK_WIDTH 4
#define VQ_BLOCK_HEIGHT 4
#define VQ_COLUMNS ( VQ_MOVIE_WIDTH / VQ_BLOCK_WIDTH )
#define VQ_ROWS ( VQ_MOVIE_HEIGHT / VQ_BLOCK_HEIGHT )
// Codes for media_src parameter of VQAClass constructor:
#define FROM_DISK 0
#define FROM_MEMORY 1
// CODES for Play_VQA:
#define PLAY_ALL_FRAMES -1
#define PLAY_TO_END_OF_MOVIE -2
// CODES for Play_VQA_Frame:
#define PLAY_LAST_FRAME -1
// Error codes returned by VQA_INIT:
#define VQA_INIT_NO_ERROR -1
#define VQA_INIT_FAILED_MEM_POOL_ALLOC -2
#define VQA_INIT_FAILED_SCRATCH_ALLOC -3
// Codes for Cache_VQA:
#define CACHE_REST_OF_FILE 0
// Error codes returned by CACHE_VQA
#define CACHE_NO_ERROR -1
#define CACHE_EOF -2
#define CACHE_FAILED_MEM_ALLOC -3
#define CACHE_OPEN_FILE_ERROR -4
#define CACHE_READ_ERROR -5
// Error codes returned by Play_VQA:
#define VQA_PLAY_NO_ERROR 0
#define VQA_PLAY_USER_BREAK 1
#define VECTOR_FORMAT_OFFSETS 1
#define VECTOR_FORMAT_INDEXES 2
#define MAX_CODEBOOK_OFFSET 32766
//==========================================================================
// PUBLIC DATA
//==========================================================================
extern unsigned char *Movie_Scratch_Buffer;
//==========================================================================
// CLASSES
//==========================================================================
class VQAClass {
private:
char base_filename[ _MAX_PATH ];
char vqa_filename[ _MAX_PATH ];
char PaletteFilename [_MAX_PATH];
VQAConfig vqa_config;
VQAHandle *vqa_handle;
short media_source;
int file_handle;
unsigned char palette[ SIZE_OF_PALETTE * 3 ];
int current_frame;
int total_frames;
BOOL vqa_is_open;
unsigned char *InterpolatedPalettes[50]; //Max 50 palette changes in a vq
BOOL PalettesRead;
RawFileClass *PaletteFile;
unsigned NumPalettes;
/*=========================================================================*/
/* Private functions. */
/*=========================================================================*/
int VQAClass::Play_Generic_VQA( int last_frame_to_play );
public:
VQAClass( char *filename, char *buffer, short media_src, long (*callback) (unsigned char *, long) );
~VQAClass (void);
BOOL VQAClass::Update_Palette( unsigned char *newpalette );
BOOL Open_And_Load_Buffers( void );
void Seek_To_Frame( unsigned long frame );
int Play_VQA( int last_frame_to_play );
void Play_VQA_Frame( int frame_number );
void Pause_VQA( void );
void Close_And_Free_VQA( void );
void VQAClass::Read_Palettes(void);
void VQAClass::Write_Palettes(void);
}; /* VQAClass */
//==========================================================================
// TYPES
//==========================================================================
typedef struct {
unsigned long file_offset;
unsigned long file_size;
} VQACacheHeader;

BIN
WINVQ/VQAVIEW/VQAVIEW.EXE Normal file

Binary file not shown.

BIN
WINVQ/VQAVIEW/VQAVIEW.IDE Normal file

Binary file not shown.

Binary file not shown.

59
WINVQ/VQAVIEW/WESTWOOD.H Normal file
View File

@@ -0,0 +1,59 @@
/*
** Command & Conquer Red Alert(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 : Virtual_Monopoly *
* *
* File Name : WESTWOOD.H *
* *
* Programmer : Michael Legg / Mike Grayford *
* *
* Start Date : January 2, 1995 *
* *
* Last Update : Nov 15, 1995 [MG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#define BitmapHandle HBITMAP
#define DCHandle HDC
#define DIBPointer LPBITMAPINFOHEADER
#define Handle HANDLE
#define MenuHandle HMENU
#define MessageQueue MSG
#define PaintStruct PAINTSTRUCT
#define PaletteHandle HPALETTE
#define Rectangle RECT
#define String LPSTR
#define WindowClass WNDCLASS
#define WindowHandle HWND
#define FileHandle HFILE
#define CursorHandle HCURSOR
#define AcceleratorHandle HACCEL
#define IconHandle HICON
#define InstanceHandle HINSTANCE
#define DirectDrawPalettePtr LPDIRECTDRAWPALETTE
#define DirectDrawObjectPtr LPDIRECTDRAW
#define BOOL int
#define TRUE 1
#define FALSE 0


254
WINVQ/VQAVIEW/WM.CPP Normal file
View File

@@ -0,0 +1,254 @@
/*
** Command & Conquer Red Alert(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 : VQAVIEW *
* *
* File Name : WM.CPP *
* *
* Programmer : Mike Grayford *
* *
* Start Date : November 20, 1995 *
* *
* Last Update : Nov 20, 1995 [MG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//==========================================================================
// INCLUDES
//==========================================================================
#include <windows.h>
#include <westwood.h>
#include <wm.h>
#include <gbuffer.h>
#include <main.h>
#include <mainwind.h>
#include <menus.rh>
#include <movies.h>
#include <vq.h>
//==========================================================================
// PUBLIC FUNCTIONS
//==========================================================================
void Menu_Exit_Game( void );
/***************************************************************************
* WM_COMMAND_FUNC -- Handles all main window commands *
* *
* INPUT: standard windows dialog command parameters *
* *
* OUTPUT: IDOK or IDCANCEL *
* *
* WARNINGS: none *
* *
* HISTORY: *
* 11/20/95 MG : Created *
*=========================================================================*/
long WM_Command_Func(
WindowHandle window_handle,
unsigned int message,
WPARAM w_param,
LPARAM l_param )
{
switch( w_param ) {
case MENU_EXIT:
Menu_Exit_Game();
break;
case MENU_OPEN:
Choose_Movie( Main_Window.Get_Window_Handle() );
break;
case MENU_SET_MOVIE_FRAME_RATE:
Set_Movie_Frame_Rate();
break;
default:
break;
}
return( 0 );
}
/***************************************************************************
* WM_SYS_COMMAND_FUNC -- Handles all system menu commands *
* *
* INPUT: standard windows dialog command parameters *
* *
* OUTPUT: IDOK or IDCANCEL *
* *
* WARNINGS: none *
* *
* HISTORY: see PVCS log *
*=========================================================================*/
#pragma argsused
long WM_Sys_Command_Func(
WindowHandle window_handle,
unsigned int message,
WPARAM w_param,
LPARAM l_param )
{
switch( w_param & 0xfff0 ) {
case SC_CLOSE:
break;
case SC_MINIMIZE:
break;
case SC_MAXIMIZE:
case SC_RESTORE:
break;
case SC_KEYMENU:
case SC_MOUSEMENU:
break;
default:
break;
}
return( DefWindowProc( window_handle, message, w_param, l_param ) );
}
/***************************************************************************
* WM_PAINT_FUNC -- Code that is executed when WM_PAINT is sent *
* *
* INPUT: standard windows dialog command parameter passing *
* *
* OUTPUT: unused *
* *
* WARNINGS: none *
* *
* HISTORY: see PVCS log *
*=========================================================================*/
#pragma argsused
long WM_Paint_Func(
WindowHandle window_handle,
unsigned int message,
unsigned int w_param,
long l_param )
{
return( 0 );
}
/***************************************************************************
* WM_DESTROY_FUNC -- Handles when a WM_DESTROY hits the main window *
* *
* INPUT: standard windows dialog command parameters *
* *
* OUTPUT: unused *
* *
* WARNINGS: none *
* *
* HISTORY: see PVCS log *
*=========================================================================*/
long WM_Destroy_Func(
WindowHandle window_handle,
unsigned int message,
unsigned int w_param,
long l_param )
{
if ( Screen_Buffer ) {
delete( Screen_Buffer );
}
PostQuitMessage( w_param );
return( 0L );
}
/***************************************************************************
* WM_MOUSE_BUTTON_FUNC -- Handles when a MOUSE button command comes in *
* *
* INPUT: standard windows dialog command parameters *
* *
* OUTPUT: unused *
* *
* WARNINGS: none *
* *
* HISTORY: see PVCS log *
*=========================================================================*/
long WM_Mouse_Button_Func(
WindowHandle window_handle,
unsigned int message,
unsigned int w_param,
long l_param )
{
int x_pix;
int y_pix;
x_pix = LOWORD( l_param );
y_pix = HIWORD( l_param );
switch ( message ) {
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_RBUTTONDOWN:
break;
default:
break;
}
return( 0 );
}
/***************************************************************************
* WM_ACTIVATEAPP_FUNC -- Handles WM_ACTIVATEAPP *
* *
* INPUT: standard windows dialog command parameters *
* *
* OUTPUT: unused *
* *
* WARNINGS: none *
* *
* HISTORY: see PVCS log *
*=========================================================================*/
long WM_ActivateApp_Func(
WindowHandle window_handle,
unsigned int message,
unsigned int w_param,
long l_param )
{
return( 0 );
}
void Menu_Exit_Game( void )
{
PostMessage( Main_Window.Get_Window_Handle(), WM_CLOSE, 0, 0L );
}

77
WINVQ/VQAVIEW/WM.H Normal file
View File

@@ -0,0 +1,77 @@
/*
** Command & Conquer Red Alert(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 : VQAVIEW *
* *
* File Name : WM.H *
* *
* Programmer : Mike Grayford *
* *
* Start Date : November 20, 1995 *
* *
* Last Update : Nov 20, 1995 [MG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//==========================================================================
// Public functions
//==========================================================================
long WM_Command_Func(
WindowHandle window_handle,
unsigned int message,
WPARAM w_param,
LPARAM l_param );
long WM_Sys_Command_Func(
WindowHandle window_handle,
unsigned int message,
WPARAM w_param,
LPARAM l_param );
long WM_Paint_Func(
WindowHandle window_handle,
unsigned int message,
unsigned int w_param,
long l_param );
long WM_Mouse_Button_Func(
WindowHandle window_handle,
unsigned int message,
unsigned int w_param,
long l_param );
long WM_ActivateApp_Func(
WindowHandle window_handle,
unsigned int message,
unsigned int w_param,
long l_param );
long WM_Destroy_Func(
WindowHandle window_handle,
unsigned int message,
unsigned int w_param,
long l_param );

40
WINVQ/VQAVIEW/WWLIB.H Normal file
View File

@@ -0,0 +1,40 @@
/*
** Command & Conquer Red Alert(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 : VQAVIEW *
* *
* File Name : WWLIB.H *
* *
* Programmer : Michael Grayford *
* *
* Start Date : *
* *
* Last Update : Nov 22, 1995 [MG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
extern DirectDrawObjectPtr DirectDrawObject;
extern DirectDrawPalettePtr PalettePtr;
extern WindowHandle MainWindow;