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

153
WWFLAT32/INCLUDE/AUDIO.H Normal file
View File

@@ -0,0 +1,153 @@
/*
** 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 : Westwood 32 bit Library *
* *
* File Name : AUDIO.H *
* *
* Programmer : Phil W. Gorrow *
* *
* Start Date : March 10, 1995 *
* *
* Last Update : March 10, 1995 [PWG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include "wwstd.h"
/*=========================================================================*/
/* AUD file header type */
/*=========================================================================*/
#define AUD_FLAG_STEREO 1
#define AUD_FLAG_16BIT 2
// PWG 3-14-95: This structure used to have bit fields defined for Stereo
// and Bits. These were removed because watcom packs them into a 32 bit
// flag entry even though they could have fit in a 8 bit entry.
#pragma pack(1);
typedef struct {
short int Rate; // Playback rate (hertz).
long Size; // Size of data (bytes).
long UncompSize; // Size of data (bytes).
unsigned char Flags; // Holds flags for info
// 1: Is the sample stereo?
// 2: Is the sample 16 bits?
unsigned char Compression; // What kind of compression for this sample?
} AUDHeaderType;
/*=========================================================================*/
/* There can be a different sound driver for sound effects, digitized */
/* samples, and musical scores. Each one must be of these specified */
/* types. */
/*=========================================================================*/
typedef enum {
SAMPLE_NONE, // No digitized sounds will be played.
SAMPLE_SB, // Sound Blaster digitized driver.
SAMPLE_SBPRO, // Sound Blaster Pro digitized driver.
SAMPLE_PAS, // Pro-Audio Spectrum digitized driver.
SAMPLE_ADLIBG, // Adlib-Gold digitized driver.
SAMPLE_TANDY, // Tandy 'compatible' driver.
SAMPLE_PCSPKR, // PC speaker digitized driver (The Audio Solution driver).
SAMPLE_ADLIB, // Adlib digitized driver (The Audio Solution driver).
SAMPLE_TEMP=0x1000,
SAMPLE_LAST
} Sample_Type;
typedef enum {
SCORE_NONE, // No scores will be played.
SCORE_ALFX, // Westwood's ALFX adlib compatable driver.
SCORE_WWPCSPKR, // Westwood's PC-speaker driver (obsolete).
SCORE_WWTANDY, // Westwood's PC-speaker driver with Tandy mod (obsolete).
SCORE_PCSPKR, // PC speaker XMIDI driver.
SCORE_TANDY, // Tandy XMIDI driver.
SCORE_MT32, // MT-32 / LAPC-1 Roland XMIDI driver.
SCORE_CANVAS, // Sound Canvas SC-55.
SCORE_ADLIB, // Adlib XMIDI driver.
SCORE_ADLIBG, // Adlib Gold XMIDI driver.
SCORE_PASFM, // Pro Audio Spectrum XMIDI driver.
SCORE_SBFM, // Sound Blaster XMIDI driver.
SCORE_SBP1FM, // Sound Blaster Pro (YM3812) XMIDI driver.
SCORE_SBP2FM, // Sound Blaster Pro (OPL3) XMIDI driver (Can't use with SFX_ALFX).
SCORE_TEMP=0x1000,
SCORE_LAST
} Score_Type;
typedef enum {
SFX_NONE, // No sound effects will be played.
SFX_ALFX, // Westwood's ALFX adlib compatable driver.
SFX_WWPCSPKR, // Westwood's PC-speaker driver.
SFX_WWTANDY, // Westwood's PC-speaker driver with Tandy mod.
SFX_PCSPKR, // PC speaker XMIDI driver.
SFX_TANDY, // Tandy XMIDI driver.
SFX_MT32, // MT-32 / LAPC-1 Roland XMIDI driver.
SFX_CANVAS, // Sound Canvas SC-55.
SFX_ADLIB, // Adlib XMIDI driver.
SFX_ADLIBG, // Adlib Gold XMIDI driver.
SFX_PASFM, // Pro Audio Spectrum XMIDI driver.
SFX_SBFM, // Sound Blaster XMIDI driver.
SFX_SBP1FM, // Sound Blaster Pro (YM3812) XMIDI driver.
SFX_SBP2FM, // Sound Blaster Pro (OPL3) XMIDI driver.
SFX_TEMP=0x1000,
SFX_LAST
} SFX_Type;
typedef enum RateEnum {
PLAYBACK_RATE_SLOW =11025,
PLAYBACK_RATE_NORMAL =(11025 * 2),
PLAYBACK_RATE_FAST =(11025 * 4),
} RateType;
/*=========================================================================*/
/* The following prototypes are for the file: SOUNDIO.CPP */
/*=========================================================================*/
int File_Stream_Sample(char const *filename, BOOL real_time_start = FALSE);
int File_Stream_Sample_Vol(char const *filename, int volume, BOOL real_time_start = FALSE);
void cdecl _saveregs Sound_Callback(void);
void cdecl far __saveregs __loadds maintenance_callback(void);
void *Load_Sample(char const *filename);
long Load_Sample_Into_Buffer(char const *filename, void *buffer, long size);
long Sample_Read(int fh, void *buffer, long size);
void Free_Sample(void const *sample);
BOOL Sound_Init(int sfx, int score, int sample, RateType rate, int bits_per_sample, int max_samples, int reverse_channels);
BOOL Audio_Init(int sample, int address, int inter, int dma, RateType rate, int bits_per_sample, int max_samples, int reverse_channels = FALSE);
void Sound_End(void);
void Stop_Sample(int handle);
BOOL Sample_Status(int handle);
BOOL Is_Sample_Playing(void const * sample);
void Stop_Sample_Playing(void const * sample);
int Play_Sample(void const *sample, int priority=0xFF, int volume=0xFF, signed short panloc = 0x0);
int Play_Sample_Handle(void const *sample, int priority, int volume, signed short panloc, int id);
int Set_Sound_Vol(int volume);
int Set_Score_Vol(int volume);
void Fade_Sample(int handle, int ticks);
int Get_Free_Sample_Handle(int priority);
int Get_Digi_Handle(void);
long Sample_Length(void const *sample);
extern int Misc;
extern SFX_Type SoundType;
extern Sample_Type SampleType;
extern short StreamLowImpact;

129
WWFLAT32/INCLUDE/BUFFER.H Normal file
View File

@@ -0,0 +1,129 @@
/*
** 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 A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Westwood 32 Bit Library *
* *
* File Name : GBUFFER.H *
* *
* Programmer : Phil W. Gorrow *
* *
* Start Date : May 26, 1994 *
* *
* Last Update : July 5, 1994 [PWG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* BC::Get_Size -- Returns the buffer size of the BufferClass instance *
* BC::Get_Buffer -- Returns pointer to buffer inherent to BufferClass *
* BC::BufferClass -- inline constructor for BufferClass with size only *
* BC::To_Page -- Copys a buffer class to a page with definable x, y, w, h*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef BUFFER_H
#define BUFFER_H
/*=========================================================================*/
/* If we have not already loaded the standard library header, than we can */
/* load it. */
/*=========================================================================*/
#ifndef WWSTD_H
#include "wwstd.h"
#endif
class GraphicViewPortClass;
class VideoViewPortClass;
/*=========================================================================*/
/* BufferClass - A base class which holds buffer information including a */
/* pointer and the size of the buffer. */
/*=========================================================================*/
class BufferClass {
public:
/*===================================================================*/
/* Define the base constructor and destructors for the class */
/*===================================================================*/
BufferClass(void *ptr, long size);
BufferClass(long size);
BufferClass();
~BufferClass();
/*===================================================================*/
/* Define functions which work with the buffer class. */
/*===================================================================*/
long To_Page(GraphicViewPortClass &view);
long To_Page(int w, int h, GraphicViewPortClass &view);
long To_Page(int x, int y, int w, int h, GraphicViewPortClass &view);
long To_Page(VideoViewPortClass &view);
long To_Page(int w, int h, VideoViewPortClass &view);
long To_Page(int x, int y, int w, int h, VideoViewPortClass &view);
/*===================================================================*/
/* define functions to get at the protected data members */
/*===================================================================*/
void *Get_Buffer(void);
long Get_Size(void);
private:
/*===================================================================*/
/* Define the operators we do not want to happen which are the copy */
/* and equal constructors. These are bad because the Allocated flag */
/* could be copied and the associated buffer freed. If this were to */
/* gappen it could cause weird general protection fault. */
/*===================================================================*/
BufferClass(BufferClass const &);
BufferClass &operator=(BufferClass const &);
protected:
void *Buffer;
long Size;
BOOL Allocated;
};
/***************************************************************************
* BC::GET_SIZE -- Returns the buffer size of the BufferClass instance *
* *
* INPUT: none *
* *
* OUTPUT: long the size of the buffer *
* *
* HISTORY: *
* 06/01/1994 PWG : Created. *
*=========================================================================*/
inline long BufferClass::Get_Size(void)
{
return(Size);
}
/***************************************************************************
* BC::GET_BUFFER -- Returns pointer to buffer inherent to BufferClass *
* *
* INPUT: none *
* *
* OUTPUT: void * to the inherent buffer. *
* *
* HISTORY: *
* 06/01/1994 PWG : Created. *
*=========================================================================*/
inline void *BufferClass::Get_Buffer(void)
{
return(Buffer);
}
#endif

View File

@@ -0,0 +1,93 @@
/*
** 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 : WWLIB32 library *
* *
* File Name : DESCMGMT.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : August 3, 1994 *
* *
* Last Update : August 3, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef DESCMGMT_H
#define DESCMGMT_H
#ifndef WWSTD_H
#include "wwstd.h"
#endif
//=====================================================================
// C type include files
#ifdef __cplusplus
extern "C" {
#endif
#include <dos.h>
#include <bios.h>
#ifdef __cplusplus
}
#endif
// ====================================================================
// types
// These where taken from dos.h
//==========================================
// external functions
// ===================================================
extern ULONG Map_Segment_To_Address(ULONG address, ULONG length);
extern "C" {
// Assemble functions
extern UWORD FixSelector(UWORD sel);
extern UWORD GetDs(void);
extern UWORD GetCs(void);
extern VOID GetDefaultSelectors(VOID);
extern UWORD Get_Standard_Selector(void);
// Assembly data variables
extern UWORD CodeSelector;
extern UWORD DataSelector;
extern UWORD ScreenSelector;
extern UWORD GraphicsSelector;
extern UWORD PspSelector;
extern UWORD EnvSelector;
extern UWORD DosMemSelector;
extern UWORD Fp1167Selector;
extern UWORD FpWeitekSelector;
extern UWORD FpCyrixSelector;
}
#endif // DESCMGMT_H


1448
WWFLAT32/INCLUDE/DIFFTB.INC Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
/*
** 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/>.
*/
int Dip_Text(char const *source, char *dest);
int UnDip_Text(char const *source, char *dest);
char *Extract_String(void const *data, int string);
void Fixup_Text(char const *source, char *dest);
extern char Common[];
extern char Dipthong[16][8];

261
WWFLAT32/INCLUDE/FILE.H 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 A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Library - Filio header stuff. *
* *
* File Name : FILE.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : September 13, 1993 *
* *
* Last Update : April 11, 1994 *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef FILE_H
#define FILE_H
#ifndef ERROR
#define ERROR -1
#endif
#ifndef FILETEMP_H
// This should be removed once the library is all intacked.
#include "filetemp.h"
#endif
/*=========================================================================*/
/* File IO system defines and enumerations */
/*=========================================================================*/
#define XMAXPATH 80
/*
** These are the Open_File, Read_File, and Seek_File constants.
*/
#define READ 1 // Read access.
#define WRITE 2 // Write access.
#ifndef SEEK_SET
#define SEEK_SET 0 // Seek from start of file.
#define SEEK_CUR 1 // Seek relative from current location.
#define SEEK_END 2 // Seek from end of file.
#endif
typedef enum {
FILEB_PROCESSED=8,// Was the packed file header of this file processed?
FILEB_PRELOAD, // Scan for and make file resident at WWDOS_Init time?
FILEB_RESIDENT, // Make resident at Open_File time?
FILEB_FLUSH, // Un-resident at Close_File time?
FILEB_PACKED, // Is this file packed?
FILEB_KEEP, // Don't ever flush this resident file?
FILEB_PRIORITY, // Flush this file last?
FILEB_LAST
} FileFlags_Type;
#define FILEF_NONE 0
#define FILEF_PROCESSED (1<<FILEB_PROCESSED)
#define FILEF_PRELOAD (1<<FILEB_PRELOAD)
#define FILEF_RESIDENT (1<<FILEB_RESIDENT)
#define FILEF_FLUSH (1<<FILEB_FLUSH)
#define FILEF_PACKED (1<<FILEB_PACKED)
#define FILEF_KEEP (1<<FILEB_KEEP)
#define FILEF_PRIORITY (1<<FILEB_PRIORITY)
/*
** These errors are returned by WWDOS_Init(). All errors encountered are
** or'd together so there may be more then one error returned. Not all
** errors are fatal, such as the cache errors.
*/
typedef enum {
FI_SUCCESS = 0x00,
FI_CACHE_TOO_BIG = 0x01,
FI_CACHE_ALREADY_INIT = 0x02,
FI_FILEDATA_FILE_NOT_FOUND = 0x04,
FI_FILEDATA_TOO_BIG = 0x08,
FI_SEARCH_PATH_NOT_FOUND = 0x10,
FI_STARTUP_PATH_NOT_FOUND = 0x20,
FI_NO_CACHE_FOR_PRELOAD = 0x40,
FI_FILETABLE_NOT_INIT = 0x80,
} FileInitErrorType;
/*
** These are the errors that are detected by the File I/O system and
** passed to the io error routine.
*/
//lint -strong(AJX,FileErrorType)
typedef enum {
CANT_CREATE_FILE,
BAD_OPEN_MODE,
COULD_NOT_OPEN,
TOO_MANY_FILES,
CLOSING_NON_HANDLE,
READING_NON_HANDLE,
WRITING_NON_HANDLE,
SEEKING_NON_HANDLE,
SEEKING_BAD_OFFSET,
WRITING_RESIDENT,
UNKNOWN_INDEX,
DID_NOT_CLOSE,
FATAL_ERROR,
FILE_NOT_LISTED,
FILE_LENGTH_MISMATCH,
INTERNAL_ERROR,
MAKE_RESIDENT_ZERO_SIZE,
RESIDENT_SORT_FAILURE,
NUMBER_OF_ERRORS /* MAKE SURE THIS IS THE LAST ENTRY */
} FileErrorType;
// This is here tempararaly until library is put together.
//extern WORD cdecl (*cdecl IO_Error)(FileErrorType error, BYTE const *filename);
extern short (*Open_Error)(FileErrorType, BYTE const *);
/*=========================================================================*/
/* File IO system structures */
/*=========================================================================*/
//lint -strong(AJX,FileDataType)
typedef struct {
char *Name; // File name (include sub-directory but not volume).
long Size; // File size (0=indeterminate).
void *Ptr; // Resident file pointer.
long Start; // Starting offset in DOS handle file.
unsigned char Disk; // Disk number location.
unsigned char OpenCount; // Count of open locks on resident file.
unsigned short Flag; // File control flags.
} FileDataType;
/*=========================================================================*/
/* FIle IO system globals. */
/*=========================================================================*/
// These are cpp errors in funtions declarations JULIO JEREZ
// extern FileDataType cdecl FileData[];
// extern BYTE cdecl ExecPath[XMAXPATH + 1];
// extern BYTE cdecl DataPath[XMAXPATH + 1];
// extern BYTE cdecl StartPath[XMAXPATH + 1];
// extern BOOL cdecl UseCD;
// The correct syntax is NO TYPE MODIFIER APPLY TO DATA DECLARATIONS
extern FileDataType FileData[];
extern char ExecPath[XMAXPATH + 1];
extern char DataPath[XMAXPATH + 1];
extern char StartPath[XMAXPATH + 1];
extern BOOL UseCD;
/*=========================================================================*/
/* The following prototypes are for the file: FILEINIT.CPP */
/*=========================================================================*/
void cdecl WWDOS_Shutdown(void);
FileInitErrorType cdecl WWDOS_Init(unsigned long cachesize, char *filedata, char *cdpath);
/*=========================================================================*/
/* The following prototypes are for the file: FILE.CPP */
/*=========================================================================*/
int cdecl Open_File(char const *file_name, int mode);
void cdecl Close_File(int handle);
long cdecl Read_File(int handle, void *buf, unsigned long bytes);
long cdecl Write_File(int handle, void const *buf, unsigned long bytes);
unsigned long cdecl Seek_File(int handle, long offset, int starting);
int cdecl File_Exists(char const *file_name);
unsigned long cdecl File_Size(int handle);
BOOL cdecl Is_Handle_Valid(int handle, FileErrorType error, char const *name);
int cdecl Open_File_With_Recovery( char const *file_name, unsigned int mode );
/*=========================================================================*/
/* The following prototypes are for the file: FILECACH.CPP */
/*=========================================================================*/
void Unfragment_File_Cache(void);
BOOL cdecl Make_File_Resident(char const *filename);
short cdecl Flush_Unused_File_Cache(short flush_keeps);
BOOL cdecl Free_Resident_File(char const *file);
/*=========================================================================*/
/* The following prototypes are for the file: FILECHNG.CPP */
/*=========================================================================*/
short cdecl Create_File(char const *file_name);
short cdecl Delete_File(char const *file_name);
BOOL cdecl Change_File_Size(short handle, unsigned long new_size);
/*=========================================================================*/
/* The following prototypes are for the file: FILEINFO.CPP */
/*=========================================================================*/
short cdecl Get_DOS_Handle(short fh);
short cdecl Free_Handles(void);
short cdecl Find_Disk_Number(char const *file_name);
short cdecl Set_File_Flags(char const *filename, short flags);
short cdecl Clear_File_Flags(char const *filename, short flags);
short cdecl Get_File_Flags(char const *filename);
BOOL cdecl Multi_Drive_Search(BOOL on);
/*=========================================================================*/
/* The following prototypes are for the file: FINDFILE.CPP */
/*=========================================================================*/
int cdecl Find_File(char const *file_name);
int cdecl Find_File_Index(char const *filename);
/*=========================================================================*/
/* The following prototypes are for the file: FFIRST.ASM */
/*=========================================================================*/
#include <dos.h>
#ifdef __cplusplus
extern "C" {
#endif
extern short Find_First(unsigned char *fname, unsigned short mode, struct find_t *ffblk);
extern short Find_Next(struct find_t *ffblk);
#ifdef __cplusplus
}
#endif
#endif // FILE_H


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 A S S O C I A T E S **
;***************************************************************************
;* *
;* Project Name : iff *
;* *
;* File Name : FILEPCX.H *
;* *
;* Programmer : Julio R. Jerez *
;* *
;* Start Date : May 2, 1995 *
;* *
;* Last Update : May 2, 1995 [JRJ] *
;* *
;*-------------------------------------------------------------------------*
;* Functions: *
;* GraphicBufferClass* Read_PCX_File (char* name, BYTE* palette,void *buff, long size);
;* GraphicBufferClass* Read_PCX_File (char* name, BYTE* palette, BufferClass& Buff);
;* int Write_PCX_File (char* name, GraphicViewPortClass& pic, BYTE* palette );*
;*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
#include <string.h>
#include <buffer.h>
#include <gbuffer.h>
#include <file.h>
#ifndef PCX_H
#define PCX_H
typedef struct {
char red ;
char green ;
char blue ;
} RGB ;
typedef struct {
char id ;
char version ;
char encoding ;
char pixelsize ;
short x ;
short y ;
short width ;
short height ;
short xres ;
short yres ;
RGB ega_palette [ 16 ] ;
char nothing ;
char color_planes ;
short byte_per_line ;
short palette_type ;
char filler [ 58 ] ;
} PCX_HEADER ;
GraphicBufferClass* Read_PCX_File (char* name, BYTE* palette= NULL,void *buff=NULL, long size=0);
GraphicBufferClass* Read_PCX_File (char* name, BufferClass& Buff,BYTE* palette= NULL) ;
int Write_PCX_File (char* name, GraphicViewPortClass& pic ,BYTE* palette ) ;
#endif

View File

@@ -0,0 +1,60 @@
/*
** 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 A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Temp header for file routines. *
* *
* File Name : FILETEMP.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : April 20, 1994 *
* *
* Last Update : April 20, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef FILETEMP_H
#define FILETEMP_H
/////////////////////////////////////////////////////////////////////
// THIS DOES NOT BELONG HERE. IT WAS PUT HERE JUST TO GET THE THING
// TO COMPILE. ONCE THE BUFFER AND PAGE SYSTEMS ARE PUT IN, THESE
// WILL NEED TO BE TAKEN OUT AND MODS MADE TO ANY FUNCTION USING BuffType.
// SKB 4/20/94.
/*=========================================================================*/
/* Defines and such that must go into wwstd.h */
/*=========================================================================*/
// Look at FileErrorType below for the IO_Error function.
//extern WORD cdecl (*cdecl IO_Error)(FileErrorType error, BYTE const *filename);
VOID cdecl Prog_End(VOID);
extern WORD Hard_Error_Occured;
//////////////////////// END OF DON'T BELONG //////////////////////////////////
#endif //FILETEMP_H

122
WWFLAT32/INCLUDE/FONT.BAK Normal file
View File

@@ -0,0 +1,122 @@
/*
** 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 : Font and text print 32 bit library *
* *
* File Name : FONT.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : June 27, 1994 *
* *
* Last Update : June 29, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* VVPC::Text_Print -- Text print into a virtual viewport. *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef FONT_H
#define FONT_H
#ifndef GBUFFER_H
#include <gbuffer.h>
#endif
#ifndef VBUFFER_H
#include <vbuffer.h>
#endif
//////////////////////////////////////// Defines //////////////////////////////////////////
// defines for font header, offsets to block offsets
#define FONTINFOBLOCK 4
#define FONTOFFSETBLOCK 6
#define FONTWIDTHBLOCK 8
#define FONTDATABLOCK 10
#define FONTHEIGHTBLOCK 12
// defines for font info block
#define FONTINFOMAXHEIGHT 4
#define FONTINFOMAXWIDTH 5
//////////////////////////////////////// Prototypes //////////////////////////////////////////
/*=========================================================================*/
/* The following prototypes are for the file: SET_FONT.CPP */
/*=========================================================================*/
VOID *cdecl Set_Font(VOID const *fontptr);
/*=========================================================================*/
/* The following prototypes are for the file: FONT.CPP */
/*=========================================================================*/
WORD cdecl Char_Pixel_Width(BYTE chr);
UWORD cdecl String_Pixel_Width(BYTE const *string);
VOID cdecl Get_Next_Text_Print_XY(GraphicViewPortClass& vp, ULONG offset, INT *x, INT *y);
VOID cdecl Get_Next_Text_Print_XY(VideoViewPortClass& vp, ULONG offset, INT *x, INT *y);
/*=========================================================================*/
/* The following prototypes are for the file: LOADFONT.CPP */
/*=========================================================================*/
VOID *cdecl Load_Font(BYTE const *name);
/*=========================================================================*/
/* The following prototypes are for the file: TEXTPRNT.ASM */
/*=========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
VOID Set_Font_Palette_Range(VOID const *palette, INT start_idx, INT end_idx);
#ifdef __cplusplus
}
#endif
/*=========================================================================*/
//////////////////////////////////////// External varables ///////////////////////////////////////
extern "C" int FontXSpacing;
extern "C" int FontYSpacing;
extern BYTE FontWidth ;
extern BYTE FontHeight;
extern BYTE *FontWidthBlockPtr;
extern "C" VOID const *FontPtr;
#endif // FONT_H

122
WWFLAT32/INCLUDE/FONT.H Normal file
View File

@@ -0,0 +1,122 @@
/*
** 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 : Font and text print 32 bit library *
* *
* File Name : FONT.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : June 27, 1994 *
* *
* Last Update : June 29, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* VVPC::Text_Print -- Text print into a virtual viewport. *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef FONT_H
#define FONT_H
#ifndef GBUFFER_H
#include <gbuffer.h>
#endif
#ifndef VBUFFER_H
#include <vbuffer.h>
#endif
//////////////////////////////////////// Defines //////////////////////////////////////////
// defines for font header, offsets to block offsets
#define FONTINFOBLOCK 4
#define FONTOFFSETBLOCK 6
#define FONTWIDTHBLOCK 8
#define FONTDATABLOCK 10
#define FONTHEIGHTBLOCK 12
// defines for font info block
#define FONTINFOMAXHEIGHT 4
#define FONTINFOMAXWIDTH 5
//////////////////////////////////////// Prototypes //////////////////////////////////////////
/*=========================================================================*/
/* The following prototypes are for the file: SET_FONT.CPP */
/*=========================================================================*/
VOID *cdecl Set_Font(VOID const *fontptr);
/*=========================================================================*/
/* The following prototypes are for the file: FONT.CPP */
/*=========================================================================*/
WORD cdecl Char_Pixel_Width(BYTE chr);
UWORD cdecl String_Pixel_Width(BYTE const *string);
VOID cdecl Get_Next_Text_Print_XY(GraphicViewPortClass& vp, ULONG offset, INT *x, INT *y);
VOID cdecl Get_Next_Text_Print_XY(VideoViewPortClass& vp, ULONG offset, INT *x, INT *y);
/*=========================================================================*/
/* The following prototypes are for the file: LOADFONT.CPP */
/*=========================================================================*/
VOID *cdecl Load_Font(BYTE const *name);
/*=========================================================================*/
/* The following prototypes are for the file: TEXTPRNT.ASM */
/*=========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
VOID Set_Font_Palette_Range(VOID const *palette, INT start_idx, INT end_idx);
#ifdef __cplusplus
}
#endif
/*=========================================================================*/
//////////////////////////////////////// External varables ///////////////////////////////////////
extern "C" int FontXSpacing;
extern "C" int FontYSpacing;
extern BYTE FontWidth ;
extern BYTE FontHeight;
extern BYTE *FontWidthBlockPtr;
extern "C" void const *FontPtr;
#endif // FONT_H

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/>.
*/
/*=========================================================================*/
/* The following prototypes are for the file: SOUNDIO.CPP */
/*=========================================================================*/
short Decompress_Frame(void * source, void * dest, short size);
int cdecl Stream_Sample_Vol(void *buffer, long size, BOOL (*callback);
int cdecl Stream_Sample(void *buffer, long size, BOOL (*callback);
int cdecl File_Stream_Sample(char const *filename);
int cdecl File_Stream_Sample_Vol(char const *filename, int volume);
void cdecl _saveregs _loadds Sound_Callback(void);
void cdecl far _saveregs _loadds maintenance_callback(void);
void *cdecl Load_Sample(char const *filename);
long cdecl Load_Sample_Into_Buffer(char const *filename, void *buffer, long size);
long cdecl Sample_Read(int fh, void *buffer, long size);
void cdecl Free_Sample(void const *sample);
BOOL cdecl Sound_Init(int sfx, int score, int sample);
void far VQA_TimerCallback(void);
BOOL Audio_Init(int sample, int address, int inter, int dma);
void cdecl Sound_End(void);
void cdecl Stop_Sample(int handle);
BOOL cdecl Sample_Status(int handle);
BOOL cdecl Is_Sample_Playing(void const * sample);
void cdecl Stop_Sample_Playing(void const * sample);
int cdecl Play_Sample(void const *sample);
int cdecl Play_Sample_Vol(void const *sample, int priority, int volume);
int cdecl Set_Sound_Vol(int volume);
int cdecl Set_Score_Vol(int volume);
void cdecl Fade_Sample(int handle, int ticks);

View File

@@ -0,0 +1,892 @@
/*
** 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 A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Westwood 32 Bit Library *
* *
* File Name : GBUFFER.H *
* *
* Programmer : Phil W. Gorrow *
* *
* Start Date : May 26, 1994 *
* *
* Last Update : January 17, 1995 [PWG] *
* *
***************************************************************************
* *
* This module contains the definition for the graphic buffer class. The *
* primary functionality of the graphic buffer class is handled by inline *
* functions that make a call through function pointers to the correct *
* routine. This has two benefits: *
* *
* *
* 1) C++ name mangling is not a big deal since the function pointers *
* point to functions in standard C format. *
* 2) The function pointers can be changed when we set a different *
* graphic mode. This allows us to have both supervga and mcga *
* routines present in memory at once. *
* *
* In the basic library, these functions point to stub routines which just *
* return. This makes a product that just uses a graphic buffer take the *
* minimum amount of code space. For programs that require MCGA or VESA *
* support, all that is necessary to do is link either the MCGA or VESA *
* specific libraries in, previous to WWLIB32. The linker will then *
* overide the the necessary stub functions automatically. *
* *
* In addition, there are helpful inline function calls for parameter *
* ellimination. This header file gives the defintion for all *
* GraphicViewPort and GraphicBuffer classes. *
* *
* Terminology: *
* *
* Buffer Class - A class which consists of a pointer to an allocated *
* buffer and the size of the buffer that was allocated. *
* *
* Graphic ViewPort - The Graphic ViewPort defines a window into a *
* Graphic Buffer. This means that although a Graphic Buffer *
* represents linear memory, this may not be true with a Graphic *
* Viewport. All low level functions that act directly on a graphic *
* viewport are included within this class. This includes but is not *
* limited to most of the functions which can act on a Video Viewport *
* Video Buffer. *
* *
* Graphic Buffer - A Graphic Buffer is an instance of an allocated buffer *
* used to represent a rectangular region of graphics memory. *
* The HidBuff and BackBuff are excellent examples of a Graphic Buffer. *
* *
* Below is a tree which shows the relationship of the VideoBuffer and *
* Buffer classes to the GraphicBuffer class: *
* *
* BUFFER.H GBUFFER.H BUFFER.H VBUFFER.H *
* ---------- ---------- ---------- ---------- *
* | Buffer | | Graphic | | Buffer | | Video | *
* | Class | | ViewPort | | Class | | ViewPort | *
* ---------- ---------- ---------- ---------- *
* \ / \ / *
* \ / \ / *
* ---------- ---------- *
* | Graphic | | Video | *
* | Buffer | | Buffer | *
* ---------- ---------- *
* GBUFFER.H VBUFFER.H *
*-------------------------------------------------------------------------*
* Functions: *
* GBC::GraphicBufferClass -- inline constructor for GraphicBufferClass *
* GVPC::Remap -- Short form to remap an entire graphic view port *
* GVPC::Get_XPos -- Returns x offset for a graphic viewport class *
* GVPC::Get_Ypos -- Return y offset in a GraphicViewPortClass *
* VVPC::Get_XPos -- Get the x pos of the VP on the Video *
* VVPC::Get_YPos -- Get the y pos of the VP on the video *
* GBC::Get_Graphic_Buffer -- Get the graphic buffer of the VP. *
* GVPC::Draw_Line -- Stub function to draw line in Graphic Viewport Class*
* GVPC::Fill_Rect -- Stub function to fill rectangle in a GVPC *
* GVPC::Remap -- Stub function to remap a GVPC *
* GVPC::Print -- stub func to print a text string *
* GVPC::Print -- Stub function to print an integer *
* GVPC::Print -- Stub function to print a short to a graphic viewport *
* GVPC::Print -- stub function to print a long on a graphic view port *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include "window.h"
#ifndef GBUFFER_H
#define GBUFFER_H
/*=========================================================================*/
/* If we have not already loaded the standard library header, than we can */
/* load it. */
/*=========================================================================*/
#ifndef WWSTD_H
#include "wwstd.h"
#endif
#ifndef MCGAPRIM_H
#include "mcgaprim.h"
#endif
#ifndef BUFFER_H
#include "buffer.h"
#endif
#include <stdlib.h>
/*=========================================================================*/
/* Define the screen width and height to make portability to other modules */
/* easier. */
/*=========================================================================*/
#define DEFAULT_SCREEN_WIDTH 320
#define DEFAULT_SCREEN_HEIGHT 200
/*=========================================================================*/
/* Let the compiler know that a GraphicBufferClass exists so that it can */
/* keep a pointer to it in a VideoViewPortClass. */
/*=========================================================================*/
class GraphicViewPortClass;
class GraphicBufferClass;
class VideoViewPortClass;
class VideoBufferClass;
GraphicBufferClass *Set_Logic_Page(GraphicBufferClass *ptr);
GraphicBufferClass *Set_Logic_Page(GraphicBufferClass &ptr);
/*=========================================================================*/
/* GraphicViewPortClass - Holds viewport information on a viewport which */
/* has been attached to a GraphicBuffer. A viewport is effectively a */
/* rectangular subset of the full buffer which is used for clipping and */
/* the like. */
/* */
/* char *Buffer - is the offset to view port buffer */
/* int Width - is the width of view port */
/* int Height - is the height of view port */
/* int XAdd - is add value to go from the end of a line */
/* to the beginning of the next line */
/* int XPos; - x offset into its associated VideoBuffer */
/* int YPos; - y offset into its associated VideoBuffer */
/*=========================================================================*/
class GraphicViewPortClass {
public:
/*===================================================================*/
/* Define the base constructor and destructors for the class */
/*===================================================================*/
GraphicViewPortClass(GraphicBufferClass* graphic_buff, int x, int y, int w, int h);
GraphicViewPortClass();
~GraphicViewPortClass();
/*===================================================================*/
/* define functions to get at the private data members */
/*===================================================================*/
long Get_Offset(void);
int Get_Height(void);
int Get_Width(void);
int Get_XAdd(void);
int Get_XPos(void);
int Get_YPos(void);
GraphicBufferClass *Get_Graphic_Buffer(void);
int Lock(void) const {return(TRUE);}
void Unlock(void) const {}
/*===================================================================*/
/* Define a function which allows us to change a video viewport on */
/* the fly. */
/*===================================================================*/
BOOL Change(int x, int y, int w, int h);
/*===================================================================*/
/* Define the set of common graphic functions that are supported by */
/* both Graphic ViewPorts and VideoViewPorts. */
/*===================================================================*/
long Size_Of_Region(int w, int h);
void Put_Pixel(int x, int y, unsigned char color);
int Get_Pixel(int x, int y);
void Clear(unsigned char color = 0);
long To_Buffer(int x, int y, int w, int h, void *buff, long size);
long To_Buffer(int x, int y, int w, int h, BufferClass *buff);
long To_Buffer(BufferClass *buff);
BOOL Blit( GraphicViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans = FALSE);
BOOL Blit( GraphicViewPortClass& dest, int dx, int dy, BOOL trans = FALSE);
BOOL Blit( GraphicViewPortClass& dest, BOOL trans = FALSE);
BOOL Blit( VideoViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans = FALSE);
BOOL Blit( VideoViewPortClass& dest, int dx, int dy, BOOL trans = FALSE);
BOOL Blit( VideoViewPortClass& dest, BOOL trans = FALSE);
BOOL Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans = FALSE, char *remap = NULL);
BOOL Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap);
BOOL Scale( GraphicViewPortClass &dest, BOOL trans = FALSE, char *remap = NULL);
BOOL Scale( GraphicViewPortClass &dest, char *remap);
BOOL Scale( VideoViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans = FALSE, char *remap = NULL);
BOOL Scale( VideoViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap);
BOOL Scale( VideoViewPortClass &dest, BOOL trans = FALSE, char *remap = NULL);
BOOL Scale( VideoViewPortClass &dest, char *remap);
unsigned long Print(char const *string, int x_pixel, int y_pixel, int fcolor, int bcolor);
unsigned long Print(short num, int x_pixel, int y_pixel, int fcol, int bcol);
unsigned long Print(int num, int x_pixel, int y_pixel, int fcol, int bcol);
unsigned long Print(long num, int x_pixel, int y_pixel, int fcol, int bcol);
/*===================================================================*/
/* Define the list of graphic functions which work only with a */
/* graphic buffer. */
/*===================================================================*/
VOID Draw_Line(int sx, int sy, int dx, int dy, unsigned char color);
VOID Draw_Rect(int sx, int sy, int dx, int dy, unsigned char color);
VOID Fill_Rect(int sx, int sy, int dx, int dy, unsigned char color);
VOID Fill_Quad(VOID *span_buff, int x0, int y0, int x1, int y1,
int x2, int y2, int x3, int y3, int color);
VOID Remap(int sx, int sy, int width, int height, VOID *remap);
VOID Remap(VOID *remap);
void Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap);
void Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap, int clip_window);
VOID Grey_Out_Region(int x, int y, int width, int height, int color);
protected:
/*===================================================================*/
/* Define functions to attach the viewport to a graphicbuffer */
/*===================================================================*/
VOID Attach(GraphicBufferClass *graphic_buff, int x, int y, int w, int h);
void Attach(GraphicBufferClass *video_buff, int w, int h);
/*===================================================================*/
/* Define the data used by a GraphicViewPortClass */
/*===================================================================*/
long Offset; // offset to graphic page
int Width; // width of graphic page
int Height; // height of graphic page
int XAdd; // xadd for graphic page (0)
int XPos; // x offset in relation to graphicbuff
int YPos; // y offset in relation to graphicbuff
GraphicBufferClass *GraphicBuff; // related graphic buff
};
/*=========================================================================*/
/* GraphicBufferClass - A GraphicBuffer refers to an actual instance of an */
/* allocated buffer. The GraphicBuffer may be drawn to directly */
/* becuase it inherits a ViewPort which represents its physcial size. */
/* */
/* BYTE *Buffer - is the offset to graphic buffer */
/* int Width - is the width of graphic buffer */
/* int Height - is the height of graphic buffer */
/* int XAdd - is the xadd of graphic buffer */
/* int XPos; - will be 0 because it is graphicbuff */
/* int YPos; - will be 0 because it is graphicbuff */
/*=========================================================================*/
class GraphicBufferClass : public GraphicViewPortClass, public BufferClass {
public:
GraphicBufferClass( long size = 64500, int w = DEFAULT_SCREEN_WIDTH, int h = DEFAULT_SCREEN_HEIGHT,
VOID *buffer = 0);
GraphicBufferClass(int w, int h, void *buffer = 0);
~GraphicBufferClass();
// void Scale_Rotate(BitmapClass &bmp,const TPoint2D &pt,long scale=0x0100,unsigned char angle=0);
};
/***************************************************************************
* GVPC::GET_OFFSET -- Get offset for virtual view port class instance *
* *
* INPUT: none *
* *
* OUTPUT: long the offset for the virtual viewport instance *
* *
* HISTORY: *
* 06/07/1994 PWG : Created. *
*=========================================================================*/
inline long GraphicViewPortClass::Get_Offset(void)
{
return(Offset);
}
/***************************************************************************
* GVPC::GET_HEIGHT -- Gets the height of a virtual viewport instance *
* *
* INPUT: none *
* *
* OUTPUT: WORD the height of the virtual viewport instance *
* *
* HISTORY: *
* 06/07/1994 PWG : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_Height(void)
{
return(Height);
}
/***************************************************************************
* GVPC::GET_WIDTH -- Get the width of a virtual viewport instance *
* *
* INPUT: none *
* *
* OUTPUT: WORD the width of the virtual viewport instance *
* *
* HISTORY: *
* 06/07/1994 PWG : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_Width(void)
{
return(Width);
}
/***************************************************************************
* GVPC::GET_XADD -- Get the X add offset for virtual viewport instance *
* *
* INPUT: none *
* *
* OUTPUT: WORD the xadd for a virtual viewport instance *
* *
* HISTORY: *
* 06/07/1994 PWG : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_XAdd(void)
{
return(XAdd);
}
/***************************************************************************
* GVPC::GET_XPOS -- Get the x pos of the VP on the Video *
* *
* INPUT: none *
* *
* OUTPUT: WORD the x offset to VideoBufferClass *
* *
* HISTORY: *
;* 08/22/1994 SKB : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_XPos(void)
{
return(XPos);
}
/***************************************************************************
* GVPC::GET_YPOS -- Get the y pos of the VP on the video *
* *
* INPUT: none *
* *
* OUTPUT: WORD the x offset to VideoBufferClass *
* *
* WARNINGS: *
* *
* HISTORY: *
;* 08/22/1994 SKB : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_YPos(void)
{
return(YPos);
}
/***************************************************************************
* GVPC::GET_GRAPHIC_BUFFER -- Get the graphic buffer of the VP. *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* HISTORY: *
* 08/22/1994 SKB : Created. *
*=========================================================================*/
inline GraphicBufferClass *GraphicViewPortClass::Get_Graphic_Buffer(void)
{
return (GraphicBuff);
}
/***************************************************************************
* GVPC::SIZE_OF_REGION -- stub to call curr graphic mode Size_Of_Region *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 03/01/1995 BWG : Created. *
*=========================================================================*/
inline long GraphicViewPortClass::Size_Of_Region(int w, int h)
{
return MCGA_Size_Of_Region(this, w, h);
}
/***************************************************************************
* GVPC::PUT_PIXEL -- stub to call curr graphic mode Put_Pixel *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline void GraphicViewPortClass::Put_Pixel(int x, int y, unsigned char color)
{
MCGA_Put_Pixel(this, x, y, color);
}
/***************************************************************************
* GVPC::GET_PIXEL -- stub to call curr graphic mode Get_Pixel *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_Pixel(int x, int y)
{
return(MCGA_Get_Pixel(this, x, y));
}
/***************************************************************************
* GVPC::CLEAR -- stub to call curr graphic mode Clear *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline void GraphicViewPortClass::Clear(unsigned char color)
{
MCGA_Clear(this, color);
}
/***************************************************************************
* GVPC::TO_BUFFER -- stub 1 to call curr graphic mode To_Buffer *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline long GraphicViewPortClass::To_Buffer(int x, int y, int w, int h, void *buff, long size)
{
return(MCGA_To_Buffer(this, x, y, w, h, buff, size));
}
/***************************************************************************
* GVPC::TO_BUFFER -- stub 2 to call curr graphic mode To_Buffer *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline long GraphicViewPortClass::To_Buffer(int x, int y, int w, int h, BufferClass *buff)
{
return(MCGA_To_Buffer(this, x, y, w, h, buff->Get_Buffer(), buff->Get_Size()));
}
/***************************************************************************
* GVPC::TO_BUFFER -- stub 3 to call curr graphic mode To_Buffer *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline long GraphicViewPortClass::To_Buffer(BufferClass *buff)
{
return(MCGA_To_Buffer(this, 0, 0, Width, Height, buff->Get_Buffer(), buff->Get_Size()));
}
/***************************************************************************
* GVPC::BLIT -- stub 1 to call curr graphic mode Blit to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Blit( GraphicViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans)
{
return(Linear_Blit_To_Linear(this, &dest, x_pixel, y_pixel, dx_pixel, dy_pixel, pixel_width, pixel_height, trans));
}
/***************************************************************************
* GVPC::BLIT -- Stub 2 to call curr graphic mode Blit to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Blit( GraphicViewPortClass& dest, int dx, int dy, BOOL trans)
{
return(Linear_Blit_To_Linear(this, &dest, 0, 0, dx, dy, Width, Height, trans));
}
/***************************************************************************
* GVPC::BLIT -- stub 3 to call curr graphic mode Blit to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Blit( GraphicViewPortClass& dest, BOOL trans)
{
return(Linear_Blit_To_Linear(this, &dest, 0, 0, 0, 0, Width, Height, trans));
}
/***************************************************************************
* GVPC::SCALE -- stub 1 to call curr graphic mode Scale to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans, char *remap)
{
return(Linear_Scale_To_Linear(this, &dest, src_x, src_y, dst_x, dst_y, src_w, src_h, dst_w, dst_h, trans, remap));
}
/***************************************************************************
* GVPC::SCALE -- stub 2 to call curr graphic mode Scale to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap)
{
return(Linear_Scale_To_Linear(this, &dest, src_x, src_y, dst_x, dst_y, src_w, src_h, dst_w, dst_h, FALSE, remap));
}
/***************************************************************************
* GVPC::SCALE -- stub 3 to call curr graphic mode Scale to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, BOOL trans, char *remap)
{
return(Linear_Scale_To_Linear(this, &dest, 0, 0, 0, 0, Width, Height, dest.Get_Width(), dest.Get_Height(), trans, remap));
}
/***************************************************************************
* GVPC::SCALE -- stub 4 to call curr graphic mode Scale to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, char *remap)
{
return(Linear_Scale_To_Linear(this, &dest, 0, 0, 0, 0, Width, Height, dest.Get_Width(), dest.Get_Height(), FALSE, remap));
}
/***************************************************************************
* GVPC::PRINT -- stub func to print a text string *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/17/1995 PWG : Created. *
*=========================================================================*/
inline unsigned long GraphicViewPortClass::Print(char const *str, int x, int y, int fcol, int bcol)
{
return(MCGA_Print(this, str, x, y, fcol, bcol));
}
/***************************************************************************
* GVPC::PRINT -- Stub function to print an integer *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
*=========================================================================*/
inline unsigned long GraphicViewPortClass::Print(int num, int x, int y, int fcol, int bcol)
{
char str[17];
return(MCGA_Print(this, itoa(num, str, 10), x, y, fcol, bcol));
}
/***************************************************************************
* GVPC::PRINT -- Stub function to print a short to a graphic viewport *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
*=========================================================================*/
inline unsigned long GraphicViewPortClass::Print(short num, int x, int y, int fcol, int bcol)
{
char str[17];
return(MCGA_Print(this, itoa(num, str, 10), x, y, fcol, bcol));
}
/***************************************************************************
* GVPC::PRINT -- stub function to print a long on a graphic view port *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
*=========================================================================*/
inline unsigned long GraphicViewPortClass::Print(long num, int x, int y, int fcol, int bcol)
{
char str[33];
return(MCGA_Print(this, ltoa(num, str,10), x, y, fcol, bcol));
}
/***************************************************************************
* GVPC::DRAW_STAMP -- stub function to draw a tile on a graphic view port *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
*=========================================================================*/
inline void GraphicViewPortClass::Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap)
{
MCGA_Draw_Stamp(this, icondata, icon, x_pixel, y_pixel, remap);
}
/***************************************************************************
* GVPC::DRAW_STAMP -- stub function to draw a tile on a graphic view port *
* This version clips the tile to a window *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 07/31/1995 BWG : Created. *
*=========================================================================*/
inline void GraphicViewPortClass::Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap, int clip_window)
{
MCGA_Draw_Stamp_Clip(this, icondata, icon, x_pixel, y_pixel, remap, WindowList[clip_window][WINDOWX], WindowList[clip_window][WINDOWY], WindowList[clip_window][WINDOWWIDTH], WindowList[clip_window][WINDOWHEIGHT]);
}
/***************************************************************************
* GVPC::DRAW_LINE -- Stub function to draw line in Graphic Viewport Class *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/16/1995 PWG : Created. *
*=========================================================================*/
inline VOID GraphicViewPortClass::Draw_Line(int sx, int sy, int dx, int dy, unsigned char color)
{
MCGA_Draw_Line(this, sx, sy, dx, dy, color);
}
/***************************************************************************
* GVPC::FILL_RECT -- Stub function to fill rectangle in a GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/16/1995 PWG : Created. *
*=========================================================================*/
inline VOID GraphicViewPortClass::Fill_Rect(int sx, int sy, int dx, int dy, unsigned char color)
{
MCGA_Fill_Rect(this, sx, sy, dx, dy, color);
}
/***************************************************************************
* GVPC::REMAP -- Stub function to remap a GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/16/1995 PWG : Created. *
*=========================================================================*/
inline VOID GraphicViewPortClass::Remap(int sx, int sy, int width, int height, VOID *remap)
{
MCGA_Remap(this, sx, sy, width, height, remap);
}
inline VOID GraphicViewPortClass::Fill_Quad(VOID *span_buff, int x0, int y0, int x1, int y1,
int x2, int y2, int x3, int y3, int color)
{
MCGA_Fill_Quad(this, span_buff, x0, y0, x1, y1, x2, y2, x3, y3, color);
}
/***************************************************************************
* GVPC::REMAP -- Short form to remap an entire graphic view port *
* *
* INPUT: BYTE * to the remap table to use *
* *
* OUTPUT: none *
* *
* HISTORY: *
* 07/01/1994 PWG : Created. *
*=========================================================================*/
inline VOID GraphicViewPortClass::Remap(VOID *remap)
{
MCGA_Remap(this, 0, 0, Width, Height, remap);
}
/*=========================================================================*/
/* The following BufferClass functions are defined here because they act */
/* on graphic viewports. */
/*=========================================================================*/
/***************************************************************************
* BUFFER_TO_PAGE -- Generic 'c' callable form of Buffer_To_Page *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/12/1995 PWG : Created. *
*=========================================================================*/
inline long Buffer_To_Page(int x, int y, int w, int h, void *Buffer, GraphicViewPortClass &view)
{
return(MCGA_Buffer_To_Page(x, y, w, h, Buffer, &view));
}
/***************************************************************************
* BC::TO_PAGE -- Copys a buffer class to a page with definable w, h *
* *
* INPUT: int width - the width of copy region *
* int height - the height of copy region *
* GVPC& dest - virtual viewport to copy to *
* *
* OUTPUT: none *
* *
* WARNINGS: x and y position are the upper left corner of the dest *
* viewport *
* *
* HISTORY: *
* 07/01/1994 PWG : Created. *
*=========================================================================*/
inline long BufferClass::To_Page(int w, int h, GraphicViewPortClass &view)
{
return(MCGA_Buffer_To_Page(0, 0, w, h, Buffer, &view));
}
/***************************************************************************
* BC::TO_PAGE -- Copys a buffer class to a page with definable w, h *
* *
* INPUT: GVPC& dest - virtual viewport to copy to *
* *
* OUTPUT: none *
* *
* WARNINGS: x and y position are the upper left corner of the dest *
* viewport. width and height are assumed to be the *
* viewport's width and height. *
* *
* HISTORY: *
* 07/01/1994 PWG : Created. *
*=========================================================================*/
inline long BufferClass::To_Page(GraphicViewPortClass &view)
{
return(MCGA_Buffer_To_Page(0, 0, view.Get_Width(), view.Get_Height(), Buffer, &view));
}
/***************************************************************************
* BC::TO_PAGE -- Copys a buffer class to a page with definable x, y, w, h *
* *
* INPUT: int x - x pixel on viewport to copy from *
* int y - y pixel on viewport to copy from *
* int width - the width of copy region *
* int height - the height of copy region *
* GVPC& dest - virtual viewport to copy to *
* *
* OUTPUT: none *
* *
* HISTORY: *
* 07/01/1994 PWG : Created. *
*=========================================================================*/
inline long BufferClass::To_Page(int x, int y, int w, int h, GraphicViewPortClass &view)
{
return(MCGA_Buffer_To_Page(x, y, w, h, Buffer, &view));
}
#endif

892
WWFLAT32/INCLUDE/GBUFFER.H Normal file
View File

@@ -0,0 +1,892 @@
/*
** 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 A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Westwood 32 Bit Library *
* *
* File Name : GBUFFER.H *
* *
* Programmer : Phil W. Gorrow *
* *
* Start Date : May 26, 1994 *
* *
* Last Update : January 17, 1995 [PWG] *
* *
***************************************************************************
* *
* This module contains the definition for the graphic buffer class. The *
* primary functionality of the graphic buffer class is handled by inline *
* functions that make a call through function pointers to the correct *
* routine. This has two benefits: *
* *
* *
* 1) C++ name mangling is not a big deal since the function pointers *
* point to functions in standard C format. *
* 2) The function pointers can be changed when we set a different *
* graphic mode. This allows us to have both supervga and mcga *
* routines present in memory at once. *
* *
* In the basic library, these functions point to stub routines which just *
* return. This makes a product that just uses a graphic buffer take the *
* minimum amount of code space. For programs that require MCGA or VESA *
* support, all that is necessary to do is link either the MCGA or VESA *
* specific libraries in, previous to WWLIB32. The linker will then *
* overide the the necessary stub functions automatically. *
* *
* In addition, there are helpful inline function calls for parameter *
* ellimination. This header file gives the defintion for all *
* GraphicViewPort and GraphicBuffer classes. *
* *
* Terminology: *
* *
* Buffer Class - A class which consists of a pointer to an allocated *
* buffer and the size of the buffer that was allocated. *
* *
* Graphic ViewPort - The Graphic ViewPort defines a window into a *
* Graphic Buffer. This means that although a Graphic Buffer *
* represents linear memory, this may not be true with a Graphic *
* Viewport. All low level functions that act directly on a graphic *
* viewport are included within this class. This includes but is not *
* limited to most of the functions which can act on a Video Viewport *
* Video Buffer. *
* *
* Graphic Buffer - A Graphic Buffer is an instance of an allocated buffer *
* used to represent a rectangular region of graphics memory. *
* The HidBuff and BackBuff are excellent examples of a Graphic Buffer. *
* *
* Below is a tree which shows the relationship of the VideoBuffer and *
* Buffer classes to the GraphicBuffer class: *
* *
* BUFFER.H GBUFFER.H BUFFER.H VBUFFER.H *
* ---------- ---------- ---------- ---------- *
* | Buffer | | Graphic | | Buffer | | Video | *
* | Class | | ViewPort | | Class | | ViewPort | *
* ---------- ---------- ---------- ---------- *
* \ / \ / *
* \ / \ / *
* ---------- ---------- *
* | Graphic | | Video | *
* | Buffer | | Buffer | *
* ---------- ---------- *
* GBUFFER.H VBUFFER.H *
*-------------------------------------------------------------------------*
* Functions: *
* GBC::GraphicBufferClass -- inline constructor for GraphicBufferClass *
* GVPC::Remap -- Short form to remap an entire graphic view port *
* GVPC::Get_XPos -- Returns x offset for a graphic viewport class *
* GVPC::Get_Ypos -- Return y offset in a GraphicViewPortClass *
* VVPC::Get_XPos -- Get the x pos of the VP on the Video *
* VVPC::Get_YPos -- Get the y pos of the VP on the video *
* GBC::Get_Graphic_Buffer -- Get the graphic buffer of the VP. *
* GVPC::Draw_Line -- Stub function to draw line in Graphic Viewport Class*
* GVPC::Fill_Rect -- Stub function to fill rectangle in a GVPC *
* GVPC::Remap -- Stub function to remap a GVPC *
* GVPC::Print -- stub func to print a text string *
* GVPC::Print -- Stub function to print an integer *
* GVPC::Print -- Stub function to print a short to a graphic viewport *
* GVPC::Print -- stub function to print a long on a graphic view port *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include "window.h"
#ifndef GBUFFER_H
#define GBUFFER_H
/*=========================================================================*/
/* If we have not already loaded the standard library header, than we can */
/* load it. */
/*=========================================================================*/
#ifndef WWSTD_H
#include "wwstd.h"
#endif
#ifndef MCGAPRIM_H
#include "mcgaprim.h"
#endif
#ifndef BUFFER_H
#include "buffer.h"
#endif
#include <stdlib.h>
/*=========================================================================*/
/* Define the screen width and height to make portability to other modules */
/* easier. */
/*=========================================================================*/
#define DEFAULT_SCREEN_WIDTH 320
#define DEFAULT_SCREEN_HEIGHT 200
/*=========================================================================*/
/* Let the compiler know that a GraphicBufferClass exists so that it can */
/* keep a pointer to it in a VideoViewPortClass. */
/*=========================================================================*/
class GraphicViewPortClass;
class GraphicBufferClass;
class VideoViewPortClass;
class VideoBufferClass;
GraphicBufferClass *Set_Logic_Page(GraphicBufferClass *ptr);
GraphicBufferClass *Set_Logic_Page(GraphicBufferClass &ptr);
/*=========================================================================*/
/* GraphicViewPortClass - Holds viewport information on a viewport which */
/* has been attached to a GraphicBuffer. A viewport is effectively a */
/* rectangular subset of the full buffer which is used for clipping and */
/* the like. */
/* */
/* char *Buffer - is the offset to view port buffer */
/* int Width - is the width of view port */
/* int Height - is the height of view port */
/* int XAdd - is add value to go from the end of a line */
/* to the beginning of the next line */
/* int XPos; - x offset into its associated VideoBuffer */
/* int YPos; - y offset into its associated VideoBuffer */
/*=========================================================================*/
class GraphicViewPortClass {
public:
/*===================================================================*/
/* Define the base constructor and destructors for the class */
/*===================================================================*/
GraphicViewPortClass(GraphicBufferClass* graphic_buff, int x, int y, int w, int h);
GraphicViewPortClass();
~GraphicViewPortClass();
/*===================================================================*/
/* define functions to get at the private data members */
/*===================================================================*/
long Get_Offset(void);
int Get_Height(void);
int Get_Width(void);
int Get_XAdd(void);
int Get_XPos(void);
int Get_YPos(void);
GraphicBufferClass *Get_Graphic_Buffer(void);
int Lock(void) const {return(TRUE);}
void Unlock(void) const {}
/*===================================================================*/
/* Define a function which allows us to change a video viewport on */
/* the fly. */
/*===================================================================*/
BOOL Change(int x, int y, int w, int h);
/*===================================================================*/
/* Define the set of common graphic functions that are supported by */
/* both Graphic ViewPorts and VideoViewPorts. */
/*===================================================================*/
long Size_Of_Region(int w, int h);
void Put_Pixel(int x, int y, unsigned char color);
int Get_Pixel(int x, int y);
void Clear(unsigned char color = 0);
long To_Buffer(int x, int y, int w, int h, void *buff, long size);
long To_Buffer(int x, int y, int w, int h, BufferClass *buff);
long To_Buffer(BufferClass *buff);
BOOL Blit( GraphicViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans = FALSE);
BOOL Blit( GraphicViewPortClass& dest, int dx, int dy, BOOL trans = FALSE);
BOOL Blit( GraphicViewPortClass& dest, BOOL trans = FALSE);
BOOL Blit( VideoViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans = FALSE);
BOOL Blit( VideoViewPortClass& dest, int dx, int dy, BOOL trans = FALSE);
BOOL Blit( VideoViewPortClass& dest, BOOL trans = FALSE);
BOOL Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans = FALSE, char *remap = NULL);
BOOL Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap);
BOOL Scale( GraphicViewPortClass &dest, BOOL trans = FALSE, char *remap = NULL);
BOOL Scale( GraphicViewPortClass &dest, char *remap);
BOOL Scale( VideoViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans = FALSE, char *remap = NULL);
BOOL Scale( VideoViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap);
BOOL Scale( VideoViewPortClass &dest, BOOL trans = FALSE, char *remap = NULL);
BOOL Scale( VideoViewPortClass &dest, char *remap);
unsigned long Print(char const *string, int x_pixel, int y_pixel, int fcolor, int bcolor);
unsigned long Print(short num, int x_pixel, int y_pixel, int fcol, int bcol);
unsigned long Print(int num, int x_pixel, int y_pixel, int fcol, int bcol);
unsigned long Print(long num, int x_pixel, int y_pixel, int fcol, int bcol);
/*===================================================================*/
/* Define the list of graphic functions which work only with a */
/* graphic buffer. */
/*===================================================================*/
VOID Draw_Line(int sx, int sy, int dx, int dy, unsigned char color);
VOID Draw_Rect(int sx, int sy, int dx, int dy, unsigned char color);
VOID Fill_Rect(int sx, int sy, int dx, int dy, unsigned char color);
VOID Fill_Quad(VOID *span_buff, int x0, int y0, int x1, int y1,
int x2, int y2, int x3, int y3, int color);
VOID Remap(int sx, int sy, int width, int height, VOID *remap);
VOID Remap(VOID *remap);
void Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap);
void Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap, int clip_window);
VOID Grey_Out_Region(int x, int y, int width, int height, int color);
protected:
/*===================================================================*/
/* Define functions to attach the viewport to a graphicbuffer */
/*===================================================================*/
VOID Attach(GraphicBufferClass *graphic_buff, int x, int y, int w, int h);
void Attach(GraphicBufferClass *video_buff, int w, int h);
/*===================================================================*/
/* Define the data used by a GraphicViewPortClass */
/*===================================================================*/
long Offset; // offset to graphic page
int Width; // width of graphic page
int Height; // height of graphic page
int XAdd; // xadd for graphic page (0)
int XPos; // x offset in relation to graphicbuff
int YPos; // y offset in relation to graphicbuff
GraphicBufferClass *GraphicBuff; // related graphic buff
};
/*=========================================================================*/
/* GraphicBufferClass - A GraphicBuffer refers to an actual instance of an */
/* allocated buffer. The GraphicBuffer may be drawn to directly */
/* becuase it inherits a ViewPort which represents its physcial size. */
/* */
/* BYTE *Buffer - is the offset to graphic buffer */
/* int Width - is the width of graphic buffer */
/* int Height - is the height of graphic buffer */
/* int XAdd - is the xadd of graphic buffer */
/* int XPos; - will be 0 because it is graphicbuff */
/* int YPos; - will be 0 because it is graphicbuff */
/*=========================================================================*/
class GraphicBufferClass : public GraphicViewPortClass, public BufferClass {
public:
GraphicBufferClass( long size = 64500, int w = DEFAULT_SCREEN_WIDTH, int h = DEFAULT_SCREEN_HEIGHT,
VOID *buffer = 0);
GraphicBufferClass(int w, int h, void *buffer = 0);
~GraphicBufferClass();
void Scale_Rotate(BitmapClass &bmp,const TPoint2D &pt,long scale=0x0100,unsigned char angle=0);
};
/***************************************************************************
* GVPC::GET_OFFSET -- Get offset for virtual view port class instance *
* *
* INPUT: none *
* *
* OUTPUT: long the offset for the virtual viewport instance *
* *
* HISTORY: *
* 06/07/1994 PWG : Created. *
*=========================================================================*/
inline long GraphicViewPortClass::Get_Offset(void)
{
return(Offset);
}
/***************************************************************************
* GVPC::GET_HEIGHT -- Gets the height of a virtual viewport instance *
* *
* INPUT: none *
* *
* OUTPUT: WORD the height of the virtual viewport instance *
* *
* HISTORY: *
* 06/07/1994 PWG : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_Height(void)
{
return(Height);
}
/***************************************************************************
* GVPC::GET_WIDTH -- Get the width of a virtual viewport instance *
* *
* INPUT: none *
* *
* OUTPUT: WORD the width of the virtual viewport instance *
* *
* HISTORY: *
* 06/07/1994 PWG : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_Width(void)
{
return(Width);
}
/***************************************************************************
* GVPC::GET_XADD -- Get the X add offset for virtual viewport instance *
* *
* INPUT: none *
* *
* OUTPUT: WORD the xadd for a virtual viewport instance *
* *
* HISTORY: *
* 06/07/1994 PWG : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_XAdd(void)
{
return(XAdd);
}
/***************************************************************************
* GVPC::GET_XPOS -- Get the x pos of the VP on the Video *
* *
* INPUT: none *
* *
* OUTPUT: WORD the x offset to VideoBufferClass *
* *
* HISTORY: *
;* 08/22/1994 SKB : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_XPos(void)
{
return(XPos);
}
/***************************************************************************
* GVPC::GET_YPOS -- Get the y pos of the VP on the video *
* *
* INPUT: none *
* *
* OUTPUT: WORD the x offset to VideoBufferClass *
* *
* WARNINGS: *
* *
* HISTORY: *
;* 08/22/1994 SKB : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_YPos(void)
{
return(YPos);
}
/***************************************************************************
* GVPC::GET_GRAPHIC_BUFFER -- Get the graphic buffer of the VP. *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* HISTORY: *
* 08/22/1994 SKB : Created. *
*=========================================================================*/
inline GraphicBufferClass *GraphicViewPortClass::Get_Graphic_Buffer(void)
{
return (GraphicBuff);
}
/***************************************************************************
* GVPC::SIZE_OF_REGION -- stub to call curr graphic mode Size_Of_Region *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 03/01/1995 BWG : Created. *
*=========================================================================*/
inline long GraphicViewPortClass::Size_Of_Region(int w, int h)
{
return MCGA_Size_Of_Region(this, w, h);
}
/***************************************************************************
* GVPC::PUT_PIXEL -- stub to call curr graphic mode Put_Pixel *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline void GraphicViewPortClass::Put_Pixel(int x, int y, unsigned char color)
{
MCGA_Put_Pixel(this, x, y, color);
}
/***************************************************************************
* GVPC::GET_PIXEL -- stub to call curr graphic mode Get_Pixel *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_Pixel(int x, int y)
{
return(MCGA_Get_Pixel(this, x, y));
}
/***************************************************************************
* GVPC::CLEAR -- stub to call curr graphic mode Clear *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline void GraphicViewPortClass::Clear(unsigned char color)
{
MCGA_Clear(this, color);
}
/***************************************************************************
* GVPC::TO_BUFFER -- stub 1 to call curr graphic mode To_Buffer *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline long GraphicViewPortClass::To_Buffer(int x, int y, int w, int h, void *buff, long size)
{
return(MCGA_To_Buffer(this, x, y, w, h, buff, size));
}
/***************************************************************************
* GVPC::TO_BUFFER -- stub 2 to call curr graphic mode To_Buffer *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline long GraphicViewPortClass::To_Buffer(int x, int y, int w, int h, BufferClass *buff)
{
return(MCGA_To_Buffer(this, x, y, w, h, buff->Get_Buffer(), buff->Get_Size()));
}
/***************************************************************************
* GVPC::TO_BUFFER -- stub 3 to call curr graphic mode To_Buffer *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline long GraphicViewPortClass::To_Buffer(BufferClass *buff)
{
return(MCGA_To_Buffer(this, 0, 0, Width, Height, buff->Get_Buffer(), buff->Get_Size()));
}
/***************************************************************************
* GVPC::BLIT -- stub 1 to call curr graphic mode Blit to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Blit( GraphicViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans)
{
return(Linear_Blit_To_Linear(this, &dest, x_pixel, y_pixel, dx_pixel, dy_pixel, pixel_width, pixel_height, trans));
}
/***************************************************************************
* GVPC::BLIT -- Stub 2 to call curr graphic mode Blit to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Blit( GraphicViewPortClass& dest, int dx, int dy, BOOL trans)
{
return(Linear_Blit_To_Linear(this, &dest, 0, 0, dx, dy, Width, Height, trans));
}
/***************************************************************************
* GVPC::BLIT -- stub 3 to call curr graphic mode Blit to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Blit( GraphicViewPortClass& dest, BOOL trans)
{
return(Linear_Blit_To_Linear(this, &dest, 0, 0, 0, 0, Width, Height, trans));
}
/***************************************************************************
* GVPC::SCALE -- stub 1 to call curr graphic mode Scale to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans, char *remap)
{
return(Linear_Scale_To_Linear(this, &dest, src_x, src_y, dst_x, dst_y, src_w, src_h, dst_w, dst_h, trans, remap));
}
/***************************************************************************
* GVPC::SCALE -- stub 2 to call curr graphic mode Scale to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap)
{
return(Linear_Scale_To_Linear(this, &dest, src_x, src_y, dst_x, dst_y, src_w, src_h, dst_w, dst_h, FALSE, remap));
}
/***************************************************************************
* GVPC::SCALE -- stub 3 to call curr graphic mode Scale to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, BOOL trans, char *remap)
{
return(Linear_Scale_To_Linear(this, &dest, 0, 0, 0, 0, Width, Height, dest.Get_Width(), dest.Get_Height(), trans, remap));
}
/***************************************************************************
* GVPC::SCALE -- stub 4 to call curr graphic mode Scale to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, char *remap)
{
return(Linear_Scale_To_Linear(this, &dest, 0, 0, 0, 0, Width, Height, dest.Get_Width(), dest.Get_Height(), FALSE, remap));
}
/***************************************************************************
* GVPC::PRINT -- stub func to print a text string *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/17/1995 PWG : Created. *
*=========================================================================*/
inline unsigned long GraphicViewPortClass::Print(char const *str, int x, int y, int fcol, int bcol)
{
return(MCGA_Print(this, str, x, y, fcol, bcol));
}
/***************************************************************************
* GVPC::PRINT -- Stub function to print an integer *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
*=========================================================================*/
inline unsigned long GraphicViewPortClass::Print(int num, int x, int y, int fcol, int bcol)
{
char str[17];
return(MCGA_Print(this, itoa(num, str, 10), x, y, fcol, bcol));
}
/***************************************************************************
* GVPC::PRINT -- Stub function to print a short to a graphic viewport *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
*=========================================================================*/
inline unsigned long GraphicViewPortClass::Print(short num, int x, int y, int fcol, int bcol)
{
char str[17];
return(MCGA_Print(this, itoa(num, str, 10), x, y, fcol, bcol));
}
/***************************************************************************
* GVPC::PRINT -- stub function to print a long on a graphic view port *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
*=========================================================================*/
inline unsigned long GraphicViewPortClass::Print(long num, int x, int y, int fcol, int bcol)
{
char str[33];
return(MCGA_Print(this, ltoa(num, str,10), x, y, fcol, bcol));
}
/***************************************************************************
* GVPC::DRAW_STAMP -- stub function to draw a tile on a graphic view port *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
*=========================================================================*/
inline void GraphicViewPortClass::Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap)
{
MCGA_Draw_Stamp(this, icondata, icon, x_pixel, y_pixel, remap);
}
/***************************************************************************
* GVPC::DRAW_STAMP -- stub function to draw a tile on a graphic view port *
* This version clips the tile to a window *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 07/31/1995 BWG : Created. *
*=========================================================================*/
inline void GraphicViewPortClass::Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap, int clip_window)
{
MCGA_Draw_Stamp_Clip(this, icondata, icon, x_pixel, y_pixel, remap, WindowList[clip_window][WINDOWX], WindowList[clip_window][WINDOWY], WindowList[clip_window][WINDOWWIDTH], WindowList[clip_window][WINDOWHEIGHT]);
}
/***************************************************************************
* GVPC::DRAW_LINE -- Stub function to draw line in Graphic Viewport Class *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/16/1995 PWG : Created. *
*=========================================================================*/
inline VOID GraphicViewPortClass::Draw_Line(int sx, int sy, int dx, int dy, unsigned char color)
{
MCGA_Draw_Line(this, sx, sy, dx, dy, color);
}
/***************************************************************************
* GVPC::FILL_RECT -- Stub function to fill rectangle in a GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/16/1995 PWG : Created. *
*=========================================================================*/
inline VOID GraphicViewPortClass::Fill_Rect(int sx, int sy, int dx, int dy, unsigned char color)
{
MCGA_Fill_Rect(this, sx, sy, dx, dy, color);
}
/***************************************************************************
* GVPC::REMAP -- Stub function to remap a GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/16/1995 PWG : Created. *
*=========================================================================*/
inline VOID GraphicViewPortClass::Remap(int sx, int sy, int width, int height, VOID *remap)
{
MCGA_Remap(this, sx, sy, width, height, remap);
}
inline VOID GraphicViewPortClass::Fill_Quad(VOID *span_buff, int x0, int y0, int x1, int y1,
int x2, int y2, int x3, int y3, int color)
{
MCGA_Fill_Quad(this, span_buff, x0, y0, x1, y1, x2, y2, x3, y3, color);
}
/***************************************************************************
* GVPC::REMAP -- Short form to remap an entire graphic view port *
* *
* INPUT: BYTE * to the remap table to use *
* *
* OUTPUT: none *
* *
* HISTORY: *
* 07/01/1994 PWG : Created. *
*=========================================================================*/
inline VOID GraphicViewPortClass::Remap(VOID *remap)
{
MCGA_Remap(this, 0, 0, Width, Height, remap);
}
/*=========================================================================*/
/* The following BufferClass functions are defined here because they act */
/* on graphic viewports. */
/*=========================================================================*/
/***************************************************************************
* BUFFER_TO_PAGE -- Generic 'c' callable form of Buffer_To_Page *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/12/1995 PWG : Created. *
*=========================================================================*/
inline long Buffer_To_Page(int x, int y, int w, int h, void *Buffer, GraphicViewPortClass &view)
{
return(MCGA_Buffer_To_Page(x, y, w, h, Buffer, &view));
}
/***************************************************************************
* BC::TO_PAGE -- Copys a buffer class to a page with definable w, h *
* *
* INPUT: int width - the width of copy region *
* int height - the height of copy region *
* GVPC& dest - virtual viewport to copy to *
* *
* OUTPUT: none *
* *
* WARNINGS: x and y position are the upper left corner of the dest *
* viewport *
* *
* HISTORY: *
* 07/01/1994 PWG : Created. *
*=========================================================================*/
inline long BufferClass::To_Page(int w, int h, GraphicViewPortClass &view)
{
return(MCGA_Buffer_To_Page(0, 0, w, h, Buffer, &view));
}
/***************************************************************************
* BC::TO_PAGE -- Copys a buffer class to a page with definable w, h *
* *
* INPUT: GVPC& dest - virtual viewport to copy to *
* *
* OUTPUT: none *
* *
* WARNINGS: x and y position are the upper left corner of the dest *
* viewport. width and height are assumed to be the *
* viewport's width and height. *
* *
* HISTORY: *
* 07/01/1994 PWG : Created. *
*=========================================================================*/
inline long BufferClass::To_Page(GraphicViewPortClass &view)
{
return(MCGA_Buffer_To_Page(0, 0, view.Get_Width(), view.Get_Height(), Buffer, &view));
}
/***************************************************************************
* BC::TO_PAGE -- Copys a buffer class to a page with definable x, y, w, h *
* *
* INPUT: int x - x pixel on viewport to copy from *
* int y - y pixel on viewport to copy from *
* int width - the width of copy region *
* int height - the height of copy region *
* GVPC& dest - virtual viewport to copy to *
* *
* OUTPUT: none *
* *
* HISTORY: *
* 07/01/1994 PWG : Created. *
*=========================================================================*/
inline long BufferClass::To_Page(int x, int y, int w, int h, GraphicViewPortClass &view)
{
return(MCGA_Buffer_To_Page(x, y, w, h, Buffer, &view));
}
#endif

View File

@@ -0,0 +1,60 @@
;
; 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 A S S O C I A T E S **
;***************************************************************************
;* *
;* Project Name : Westwood 32 Bit Library *
;* *
;* File Name : GBUFFER.INC *
;* *
;* Programmer : Phil W. Gorrow *
;* *
;* Start Date : May 26, 1994 *
;* *
;* Last Update : May 26, 1994 [PWG] *
;* *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
;******************************************************************************
; Much testing was done to determine that only when there are 14 or more bytes
; being copied does it speed the time it takes to do copies in this algorithm.
; For this reason and because 1 and 2 byte copies crash, is the special case
; used. SKB 4/21/94. Tested on 486 66mhz. Copied by PWG 6/7/04.
OPTIMAL_BYTE_COPY equ 14
STRUC GraphicViewPort
GVPOffset DD ? ; offset to virtual viewport
GVPWidth DD ? ; width of virtual viewport
GVPHeight DD ? ; height of virtual viewport
GVPXAdd DD ? ; x mod to get to next line
GVPXPos DD ? ; x pos relative to Graphic Buff
GVPYPos DD ? ; y pos relative to Graphic Buff
GVPBuffPtr DD ? ; ptr to associated Graphic Buff
ENDS
STRUC VideoViewPort
VIVPOffset DD ? ; offset to virtual viewport
VIVPWidth DD ? ; width of virtual viewport
VIVPHeight DD ? ; height of virtual viewport
VIVPXAdd DD ? ; x mod to get to next line
VIVPXPos DD ? ; x pos relative to Graphic Buff
VIVPYPos DD ? ; y pos relative to Graphic Buff
VIVPBuffPtr DD ? ; ptr to associated Graphic Buff
ENDS

168
WWFLAT32/INCLUDE/IFF.H Normal file
View File

@@ -0,0 +1,168 @@
/*
** 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 A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Part of the FILEIO Library *
* *
* File Name : IFF.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : April 20, 1994 *
* *
* Last Update : April 20, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef IFF_H
#define IFF_H
#ifndef MISC_H
#include <misc.h> // This is needed fro Reverse_WORD and _LONG
#endif
#ifndef MEMFLAGS_H
#include <memflag.h> // This is needed for MemoryFlagType.
#endif
#ifndef GBUFFER_H
#include <gbuffer.h>
#endif
#define LZW_SUPPORTED FALSE
/*=========================================================================*/
/* Iff and Load Picture system defines and enumerations */
/*=========================================================================*/
#define MAKE_ID(a,b,c,d) ((LONG) ((LONG) d << 24) | ((LONG) c << 16) | ((LONG) b << 8) | (LONG)(a))
#define IFFize_WORD(a) Reverse_WORD(a)
#define IFFize_LONG(a) Reverse_LONG(a)
//lint -strong(AJX,PicturePlaneType)
typedef enum {
BM_AMIGA, // Bit plane format (8K per bitplane).
BM_MCGA, // Byte per pixel format (64K).
BM_DEFAULT=BM_MCGA // Default picture format.
} PicturePlaneType;
/*
** This is the compression type code. This value is used in the compressed
** file header to indicate the method of compression used. Note that the
** LZW method may not be supported.
*/
//lint -strong(AJX,CompressionType)
typedef enum {
NOCOMPRESS, // No compression (raw data).
LZW12, // LZW 12 bit codes.
LZW14, // LZW 14 bit codes.
HORIZONTAL, // Run length encoding (RLE).
LCW // Westwood proprietary compression.
} CompressionType;
/*
** Compressed blocks of data must start with this header structure.
** Note that disk based compressed files have an additional two
** leading bytes that indicate the size of the entire file.
*/
//lint -strong(AJX,CompHeaderType)
typedef struct {
BYTE Method; // Compression method (CompressionType).
BYTE pad; // Reserved pad byte (always 0).
LONG Size; // Size of the uncompressed data.
WORD Skip; // Number of bytes to skip before data.
} CompHeaderType;
/*=========================================================================*/
/* The following prototypes are for the file: IFF.CPP */
/*=========================================================================*/
WORD cdecl Open_Iff_File(BYTE const *filename);
VOID cdecl Close_Iff_File(WORD fh);
ULONG cdecl Get_Iff_Chunk_Size(WORD fh, LONG id);
ULONG cdecl Read_Iff_Chunk(WORD fh, LONG id, VOID *buffer, ULONG maxsize);
VOID cdecl Write_Iff_Chunk(WORD file, LONG id, VOID *buffer, LONG length);
/*=========================================================================*/
/* The following prototypes are for the file: LOADPICT.CPP */
/*=========================================================================*/
//WORD cdecl Load_Picture(BYTE const *filename, BufferClass& scratchbuf, BufferClass& destbuf, UBYTE *palette=NULL, PicturePlaneType format=BM_DEFAULT);
/*=========================================================================*/
/* The following prototypes are for the file: LOAD.CPP */
/*=========================================================================*/
ULONG cdecl Load_Data(BYTE const *name, VOID *ptr, ULONG size);
ULONG cdecl Write_Data(BYTE const *name, VOID *ptr, ULONG size);
VOID * cdecl Load_Alloc_Data(BYTE const *name, MemoryFlagType flags);
//ULONG cdecl Load_Uncompress(BYTE const *file, BufferClass& uncomp_buff, BufferClass& dest_buff, VOID *reserved_data=NULL);
ULONG cdecl Uncompress_Data(VOID const *src, VOID *dst);
VOID cdecl Set_Uncomp_Buffer(WORD buffer_segment, UWORD size_of_buffer);
/*=========================================================================*/
/* The following prototypes are for the file: WRITELBM.CPP */
/*=========================================================================*/
PUBLIC BOOL Write_LBM_File(WORD lbmhandle, BufferClass& buff, WORD bitplanes, UBYTE *palette);
/*========================= Assembly Functions ============================*/
#ifdef __cplusplus
extern "C" {
#endif
/*=========================================================================*/
/* The following prototypes are for the file: PACK2PLN.ASM */
/*=========================================================================*/
extern VOID Pack_2_Plane(VOID *buffer, VOID * pageptr, WORD planebit);
/*=========================================================================*/
/* The following prototypes are for the file: LCWCOMP.ASM */
/*=========================================================================*/
extern ULONG LCW_Compress(VOID *source, VOID *dest, ULONG length);
/*=========================================================================*/
/* The following prototypes are for the file: LCWUNCMP.ASM */
/*=========================================================================*/
extern ULONG LCW_Uncompress(VOID *source, VOID *dest, ULONG length);
#ifdef __cplusplus
}
#endif
/*=========================================================================*/
#endif //IFF_H


1448
WWFLAT32/INCLUDE/INDEXTB.INC Normal file

File diff suppressed because it is too large Load Diff

447
WWFLAT32/INCLUDE/KEYBOARD.H Normal file
View File

@@ -0,0 +1,447 @@
/*
** 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 A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Westwood 32 bit Library *
* *
* File Name : KEYBOARD.H *
* *
* Programmer : Phil W. Gorrow *
* *
* Start Date : July 13, 1994 *
* *
* Last Update : July 13, 1994 [PWG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef KEYBOARD_H
#define KEYBOARD_H
/*=========================================================================*/
/* If we have not already loaded the standard library header, than we can */
/* load it. */
/*=========================================================================*/
#ifndef WWSTD_H
#include "wwstd.h"
#endif
extern "C" {
void Install_Keyboard_Interrupt(void *addr, long size);
void Install_Page_Fault_Handle(void) ;
void *Get_RM_Keyboard_Address(void);
long Get_RM_Keyboard_Size(void);
void Remove_Keyboard_Interrupt(void);
int Check_Key_Num(void);
int Check_Key_Bits(void);
int Check_Key(void);
short Get_Key_Num(void);
short Get_Key_Bits(void);
int Get_Key(void);
int KN_To_KA(int keynum);
int Keyboard_Attributes_On(int key_flags);
int Keyboard_Attributes_Off(int key_flags);
void Clear_KeyBuffer(void);
int Key_Down(int key);
int Key_Satisfied(int key);
void Stuff_Key_WORD(int code);
void Stuff_Key_Num(int key);
int Install_Mouse(int max_width, int max_height, int scr_width, int scr_height);
void Reset_Mouse (void) ;
void Remove_Mouse(void);
int Get_Mouse_State(void);
int Get_Mouse_X(void);
int Get_Mouse_Y(void);
int Get_Mouse_Disabled(void);
void *Set_Mouse_Cursor(int xhotspot, int yhotspot, void *cursor);
void Hide_Mouse(void);
void Show_Mouse(void);
void Conditional_Hide_Mouse(int sx_pixel, int sy_pixel, int dx_pixel, int dy_pixel);
void Conditional_Show_Mouse(void);
void __interrupt far Keyboard_Interrupt(void);
extern int MouseQX;
extern int MouseQY;
}
enum {
REPEATON = 0x0001, /* 1:all makes into buffer, 0:only 1st make */
TRACKEXT = 0x0002, /* 1:Home != keypad Home, 0:Home=keypad Home */
FILTERONLY = 0x0004, /* 1:Normal BIOS operation with filter */
CTRLALTTURBO = 0x0010, /* 1:Allow turbo up and down in application */
NONUMLOCK = 0x0200, /* 1:do NOT remap keypad to numbers */
TASKSWITCHABLE = 0x400, /* 1:allows task switching keys thru ALT-TAB, */
/* ALT-ESC,CTRL-ESC */
PASSBREAKS = 0x0800, // Pass all breaks to the keyboard buffer.
/* The following flags, if turned on, should only be used for
debugging purposes (remember to take out the calls when BETA */
CTRLSON = 0x0008, /* 1:pass scroll lock sequence into BIOS */
CTRLCON = 0x0020, /* 1:pass stop code to BIOS */
SCROLLLOCKON = 0x0040, /* 1:pass scroll lock key into BIOS */
PAUSEON = 0x0080, /* 1:pass the pause key and seq to BIOS */
/* make sure FILTERONLY is set */
BREAKON = 0x0100, /* 1:pass the ctrl break seq to BIOS */
KEYMOUSE = 0x1000, /* 1:keypad translates into mouse moves */
SIMLBUTTON = 0x2000, /* 1:have space and enter keys simulate Left */
/* mouse button when KEYMOUSE is set */
DEBUGINT = 0x4000 /* Use scroll lock to disable keyboard int */
};
/*
** These are the codes for the various key codes that are returned from the
** keyboard input routines Get_Key() and Input_ASCII().
*/
typedef enum {
KA_CTRL_AT = 0,
KA_CTRL_A,
KA_MORE = KA_CTRL_A,
KA_CTRL_B,
KA_SETBKGDCOL = KA_CTRL_B,
KA_CTRL_C,
KA_CTRL_D,
KA_CTRL_E,
KA_CTRL_F,
KA_SETFORECOL = KA_CTRL_F,
KA_CTRL_G,
KA_CTRL_H,
KA_BACKSPACE = KA_CTRL_H,
KA_CTRL_I,
KA_TAB = KA_CTRL_I,
KA_CTRL_J,
KA_CTRL_K,
KA_CTRL_L,
KA_FORMFEED = KA_CTRL_L,
KA_CTRL_M,
KA_RETURN = KA_CTRL_M,
KA_CTRL_N,
KA_CTRL_O,
KA_CTRL_P,
KA_CTRL_Q,
KA_CTRL_R,
KA_CTRL_S,
KA_SPCTAB = KA_CTRL_S,
KA_CTRL_T,
KA_CTRL_U,
KA_CTRL_V,
KA_CTRL_W,
KA_CTRL_X,
KA_SETX = KA_CTRL_X,
KA_CTRL_Y,
KA_SETY = KA_CTRL_Y,
KA_CTRL_Z,
KA_CTRL_LBRACKET,
KA_ESC = KA_CTRL_LBRACKET,
KA_EXTEND = KA_ESC,
KA_CTRL_BACKSLASH,
KA_CTRL_RBRACKET,
KA_LITERAL = KA_CTRL_RBRACKET,
KA_CTRL_CARROT,
KA_CTRL_UNDERLINE,
KA_SPACE, /* */
KA_EXCLAMATION, /* ! */
KA_DQUOTE, /* " */
KA_POUND, /* # */
KA_DOLLAR, /* $ */
KA_PERCENT, /* % */
KA_AMPER, /* & */
KA_SQUOTE, /* ' */
KA_LPAREN, /* ( */
KA_RPAREN, /* ) */
KA_ASTERISK, /* * */
KA_PLUS, /* + */
KA_COMMA, /* , */
KA_MINUS, /* - */
KA_PERIOD, /* . */
KA_SLASH, /* / */
KA_0, KA_1, KA_2, KA_3, KA_4, KA_5, KA_6, KA_7, KA_8, KA_9,
KA_COLON, /* : */
KA_SEMICOLON, /* ; */
KA_LESS_THAN, /* < */
KA_EQUAL, /* = */
KA_GREATER_THAN, /* > */
KA_QUESTION, /* ? */
KA_AT, /* @ */
KA_A, /* A */
KA_B, /* B */
KA_C, /* C */
KA_D, /* D */
KA_E, /* E */
KA_F, /* F */
KA_G, /* G */
KA_H, /* H */
KA_I, /* I */
KA_J, /* J */
KA_K, /* K */
KA_L, /* L */
KA_M, /* M */
KA_N, /* N */
KA_O, /* O */
KA_P, /* P */
KA_Q, /* Q */
KA_R, /* R */
KA_S, /* S */
KA_T, /* T */
KA_U, /* U */
KA_V, /* V */
KA_W, /* W */
KA_X, /* X */
KA_Y, /* Y */
KA_Z, /* Z */
KA_LBRACKET, /* [ */
KA_BACKSLASH, /* \ */
KA_RBRACKET, /* ] */
KA_CARROT, /* ^ */
KA_UNDERLINE, /* _ */
KA_GRAVE, /* ` */
KA_a, /* a */
KA_b, /* b */
KA_c, /* c */
KA_d, /* d */
KA_e, /* e */
KA_f, /* f */
KA_g, /* g */
KA_h, /* h */
KA_i, /* i */
KA_j, /* j */
KA_k, /* k */
KA_l, /* l */
KA_m, /* m */
KA_n, /* n */
KA_o, /* o */
KA_p, /* p */
KA_q, /* q */
KA_r, /* r */
KA_s, /* s */
KA_t, /* t */
KA_u, /* u */
KA_v, /* v */
KA_w, /* w */
KA_x, /* x */
KA_y, /* y */
KA_z, /* z */
KA_LBRACE, /* { */
KA_BAR, /* | */
KA_RBRACE, /* ] */
KA_TILDA, /* ~ */
KA_DEL, /* not used */
KA_ALT_F10 = 143,
KA_ALT_F9, KA_ALT_F8, KA_ALT_F7, KA_ALT_F6, KA_ALT_F5,
KA_ALT_F4, KA_ALT_F3, KA_ALT_F2, KA_ALT_F1,
KA_CTRL_F10, KA_CTRL_F9, KA_CTRL_F8, KA_CTRL_F7, KA_CTRL_F6,
KA_CTRL_F5, KA_CTRL_F4, KA_CTRL_F3, KA_CTRL_F2, KA_CTRL_F1,
KA_SHIFT_F10, KA_SHIFT_F9, KA_SHIFT_F8, KA_SHIFT_F7, KA_SHIFT_F6,
KA_SHIFT_F5, KA_SHIFT_F4, KA_SHIFT_F3, KA_SHIFT_F2, KA_SHIFT_F1,
KA_DELETE, /* <DELETE> */
KA_INSERT, /* <INSERT> */
KA_PGDN, /* <PAGE DOWN> */
KA_DOWNRIGHT = KA_PGDN,
KA_DOWN, /* <DOWN ARROW> */
KA_END, /* <END> */
KA_DOWNLEFT = KA_END,
KA_RESERVED1,
KA_RIGHT, /* <RIGHT ARROW> */
KA_KEYPAD5, /* NUMERIC KEY PAD <5> */
KA_LEFT, /* <LEFT ARROW> */
KA_RESERVED2,
KA_PGUP, /* <PAGE UP> */
KA_UPRIGHT = KA_PGUP,
KA_UP, /* <UP ARROW> */
KA_HOME, /* <HOME> */
KA_UPLEFT = KA_HOME,
KA_RESERVED3,
KA_RESERVED4,
KA_F10, KA_F9, KA_F8, KA_F7, KA_F6, KA_F5, KA_F4, KA_F3, KA_F2, KA_F1,
KA_LMOUSE,
KA_RMOUSE,
KA_JBUTTON1,
KA_JBUTTON2,
KA_J_UP,
KA_J_RIGHT,
KA_J_DOWN,
KA_J_LEFT,
KA_SHIFT_BIT = 0x0100,
KA_CTRL_BIT = 0x0200,
KA_ALT_BIT = 0x0400,
KA_RLSE_BIT = 0x0800,
KA_LCOMM_BIT = 0x1000, /* Amiga Left Comm key */
KA_RCOMM_BIT = 0x2000 /* Amiga Right Comm key */
} KeyASCIIType;
/*
** These are the keyboard codes that are returned from the input routines
** Get_Key_Num and Input_Num.
*/
typedef enum {
KN_NONE = 0,
KN_GRAVE = 1, /* ` */
KN_1, KN_2, KN_3, KN_4, KN_5, KN_6, KN_7, KN_8, KN_9, KN_0,
KN_MINUS, /* - */
KN_EQUAL, /* = */
KN_RESERVED1,
KN_BACKSPACE, /* <BACKSPACE> */
KN_TAB, /* <TAB> */
KN_Q, KN_W, KN_E, KN_R, KN_T, KN_Y, KN_U, KN_I, KN_O, KN_P,
KN_LBRACKET, /* [ */
KN_RBRACKET, /* ] */
KN_BACKSLASH, /* \ */
KN_CAPSLOCK, /* <CAPS LOCK> */
KN_A, KN_S, KN_D, KN_F, KN_G, KN_H, KN_J, KN_K, KN_L,
KN_SEMICOLON, /* ; */
KN_SQUOTE, /* ' */
KN_BACKSLASH2,
KN_RETURN, /* <RETURN> or <ENTER> */
KN_LSHIFT, /* <LEFT SHIFT> */
KN_MOUSE_MOVE, // Indicate a mouse move (for playback of
KN_Z, KN_X, KN_C, KN_V, KN_B, KN_N, KN_M,
KN_COMMA, /* , */
KN_PERIOD, /* . */
KN_SLASH, /* / */
KN_RESERVED3,
KN_RSHIFT, /* <RIGHT SHIFT> */
KN_LCTRL, /* <LEFT CTRL> */
KN_LCOMM, /* for AMIGA */
KN_LALT, /* <LEFT ALT> */
KN_SPACE, /* <SPACE BAR> */
KN_RALT, /* <RIGHT ALT> */
KN_RCOMM, /* for AMIGA */
KN_RCTRL, /* <RIGHT CTRL> */
/* the following are forced into key buffer */
KN_LMOUSE,
KN_RMOUSE,
KN_JBUTTON1,
KN_JBUTTON2,
KN_J_UP,
KN_J_RIGHT,
KN_J_DOWN,
KN_J_LEFT,
KN_SPECIAL9,
KN_SPECIAL10,
KN_E_INSERT, /* extended <INSERT> */
KN_E_DELETE, /* extended <DELETE> */
KN_RESERVED4,
KN_RESERVED5,
KN_E_LEFT, /* extended <LEFT ARROW> */
KN_E_HOME, /* extended <HOME> */
KN_E_END, /* extended <END> */
KN_RESERVED6,
KN_E_UP, /* extended <UP ARROW> */
KN_E_DOWN, /* extended <DOWN ARROW> */
KN_E_PGUP, /* extended <PAGE UP> */
KN_E_PGDN, /* extended <PAGE DOWN> */
KN_K_LPAREN, /* for AMIGA */
KN_K_RPAREN, /* for AMIGA */
KN_E_RIGHT, /* extended <RIGHT ARROW> */
KN_NUMLOCK, /* <NUM LOCK> */
KN_HOME, /* num key pad 7 */
KN_UPLEFT = KN_HOME,
KN_LEFT, /* num key pad 4 */
KN_END, /* num key pad 1 */
KN_DOWNLEFT = KN_END,
KN_RESERVED7,
KN_KEYPAD_SLASH, /* num key pad / */
KN_UP, /* num key pad 8 */
KN_CENTER, /* num key pad 5 */
KN_DOWN, /* num key pad 2 */
KN_INSERT, /* num key pad 0 */
KN_KEYPAD_ASTERISK, /* num key pad * */
KN_PGUP, /* num key pad 9 */
KN_UPRIGHT = KN_PGUP,
KN_RIGHT, /* num key pad 6 */
KN_PGDN, /* num key pad 3 */
KN_DOWNRIGHT = KN_PGDN,
KN_DELETE, /* num key pad . */
KN_KEYPAD_MINUS, /* num key pad - */
KN_KEYPAD_PLUS, /* num key pad + */
KN_RESERVED8,
KN_KEYPAD_RETURN, /* num key pad <ENTER> */
KN_RESERVED9,
KN_ESC,
KN_HELP, /* for AMIGA */
KN_F1, KN_F2, KN_F3, KN_F4, KN_F5, KN_F6, KN_F7, KN_F8, KN_F9, KN_F10,
KN_F11,
KN_F12,
KN_PRNTSCRN, /* <PRINT SCRN> */
KN_SCROLLLOCK, /* <SCROLL LOCK> */
KN_PAUSE, /* <PAUSE> */
KN_SHIFT_BIT = 0x0100,
KN_CTRL_BIT = 0x0200,
KN_ALT_BIT = 0x0400,
KN_RLSE_BIT = 0x0800,
KN_LCOMM_BIT = 0x1000, /* Amiga Left Comm key */
KN_RCOMM_BIT = 0x2000, /* Amiga Right Comm key */
KN_BUTTON = 0x8000 /* Amiga Right Comm key */
} KeyNumType;
#endif

View File

@@ -0,0 +1,129 @@
;
; 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 A S S O C I A T E S **
;***************************************************************************
;* *
;* Project Name : Westwood 32 bit Library *
;* *
;* File Name : KEYBOARD.INC *
;* *
;* Programmer : Phil W. Gorrow *
;* *
;* Start Date : July 12, 1994 *
;* *
;* Last Update : July 12, 1994 [PWG] *
;* *
;*-------------------------------------------------------------------------*
;* Contains all the defines used by the keyboard interrupt for assembly *
;* includes. *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
TRUE EQU 1 ; numerical true
FALSE EQU 0 ; numerical false
DEBUG EQU 1
MAX_X_PIXEL EQU 319
MAX_Y_PIXEL EQU 199
KN_RESERVED1 EQU 14
KN_RESERVED2 EQU 45
KN_RESERVED3 EQU 56
; these two are reserved for AMIGA open and close.
KN_LCOMM EQU 59
KN_RCOMM EQU 63
KN_LMOUSE EQU 65
KN_RMOUSE EQU 66
KN_JBUTTON1 EQU 67
KN_JBUTTON2 EQU 68
KN_J_UP EQU 69
KN_J_RIGHT EQU 70
KN_J_DOWN EQU 71
KN_J_LEFT EQU 72
KN_LEFT EQU 92
KN_UPLEFT EQU 91
KN_UP EQU 96
KN_UPRIGHT EQU 101
KN_RIGHT EQU 102
KN_DOWNRIGHT EQU 103
KN_DOWN EQU 98
KN_DOWNLEFT EQU 93
KN_CENTER EQU 97
KN_INSERT EQU 99
KN_DELETE EQU 104
KN_RETURN EQU 43
KN_SPACE EQU 61
KN_KEYPAD_RETURN EQU 108
; these two are reserved for AMIGA K left and right paren
KN_KLPAREN EQU 87
KN_KRPAREN EQU 88
KN_NUMLOCK EQU 90
KN_SCROLLOCK EQU 125 ; key ignored by the logging system
KN_MOUSE_MOVE EQU 45 ; Indicate a mouse move (for playback of logged data)
; ----------------------------------------------------------------
; flags used in Keyflags to customize keystroke interrupt.
REPEATON EQU 0001H ; 1:all makes into buffer, 0:only 1st make
TRACKEXT EQU 0002H ; 1:Home != keypad Home, 0:Home=keypad Home
FILTERONLY EQU 0004H ; 1:Normal BIOS operation with filter
CTRLSON EQU 0008H ; 1:pass scroll lock sequence into BIOS
CTRLALTTURBO EQU 0010H ; 1:Allow turbo up and down in application
CTRLCON EQU 0020H ; 1:pass stop code to BIOS
SCROLLLOCKON EQU 0040H ; 1:pass scroll lock key into BIOS
PAUSEON EQU 0080H ; 1:pass the pause key and seq to BIOS
BREAKON EQU 0100H ; 1:pass the ctrl break seq to BIOS
NONUMLOCK EQU 0200H ; 1:do NOT remap keypad to numbers
TASKSWITCHABLE EQU 0400H ; 1:allows task switching keys thru ALT-TAB,
; ALT-ESC,CTRL-ESC
PASSBREAKS EQU 0800H ; 1:Pass all break codes to keyboard buffer.
KEYMOUSE EQU 1000H ; 1:Numeric keypad moves mouse
SIMLBUTTON EQU 2000H ; 1:have space and enter keys simulate Left
DEBUGINT EQU 4000H ; mouse button when KEYMOUSE is set
SHIFTPRESS EQU 001H ; bit 0 for shift key pressed
CTRLPRESS EQU 002H ; bit 1 for ctrl key pressed
ALTPRESS EQU 004H ; bit 2 for alt key pressed
KEYRELEASE EQU 008H ; bit 3 for key released
NOTKEYRELEASE EQU 0F7H ; not of key released
CAPSLOCK EQU 00001H ; bit 0 for caps locked
NUMLOCK EQU 00002H ; bit 1 for num locked
CLEARISR EQU 020H ; value to clear In Service Register
DOS EQU 021H
INTCHIP0 EQU 020H ; 8259 interrupt chip controller 0
KEYCTRL EQU 061H ; control bits for KB sense data
KEYDATA EQU 060H ; keyboard scan code port

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 A S S O C I A T E S **
;***************************************************************************
;* *
;* Project Name : Westwood 32 bit Library *
;* *
;* File Name : KEYSTRUC.INC *
;* *
;* Programmer : Phil W. Gorrow *
;* *
;* Start Date : July 13, 1994 *
;* *
;* Last Update : July 13, 1994 [PWG] *
;* *
;*-------------------------------------------------------------------------*
;* Functions: *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
STRUC KeyboardType
SoundOn DW ? ; toggled by alt S
MusicOn DW ? ; toggled by alt M
KeyFlags DD ? ; all but repeat for now
Break DW ?
KeyMouseMove DB 6 DUP(?)
ScreenEdge DW 18 DUP (?)
Bits DB 8 DUP (?)
CondPassKey DW 17 DUP (?)
CondPassCond DW 17 DUP (?)
EscRoutine DD ?
ExtCodes DB 16 DUP (?)
ExtNums DB 16 DUP (?)
ExtRemap DB 16 DUP (?)
ExtRemapEnd DB ?
ExtKeyboard DB ?
KeyBuffer DW 128 DUP(?) ; set to empty
KeyBufferHead DD ? ; set to first entry
KeyBufferTail DD ? ; set to head for empty buffer
KeyLock DW ? ; num and caps lock bits
KeyNums DB 89 DUP (?)
KeysCapsLock DB 16 DUP (?)
KeysNumLock DB 16 DUP (?)
KeysUpDown DB 16 DUP (?)
KeyStream DB 16 DUP (?)
PassCount DW ?
KeyStreamIndex DW ?
LastKeyE0 DB ?
LastKeyE1 DB ?
PassAlways DB 10 DUP (?)
PassAlwaysEnd DB ? ; invalid code to END PassAlways
CtrlFlags DB ?
Buffer DW ?
Time DW ?
XYAdjust DB 26 DUP (?)
EdgeConv DW 16 DUP (?)
MouseUpdate DW ?
MouseX DD ?
LocalMouseX DW ?
MouseY DD ?
LocalMouseY DW ?
IsExtKey DB ?
ExtIndex DW ?
KeyOldRMI DD ? ; The origianl RM interrupt seg:off.
KeyOldPMIOffset DD ? ; The origianl PM interrupt offset
KeyOldPMISelector DD ? ; The original PM interrupt segment.
KeyCodeOffset DW ? ; Offset of the code in the RM stuff.
CallKeyRMIntOffset DW ? ; Offset of function to call DOS timer interrupt.
CallKeyRMIntAddr DD ? ; PM address of CallRealIntOffset for speed.
PMIssuedKeyInt DD ? ; did Protected mode pass this through?
BrkOldRMI DD ? ; The origianl RM interrupt seg:off.
BrkOldPMIOffset DD ? ; The origianl PM interrupt offset
BrkOldPMISelector DD ? ; The original PM interrupt segment.
BrkCodeOffset DW ? ; Offset of the code in the RM stuff.
CallBrkRMIntOffset DW ? ; Offset of function to call DOS timer interrupt.
CallBrkRMIntAddr DD ? ; PM address of CallRealIntOffset for speed.
PMIssuedBrkInt DD ? ; did Protected mode pass this through?
KeyIntDisabled DD ?
DbgOldPMIOffset DD ? ; The origianl PM interrupt offset
DbgOldPMISelector DD ? ; The original PM interrupt segment.
;---------------------------------------------------------------------------
; Begin definition of Mouse Specific Variables for real mode
;---------------------------------------------------------------------------
Button DB ? ; current value of the mouse button
MDisabled DB ? ; Is the mouse driver disabled
MInput DB ? ; Defaults to mouse input allowed.
Adjust DW ? ; flag to adjust coordinates if necessary
MouseStepX DW ? ; step values if the mouse moves at
MouseStepY DW ? ; more than one pixel at a time
MouseOffsetX DW ? ; Fractional step values used if a mouse
MouseOffsetY DW ? ; moves at less than one pixel at a time
MState DD ? ; Tracks if mouse is hidden (TRUE) or not (FALSE)
MouseXOld DW ? ; Holds last MouseX and MouseY to determine if
MouseYOld DW ? ; mouse needs to be redrawn
MCState DW ? ; Tracks if mouse conditional hidden (TRUE) or not
MouseCXLeft DD ? ; Conditional hide mouse left x position
MouseCYUpper DD ? ; Conditional hide mouse top y position
MouseCXRight DD ? ; Conditional hide mouse right x position
MouseCYLower DD ? ; Conditional hide mouse lower y position
MouseCursor DD ? ; Pointer to the mouse cursor to draw
MouseCursorSize DW ? ; Size of mouse cursor draw area
MouseBuffer DD ? ; Pointer to buffer mouse is saved in
MouseXHot DD ? ; Offset to mouse's x hot spot
MouseYHot DD ? ; Offset to mouse's y hot spot
MouseBuffX DD ? ; X position background was saved at
MouseBuffY DD ? ; Y position background was saved at
MouseBuffW DD ? ; Width of the region saved for mouse
MouseBuffH DD ? ; Height of the region saved for mouse
MouseWidth DD ? ; Mouse cursor theoretical width
MouseHeight DD ? ; Mouse cursor theoretical height
MouseCodeOffset DW ? ; Offset to the real mode code offset
MouseRight DD ? ; Right hand side of the screen
MouseBottom DD ? ; Bottom of the screen
ShadowPtr dw ?
DrawMousePtr dw ?
VGAMouseDraw dw ?
VGAMouseShadow dw ?
VESAMouseDraw dw ?
VESAMouseShadow dw ?
VesaPtr dd ?
VesaBankTable DD 8 dup (?)
Adjust_XPos dd ?
Adjust_YPos dd ?
ENDS
; InitFlags that are set to have a fully functional interrupt.
IF_ALLOC_RM equ 1 ; Allocation of RM was successful.
IF_SET_VECTORS equ 2 ; Vectors have been set.
IF_LOCKED_PM_CODE equ 4 ; Locked PM code for DPMI.
IF_LOCKED_PM_DATA equ 8 ; Locked PM code for DPMI.
IF_RATE_CHANGE equ 10 ; Timer rate was changed.
IF_FUNCTIONAL equ 20 ; Timer is in and functional.
IF_LOCKED_RM_CODE equ 40

107
WWFLAT32/INCLUDE/MCGAPRIM.H Normal file
View File

@@ -0,0 +1,107 @@
/*
** 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/>.
*/
#ifndef MCGAPRIM_H
#define MCGAPRIM_H
#ifndef WWSTD_H
#include "wwstd.h"
#endif
class GraphicViewPortClass;
class GraphicBufferClass;
class VideoBufferClass;
/*=========================================================================*/
/* Define functions which have not under-gone name mangling */
/*=========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
/*======================================================================*/
/* Externs for all of the common functions between the video buffer */
/* class and the graphic buffer class. */
/*======================================================================*/
extern long MCGA_Size_Of_Region(void *thisptr, int w, int h);
extern void MCGA_Put_Pixel(void * thisptr, int x, int y, unsigned char color);
extern int MCGA_Get_Pixel(void * thisptr, int x, int y);
extern void MCGA_Clear(void *thisptr, unsigned char color);
extern long MCGA_To_Buffer(void *thisptr, int x, int y, int w, int h, void *buff, long size);
extern long MCGA_Buffer_To_Page(int x, int y, int w, int h, void *Buffer, void *view);
extern BOOL Linear_Blit_To_Linear( void *thisptr, void * dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans);
extern BOOL Linear_Scale_To_Linear( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
extern void Vesa_Put_Pixel(void * thisptr, int x, int y, unsigned char color);
extern int Vesa_Get_Pixel(void * thisptr, int x, int y);
extern void Vesa_Clear(void *thisptr, unsigned char color);
extern long Vesa_To_Buffer(void *thisptr, int x, int y, int w, int h, void *buff, long size);
extern long Vesa_Buffer_To_Page(int x, int y, int w, int h, void *Buffer, void *view);
extern BOOL Linear_Blit_To_Vesa( void *thisptr, void * dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans);
extern BOOL Vesa_Blit_To_Linear( void *thisptr, void * dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans);
extern BOOL Vesa_Blit_To_Vesa( void *thisptr, void * dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans);
extern BOOL Linear_Scale_To_Vesa( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
extern BOOL Vesa_Scale_To_Linear( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
extern BOOL Vesa_Scale_To_Vesa( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
extern LONG MCGA_Print( void *thisptr, const char *str, int x, int y, int fcolor, int bcolor);
extern LONG Vesa_Print( void *thisptr, const char *str, int x, int y, int fcolor, int bcolor);
/*======================================================================*/
/* Externs for all of the graphic buffer class only functions */
/*======================================================================*/
extern VOID MCGA_Draw_Line(void *thisptr, int sx, int sy, int dx, int dy, unsigned char color);
extern VOID MCGA_Fill_Rect(void *thisptr, int sx, int sy, int dx, int dy, unsigned char color);
extern VOID MCGA_Remap(void * thisptr, int sx, int sy, int width, int height, void *remap);
extern VOID MCGA_Fill_Quad(void * thisptr, VOID *span_buff, int x0, int y0, int x1, int y1,
int x2, int y2, int x3, int y3, int color);
extern void MCGA_Draw_Stamp(void const *thisptr, void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap);
extern void MCGA_Draw_Stamp_Clip(void const *thisptr, void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap, int min_x, int min_y, int max_x, int max_y);
extern void Shadow_Blit(long int xpix, long int ypix, long int width, long int height, GraphicViewPortClass &src, VideoBufferClass &dst, void *shadowbuff);
extern void *Get_Font_Palette_Ptr(void);
// extern int Get_Standard_Selector(VOID);
// extern VOID Set_Selector(UWORD sel);
#ifdef __cplusplus
}
#endif
extern BOOL (*VVPC_Blit_to_GVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
extern BOOL (*VVPC_Blit_to_VVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
extern void (*VVPC_Clear_Func)(void *, unsigned char);
extern long (*VVPC_To_Buffer_Func)(void *,int x, int y, int w, int h, void *buff, long size);
extern void (*VVPC_Put_Pixel_Func)(void *,int x, int y, unsigned char color);
extern int (*VVPC_Get_Pixel_Func)(void *, int x, int y);
extern long (*VVPC_Buffer_To_Page)(int x, int y, int w, int h, void *buffer, void *view);
extern BOOL (*GVPC_Blit_to_VVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
extern BOOL (*VVPC_Blit_to_GVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
extern BOOL (*VVPC_Blit_to_VVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
extern BOOL (*VVPC_Scale_To_GVPC)( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
extern BOOL (*VVPC_Scale_To_VVPC)( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
extern BOOL (*GVPC_Scale_To_VVPC)( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
extern LONG (*VVPC_Print_Func)(void *, const char *, int, int, int, int);
extern GraphicBufferClass *LogicPage;
#endif

View File

@@ -0,0 +1,124 @@
;
; 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 : Westwood 32 bit Library *
;* *
;* File Name : MCGAPRIM.INC *
;* *
;* Programmer : Phil W. Gorrow *
;* *
;* Start Date : January 16, 1995 *
;* *
;* Last Update : January 16, 1995 [PWG] *
;* *
;*-------------------------------------------------------------------------*
;* Functions: *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
; Externs from REGIONSZ.ASM module of the MCGAPRIM library
GLOBAL MCGA_Size_Of_Region :NEAR
; Externs from GETPIX.ASM module of the MCGAPRIM library
GLOBAL MCGA_Get_Pixel :NEAR
; Externs from VGETPIX.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_Get_Pixel :NEAR
; Externs from PUTPIX.ASM module of the MCGAPRIM library
GLOBAL MCGA_Put_Pixel :NEAR
; Externs from VPUTTPIX.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_Put_Pixel :NEAR
; Externs from CLEAR.ASM module of the MCGAPRIM library
GLOBAL MCGA_Clear :NEAR
; Externs from VCLEAR.ASM module of the MCGA/SVGAPRIM library
GLOBAL Vesa_Clear :NEAR
; Externs from BITBLIT.ASM module of the MCGAPRIM library
GLOBAL Linear_Blit_To_Linear :NEAR
; Externs from VBITBLIT.ASM module of the MCGA/SVGAPRIM library
GLOBAL Linear_Blit_To_Vesa :NEAR
GLOBAL Vesa_Blit_To_Linear :NEAR
GLOBAL Vesa_Blit_To_Vesa :NEAR
; Externs from TOBUFF.ASM module of the MCGAPRIM library
GLOBAL MCGA_To_Buffer :NEAR
; Externs from VTOBUFF.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_To_Buffer :NEAR
; Externs from TOPAGE.ASM module of the MCGAPRIM library
GLOBAL MCGA_Buffer_To_Page :NEAR
; Externs from VTOPAGE.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_Buffer_To_Page :NEAR
; Externs from SCALE.ASM module of the MCGAPRIM library
GLOBAL Linear_Scale_To_Linear :NEAR
; Externs from VSCALE.ASM module of the SVGA/MCGAPRIM library
GLOBAL Linear_Scale_To_Vesa :NEAR
GLOBAL Vesa_Scale_To_Linear :NEAR
GLOBAL Vesa_Scale_To_Vesa :NEAR
; Externs from TXTPRNT.ASM module of the MCGAPRIM library
GLOBAL MCGA_Print :NEAR
GLOBAL C Get_Font_Palette_Ptr :NEAR
; Externs from VTXTPRNT.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_Print :NEAR
;*-------------------------------------------------------------------------*
;* Define MCGA only assembly GLOBALS *
;*-------------------------------------------------------------------------*
; Externs from DRAWLINE.ASM module of the MCGAPRIM library
GLOBAL MCGA_Draw_Line :NEAR
; Externs from FILLQUAD.ASM module of the MCGAPRIM library
GLOBAL MCGA_Fill_Quad :NEAR
; Externs from FILLRECT.ASM module of the MCGAPRIM library
GLOBAL MCGA_Fill_Rect :NEAR
; Externs from REMAP.ASM module of the MCGAPRIM library
GLOBAL MCGA_Remap :NEAR
; Externs from STAMP.ASM module of the MCGAPRIM library
GLOBAL MCGA_Draw_Stamp :NEAR
GLOBAL MCGA_Draw_Stamp_Clip :NEAR
GLOBAL get_clip : NEAR
struc RECTANGLE
x0 dd ?
y0 dd ?
x1 dd ?
y1 dd ?
ends RECTANGLE



View File

@@ -0,0 +1,98 @@
/*
** 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 : Memory System *
* *
* File Name : MEMFLAG.H *
* *
* Programmer : Jeff Wilson *
* *
* Start Date : April 4, 1994 *
* *
* Last Update : September 8, 1994 [IML] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef MEMFLAG_H
#define MEMFLAG_H
// Memory Flags
/*
** Memory allocation flags. These are the flags that are passed into Alloc
** in order to control the type of memory allocated.
*/
typedef enum {
MEM_NORMAL = 0x0000, // Default memory (normal).
MEM_NEW = 0x0001, // Called by the operator new and was overloaded.
MEM_CLEAR = 0x0002, // Clear memory before returning.
MEM_REAL = 0x0004, // Clear memory before returning.
MEM_TEMP = 0x0008, // Clear memory before returning.
MEM_LOCK = 0x0010, // Lock the memory that we allocated
} MemoryFlagType;
/*=========================================================================*/
/* The following prototypes are for the file: ALLOC.CPP */
/*=========================================================================*/
void * operator new(size_t size, MemoryFlagType flag);
void * operator new[] (size_t size, MemoryFlagType flag);
void *Alloc(unsigned long bytes_to_alloc, MemoryFlagType flags);
void Free(void const *pointer);
void DPMI_Lock(VOID const *ptr, long const size);
void DPMI_Unlock(void const *ptr, long const size);
void *Resize_Alloc(void *original_ptr, unsigned long new_size_in_bytes);
long Ram_Free(MemoryFlagType flag);
long Heap_Size(MemoryFlagType flag);
long Total_Ram_Free(MemoryFlagType flag);
/*=========================================================================*/
/* The following prototypes are for the file: MEM_COPY.ASM */
/*=========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
extern void Mem_Copy(void const *source, void *dest, unsigned long bytes_to_copy);
#ifdef __cplusplus
}
#endif
inline void *Add_Long_To_Pointer(void const *ptr, long size)
{
return ((void *) ( (char const *) ptr + size));
}
extern void (*Memory_Error)(void);
extern void (*Memory_Error_Exit)(char *string);
extern unsigned long MinRam; // Record of least memory at worst case.
extern unsigned long MaxRam; // Record of total allocated at worst case.
#endif

178
WWFLAT32/INCLUDE/MISC.BAK Normal file
View File

@@ -0,0 +1,178 @@
/*
** 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 : 32 bit library *
* *
* File Name : MISC.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : August 3, 1994 *
* *
* Last Update : August 3, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef MISC_H
#define MISC_H
/*========================= C++ Routines ==================================*/
/*=========================================================================*/
/* The following prototypes are for the file: EXIT.CPP */
/* Prog_End Must be supplied by the user program in startup.cpp */
/*=========================================================================*/
VOID cdecl Prog_End(VOID);
VOID cdecl Exit(INT errorval, const BYTE *message, ...);
/*=========================================================================*/
/* The following prototypes are for the file: DELAY.CPP */
/*=========================================================================*/
void Delay(int duration);
void Vsync(void);
/*=========================================================================*/
/* The following prototypes are for the file: FINDARGV.CPP */
/*=========================================================================*/
BYTE *cdecl Find_Argv(BYTE const *str);
/*=========================================================================*/
/* The following prototypes are for the file: LIB.CPP */
/*=========================================================================*/
char *Find_Argv(char const *str);
void Mono_Mem_Dump(void const *databuf, int bytes, int y);
void Convert_RGB_To_HSV(unsigned int r, unsigned int g, unsigned int b, unsigned int *h, unsigned int *s, unsigned int *v);
void Convert_HSV_To_RGB(unsigned int h, unsigned int s, unsigned int v, unsigned int *r, unsigned int *g, unsigned int *b);
/*=========================================================================*/
/* The following prototypes are for the file: VERSION.CPP */
/*=========================================================================*/
BYTE *cdecl Version(VOID);
/*=========================================================================*/
/* The following prototypes are for the file: IRANDOM.CPP */
/*=========================================================================*/
int IRandom(int minval, int maxval);
/*========================= Assembly Routines ==============================*/
#ifdef __cplusplus
extern "C" {
#endif
/*=========================================================================*/
/* The following prototypes are for the file: PROC.ASM */
/* Prog_End Must be supplied by the user program in startup.cpp */
/*=========================================================================*/
int Get_CPU(VOID);
/*=========================================================================*/
/* The following prototypes are for the file: RANDOM.ASM */
/*=========================================================================*/
UBYTE Random(VOID);
int Get_Random_Mask(int maxval);
/*=========================================================================*/
/* The following prototype is for the file: SHAKESCR.ASM */
/*=========================================================================*/
void Shake_Screen(int shakes);
/*=========================================================================*/
/* The following prototypes are for the file: REVERSE.ASM */
/*=========================================================================*/
LONG Reverse_LONG(LONG number);
WORD Reverse_WORD(WORD number);
LONG Swap_LONG(LONG number);
/*=========================================================================*/
/* The following prototype is for the file: FACING8.ASM */
/*=========================================================================*/
//int Desired_Facing8(int x1, int y1, int x2, int y2);
/*=========================================================================*/
/* The following prototype is for the file: FACING16.ASM */
/*=========================================================================*/
int Desired_Facing16(int x1, int y1, int x2, int y2);
/*=========================================================================*/
/* The following prototype is for the file: FACINGFF.ASM */
/*=========================================================================*/
//int Desired_Facing256(int x1, int y1, int x2, int y2);
/*=========================================================================*/
/* The following prototype is for the file: FADING.ASM */
/*=========================================================================*/
void *Build_Fading_Table(void const *palette, void const *dest, long int color, long int frac);
/*=========================================================================*/
/* The following prototype is for the file: CRC.ASM */
/*=========================================================================*/
long Calculate_CRC(void *buffer, long length);
/*=========================================================================*/
/* The following prototypes are for the file: DETPROC.ASM */
/*=========================================================================*/
extern WORD Processor(VOID);
extern WORD Operating_System(VOID);
extern ULONG random ( ULONG mod ) ;
extern void randomize ( void ) ;
extern int Clip_Rect ( int * x , int * y , int * dw , int * dh ,
int width , int height ) ;
extern int Confine_Rect ( int * x , int * y , int dw , int dh ,
int width , int height ) ;
/*=========================================================================*/
/* The following prototypes are for the file: OPSYS.ASM */
/*=========================================================================*/
extern WORD OperationgSystem;
#ifdef __cplusplus
}
#endif
/*=========================================================================*/
#endif // MISC_H



178
WWFLAT32/INCLUDE/MISC.H Normal file
View File

@@ -0,0 +1,178 @@
/*
** 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 : 32 bit library *
* *
* File Name : MISC.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : August 3, 1994 *
* *
* Last Update : August 3, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef MISC_H
#define MISC_H
/*========================= C++ Routines ==================================*/
/*=========================================================================*/
/* The following prototypes are for the file: EXIT.CPP */
/* Prog_End Must be supplied by the user program in startup.cpp */
/*=========================================================================*/
VOID cdecl Prog_End(VOID);
VOID cdecl Exit(INT errorval, const BYTE *message, ...);
/*=========================================================================*/
/* The following prototypes are for the file: DELAY.CPP */
/*=========================================================================*/
void Delay(int duration);
void Vsync(void);
/*=========================================================================*/
/* The following prototypes are for the file: FINDARGV.CPP */
/*=========================================================================*/
BYTE *cdecl Find_Argv(BYTE const *str);
/*=========================================================================*/
/* The following prototypes are for the file: LIB.CPP */
/*=========================================================================*/
//char *Find_Argv(char const *str);
void Mono_Mem_Dump(void const *databuf, int bytes, int y);
void Convert_RGB_To_HSV(unsigned int r, unsigned int g, unsigned int b, unsigned int *h, unsigned int *s, unsigned int *v);
void Convert_HSV_To_RGB(unsigned int h, unsigned int s, unsigned int v, unsigned int *r, unsigned int *g, unsigned int *b);
/*=========================================================================*/
/* The following prototypes are for the file: VERSION.CPP */
/*=========================================================================*/
BYTE *cdecl Version(VOID);
/*=========================================================================*/
/* The following prototypes are for the file: IRANDOM.CPP */
/*=========================================================================*/
int IRandom(int minval, int maxval);
/*========================= Assembly Routines ==============================*/
#ifdef __cplusplus
extern "C" {
#endif
/*=========================================================================*/
/* The following prototypes are for the file: PROC.ASM */
/* Prog_End Must be supplied by the user program in startup.cpp */
/*=========================================================================*/
int Get_CPU(VOID);
/*=========================================================================*/
/* The following prototypes are for the file: RANDOM.ASM */
/*=========================================================================*/
UBYTE Random(VOID);
int Get_Random_Mask(int maxval);
/*=========================================================================*/
/* The following prototype is for the file: SHAKESCR.ASM */
/*=========================================================================*/
void Shake_Screen(int shakes);
/*=========================================================================*/
/* The following prototypes are for the file: REVERSE.ASM */
/*=========================================================================*/
LONG Reverse_LONG(LONG number);
WORD Reverse_WORD(WORD number);
LONG Swap_LONG(LONG number);
/*=========================================================================*/
/* The following prototype is for the file: FACING8.ASM */
/*=========================================================================*/
//int Desired_Facing8(int x1, int y1, int x2, int y2);
/*=========================================================================*/
/* The following prototype is for the file: FACING16.ASM */
/*=========================================================================*/
int Desired_Facing16(int x1, int y1, int x2, int y2);
/*=========================================================================*/
/* The following prototype is for the file: FACINGFF.ASM */
/*=========================================================================*/
//int Desired_Facing256(int x1, int y1, int x2, int y2);
/*=========================================================================*/
/* The following prototype is for the file: FADING.ASM */
/*=========================================================================*/
void *Build_Fading_Table(void const *palette, void const *dest, long int color, long int frac);
/*=========================================================================*/
/* The following prototype is for the file: CRC.ASM */
/*=========================================================================*/
long Calculate_CRC(void *buffer, long length);
/*=========================================================================*/
/* The following prototypes are for the file: DETPROC.ASM */
/*=========================================================================*/
extern WORD Processor(VOID);
extern WORD Operating_System(VOID);
extern ULONG random ( ULONG mod ) ;
extern void randomize ( void ) ;
extern int Clip_Rect ( int * x , int * y , int * dw , int * dh ,
int width , int height ) ;
extern int Confine_Rect ( int * x , int * y , int dw , int dh ,
int width , int height ) ;
/*=========================================================================*/
/* The following prototypes are for the file: OPSYS.ASM */
/*=========================================================================*/
extern WORD OperationgSystem;
#ifdef __cplusplus
}
#endif
/*=========================================================================*/
#endif // MISC_H



77
WWFLAT32/INCLUDE/MONO.BAK 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 : Mono Sub-system *
* *
* File Name : MONO.H *
* *
* Programmer : Joe Bostic *
* 32Bit Programmer : Jeff Wilson *
* *
* Start Date : March 28, 1994 *
* *
* Last Update : March 28, 1994 [] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef MONO_H
#define MONO_H
// C++ Routines
//==================================================================
// Mono Screen routines
//==================================================================
int Initialize_Mono_Screen ( void );
// C Routines
//==================================================================
#ifdef __cplusplus
extern "C" {
#endif
// Mono Screen routines
//===================================================================
extern unsigned MonoScreen;
extern unsigned MonoEnabled;
extern void Mono_Set_Cursor(int x, int y);
extern void Mono_Clear_Screen(void);
extern void Mono_Scroll(int lines);
extern void Mono_Put_Char(char character, int attrib=2);
extern void Mono_Draw_Rect(int x, int y, int w, int h, int attrib=2, int thick=0);
extern void Mono_Text_Print(void const *text, int x, int y, int attrib=2);
extern void Mono_Print(void const *text);
extern void Mono_View_Page(int page);
extern int Mono_Printf(char const *string, ...);
#ifdef __cplusplus
}
#endif
#endif

77
WWFLAT32/INCLUDE/MONO.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 : Mono Sub-system *
* *
* File Name : MONO.H *
* *
* Programmer : Joe Bostic *
* 32Bit Programmer : Jeff Wilson *
* *
* Start Date : March 28, 1994 *
* *
* Last Update : March 28, 1994 [] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef MONO_H
#define MONO_H
// C++ Routines
//==================================================================
// Mono Screen routines
//==================================================================
int Initialize_Mono_Screen ( void );
// C Routines
//==================================================================
#ifdef __cplusplus
//extern "C" {
#endif
// Mono Screen routines
//===================================================================
extern unsigned MonoScreen;
extern unsigned MonoEnabled;
extern void Mono_Set_Cursor(int x, int y);
extern void Mono_Clear_Screen(void);
extern void Mono_Scroll(int lines);
extern void Mono_Put_Char(char character, int attrib=2);
extern void Mono_Draw_Rect(int x, int y, int w, int h, int attrib=2, int thick=0);
extern void Mono_Text_Print(void const *text, int x, int y, int attrib=2);
extern void Mono_Print(void const *text);
extern void Mono_View_Page(int page);
extern int Mono_Printf(char const *string, ...);
#ifdef __cplusplus
//}
#endif
#endif

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/>.
;
;****************************************************************************
;* bNybbleTablexxxx - ADPCM Lookup table for nybbles
;****************************************************************************
align 4
bNybbleTableLow DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
align 4
bNybbleTableHigh DB 00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2
DB 01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2
DB 02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2
DB 03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2
DB 04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2
DB 05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2
DB 06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2
DB 07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2
DB 08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2
DB 09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2
DB 0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2
DB 0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2
DB 0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2
DB 0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2
DB 0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2
DB 0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2

View File

@@ -0,0 +1,85 @@
/*
** 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 A S S O C I A T E S **
;***************************************************************************
;* *
;* Project Name : Palette 32bit Library. *
;* *
;* File Name : PALETTE.H *
;* *
;* Programmer : Scott K. Bowen *
;* *
;* Start Date : April 25, 1994 *
;* *
;* Last Update : April 27, 1994 [BRR] *
;* *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef PALETTE_H
#define PALETTE_H
/*
********************************* Constants *********************************
*/
#define RGB_BYTES 3
#define PALETTE_SIZE 256
#define PALETTE_BYTES 768
/*
******************************** Prototypes *********************************
*/
/*
-------------------------------- Palette.cpp --------------------------------
*/
VOID cdecl Set_Palette(VOID *palette);
VOID cdecl Set_Palette_Color(VOID *palette, WORD color, VOID *data);
VOID Fade_Palette_To(VOID *palette1, UWORD delay, VOID (*callback)() );
/*
-------------------------------- loadpal.cpp --------------------------------
*/
VOID cdecl Load_Palette(BYTE *palette_file_name, VOID *palette_pointer);
/*
------------------------------- morphpal.cpp --------------------------------
*/
VOID cdecl Morph_Palette (VOID *src_palette, VOID *dst_palette, UWORD delay,
VOID *callback);
/*
---------------------------------- pal.asm ----------------------------------
*/
#ifdef __cplusplus
extern "C" {
#endif
extern VOID Set_Palette_Range(VOID *palette);
extern BOOL Bump_Color(VOID *palette, WORD changable, WORD target);
#ifdef __cplusplus
}
#endif
extern "C" extern UBYTE CurrentPalette[]; /* in pal.asm */
#endif // PALETTE_H
/***************************** End of palette.h ****************************/


View File

@@ -0,0 +1,85 @@
/*
** 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 A S S O C I A T E S **
;***************************************************************************
;* *
;* Project Name : Palette 32bit Library. *
;* *
;* File Name : PALETTE.H *
;* *
;* Programmer : Scott K. Bowen *
;* *
;* Start Date : April 25, 1994 *
;* *
;* Last Update : April 27, 1994 [BRR] *
;* *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef PALETTE_H
#define PALETTE_H
/*
********************************* Constants *********************************
*/
#define RGB_BYTES 3
#define PALETTE_SIZE 256
#define PALETTE_BYTES 768
/*
******************************** Prototypes *********************************
*/
/*
-------------------------------- Palette.cpp --------------------------------
*/
VOID cdecl Set_Palette(VOID *palette);
VOID cdecl Set_Palette_Color(VOID *palette, WORD color, VOID *data);
VOID Fade_Palette_To(VOID *palette1, UWORD delay, VOID (*callback)() );
/*
-------------------------------- loadpal.cpp --------------------------------
*/
VOID cdecl Load_Palette(BYTE *palette_file_name, VOID *palette_pointer);
/*
------------------------------- morphpal.cpp --------------------------------
*/
VOID cdecl Morph_Palette (VOID *src_palette, VOID *dst_palette, UWORD delay,
VOID *callback);
/*
---------------------------------- pal.asm ----------------------------------
*/
#ifdef __cplusplus
extern "C" {
#endif
extern VOID Set_Palette_Range(VOID *palette);
extern BOOL Bump_Color(VOID *palette, WORD changable, WORD target);
extern UBYTE CurrentPalette[]; /* in pal.asm */
#ifdef __cplusplus
}
#endif
#endif // PALETTE_H
/***************************** End of palette.h ****************************/


304
WWFLAT32/INCLUDE/PLAYCD.H Normal file
View File

@@ -0,0 +1,304 @@
/*
** 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 A S S O C I A T E S **
***************************************************************************
* *
* Project Name : WWLIB *
* *
* File Name : PLAYCD.H *
* *
* Programmer : STEVE WETHERILL *
* *
* Start Date : 5/13/94 *
* *
* Last Update : June 4, 1994 [SW] *
* *
*-------------------------------------------------------------------------*/
#ifndef PLAYCD_H
#define PLAYCD_H
/* ==================================================================== */
/* Defines */
/* ==================================================================== */
#define CHLEFT 0
#define CHRIGHT 1
#define CHBOTH 2
#define AUDIO_START_MIN 1
#define AUDIO_START_SEC 44
typedef struct {
unsigned short seg ;
unsigned short sel ;
} SEGSEL ;
extern "C" int DPMI_real_alloc ( UINT , SEGSEL * , USHORT * ) ;
extern "C" int DPMI_real_free ( SEGSEL ) ;
extern "C" void DPMI_real_intr ( int , union REGS * , struct SREGS * );
extern "C" void DPMI_real_call ( void * funct , union REGS * , struct SREGS * );
/* ==================================================================== */
/* Data structures */
/* ==================================================================== */
// Audio Track Info request block
struct TinfoType {
UBYTE Length;
UBYTE SubCd;
UBYTE Command;
UWORD Status;
UBYTE Rsvd[8];
UBYTE MDescr;
UWORD TrnsAdOff;
UWORD TrnsAdSeg;
UWORD CntTrns;
UWORD StSect;
UWORD VolIDOff;
UWORD VolIDSeg;
UBYTE TrInfo;
UBYTE Track;
ULONG Start;
UBYTE TrCtrl;
};
// Audio Track Status Control Block
struct StatType {
UBYTE Length;
UBYTE SubCd;
UBYTE Command;
UWORD Status;
UBYTE Rsvd[8];
UBYTE MDescr;
UWORD TrnsAdOff;
UWORD TrnsAdSeg;
UWORD CntTrns;
UWORD StSect;
UWORD VolIDOff;
UWORD VolIDSeg;
UBYTE StatInfo;
UWORD Stat;
ULONG Start;
ULONG End;
};
// Audio Track Volume control block
struct VolmType {
UBYTE Length;
UBYTE SubCd;
UBYTE Command;
UWORD Status;
UBYTE Rsvd[8];
UBYTE MDescr;
UWORD TrnsAdOff;
UWORD TrnsAdSeg;
UWORD CntTrns;
UWORD StSect;
UWORD VolIDOff;
UWORD VolIDSeg;
UBYTE TrInfo;
UBYTE In0;
UBYTE Vol0;
UBYTE In1;
UBYTE Vol1;
UBYTE In2;
UBYTE Vol2;
UBYTE In3;
UBYTE Vol3;
};
// Audio Track Play request block
struct PlayType {
UBYTE Length;
UBYTE SubCd;
UBYTE Command;
UWORD Status;
UBYTE Rsvd[8];
UBYTE AddrMd;
ULONG Start;
ULONG CntSect;
};
// Audio Track Stop request block
struct StopType {
UBYTE Length;
UBYTE SubCd;
UBYTE Command;
UWORD Status;
UBYTE Rsvd[8];
};
/***************************************************************************
* GetCDClass -- object which will return logical CD drive *
* *
* HISTORY: *
* 06/04/1994 SW : Created. *
*=========================================================================*/
#define MAX_CD_DRIVES 26
#define NO_CD_DRIVE -1
class GetCDClass {
protected:
union REGS regs;
struct SREGS sregs;
SEGSEL cdDrive_addrp;
UWORD largestp;
int CDDrives[MAX_CD_DRIVES]; //Array containing CD drive letters
int CDCount; //Number of available CD drives
int CDIndex;
public:
GetCDClass(VOID); // This is the default constructor
~GetCDClass(VOID); // This is the destructor
inline int Get_First_CD_Drive(void);
inline int Get_Next_CD_Drive(void);
inline int Get_Number_Of_Drives(void) {return (CDCount);};
private:
VOID GetCDDrives(VOID);
};
/***********************************************************************************************
* GCDC::Get_Next_CD_Drive -- return the logical drive number of the next CD drive *
* *
* *
* *
* INPUT: Nothing *
* *
* OUTPUT: Logical drive number of a cd drive or -1 if none *
* *
* WARNINGS: None *
* *
* HISTORY: *
* 5/21/96 3:50PM ST : Created *
*=============================================================================================*/
inline int GetCDClass::Get_Next_CD_Drive(void)
{
if (CDCount){
if (CDIndex == CDCount) CDIndex = 0;
return (CDDrives[CDIndex++]);
}else{
return (-1);
}
}
/***************************************************************************
* GCDC::Get_First_CD_Drive -- return the number of the first CD drive *
* *
* *
* *
* INPUT: *
* none *
* OUTPUT: *
* logical drive number *
* WARNINGS: *
* *
* HISTORY: *
* 05/26/1994 SW : Created. *
* 12/4/95 ST : fixed for Win95 *
*=========================================================================*/
inline int GetCDClass::Get_First_CD_Drive(void)
{
CDIndex = 0;
return (Get_Next_CD_Drive());
}
/***************************************************************************
* RedBookClass -- adds red book functionality *
* *
* this class inherits from GetCDClass and adds red book play functionality*
* *
* *
* HISTORY: *
* 06/04/1994 SW : Created. *
*=========================================================================*/
class RedBookClass : public GetCDClass {
private:
SEGSEL Tinfo_addrp;
SEGSEL Stat_addrp;
SEGSEL Stop_addrp;
SEGSEL Volm_addrp;
SEGSEL Play_addrp;
StopType Stop;
PlayType Play;
VolmType Volm;
StatType Stat;
TinfoType Tinfo;
public:
RedBookClass(VOID); // This is the default constructor
~RedBookClass(VOID); // This is the destructor
ULONG RedToHS(ULONG i);
ULONG MSFtoRed(UBYTE m, UBYTE s, UBYTE f);
VOID FullCDVolume(UBYTE chan);
VOID PlayTrack(UWORD track);
VOID Play_CD_MSL(UWORD min_sec, UWORD len);
VOID PlayMSF(UBYTE startM, UBYTE startS, UBYTE startF,
UBYTE endM, UBYTE endS, UBYTE endF, UBYTE chan);
UWORD CheckCDMusic(VOID);
VOID StopCDMusic(VOID);
};
/***************************** End of Playcd.h ****************************/
#endif // PLAYCD_H

167
WWFLAT32/INCLUDE/SHAPE.H Normal file
View File

@@ -0,0 +1,167 @@
/*
** 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 : WWLIB32 *
* *
* File Name : SHAPE.H *
* *
* Programmer : Bill Randolph *
* *
* Start Date : May 25, 1994 *
* *
* Last Update : September 14, 1994 [IML] *
* *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef SHAPE_H
#define SHAPE_H
#ifndef GBUFFER_H
#include "gbuffer.h"
#endif
/*
*********************************** Types ***********************************
*/
/*
--------------------------- Shape creation flags ----------------------------
*/
typedef enum {
MAKESHAPE_NORMAL = 0x0000, // 256-color compressed shape
MAKESHAPE_COMPACT = 0x0001, // 16-color shape (with built-in color table)
MAKESHAPE_NOCOMP = 0x0002, // Uncompressed shape
MAKESHAPE_VARIABLE = 0x0004 // <16-color shape
} MakeShapeFlags_Type;
/*---------------------------------------------------------------------------
Shape drawing flags:
- The low byte is for coordinate transformations.
- The high byte is for drawing effects.
---------------------------------------------------------------------------*/
typedef enum {
SHAPE_NORMAL = 0x0000, // Standard shape
SHAPE_HORZ_REV = 0x0001, // Flipped horizontally
SHAPE_VERT_REV = 0x0002, // Flipped vertically
SHAPE_SCALING = 0x0004, // Scaled (WORD scale_x, WORD scale_y)
SHAPE_VIEWPORT_REL = 0x0010, // Coords are window-relative
SHAPE_WIN_REL = 0x0010, // Coordinates are window relative instead of absolute.
SHAPE_CENTER = 0x0020, // Coords are based on shape's center pt
SHAPE_FADING = 0x0100, // Fading effect (VOID * fading_table,
// WORD fading_num)
SHAPE_PREDATOR = 0x0200, // Transparent warping effect
SHAPE_COMPACT = 0x0400, // Never use this bit
SHAPE_PRIORITY = 0x0800, // Use priority system when drawing
SHAPE_GHOST = 0x1000, // Shape is drawn ghosted
SHAPE_SHADOW = 0x2000,
SHAPE_PARTIAL = 0x4000,
SHAPE_COLOR = 0x8000 // Remap the shape's colors
// (VOID * color_table)
} ShapeFlags_Type;
/*
------------------------------- Shape header --------------------------------
*/
typedef struct {
UWORD ShapeType; // 0 = normal, 1 = 16 colors,
// 2 = uncompressed, 4 = <16 colors
UBYTE Height; // Height of the shape in scan lines
UWORD Width; // Width of the shape in bytes
UBYTE OriginalHeight; // Original height of shape in scan lines
UWORD ShapeSize; // Size of the shape, including header
UWORD DataLength; // Size of the uncompressed shape (just data)
UBYTE Colortable[16]; // Optional color table for compact shape
} Shape_Type;
/*
------------------------------- Shape block ---------------------------------
*/
typedef struct {
UWORD NumShapes; // number of shapes in the block
LONG Offsets[]; // array of offsets to shape data
// (offsets within the shape block, with
// 0 being the first offset value, not the
// start of the shape block)
} ShapeBlock_Type;
/*
******************************** Prototypes *********************************
*/
/*
-------------------------------- prioinit.c ---------------------------------
*/
extern "C" {
extern VOID *MaskPage;
extern VOID *BackGroundPage;
extern LONG _ShapeBufferSize;
extern BYTE *_ShapeBuffer;
}
VOID cdecl Init_Priority_System (GraphicBufferClass *mask,
GraphicBufferClass *back);
/*
-------------------------------- drawshp.asm --------------------------------
*/
extern "C" {
WORD Draw_Shape(GraphicViewPortClass *gvp, VOID const *shape, LONG x, LONG y, LONG flags, ...);
}
/*
---------------------------------- shape.c ----------------------------------
*/
short cdecl Get_Shape_Data(VOID const *shape, WORD data);
int cdecl Extract_Shape_Count(VOID const *buffer);
void * cdecl Extract_Shape(VOID const *buffer, int shape);
int cdecl Restore_Shape_Height(VOID *shape);
int cdecl Set_Shape_Height(VOID const *shape, WORD newheight);
extern "C" {
int Get_Shape_Width(VOID const *shape);
int Get_Shape_Height(VOID const *shape);
int Get_Shape_Original_Height(VOID const *shape);
int Get_Shape_Uncomp_Size(VOID const *shape);
}
/*
------------------------------- setshape.asm --------------------------------
*/
extern "C" {
VOID Set_Shape_Buffer(void const *buffer, int size);
}
/*
------------------------------- shapeinf.asm --------------------------------
*/
WORD cdecl Get_Shape_Flags(VOID const *shape);
int cdecl Get_Shape_Size(VOID const *shape);
int cdecl Get_Shape_Scaled_Width(VOID const *shape, WORD scale);
int cdecl Get_Shape_Scaled_Height(VOID const *shape, WORD scale);
#endif // SHAPE_H
/****************************** End of shape.h *****************************/



214
WWFLAT32/INCLUDE/SHAPE.INC Normal file
View File

@@ -0,0 +1,214 @@
;
; 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 : WWLIB32 *
;* *
;* File Name : SHAPE.INC *
;* *
;* Programmer : Scott Bowen *
;* *
;* Start Date : May 25, 1994 *
;* *
;* Last Update : September 14, 1994 [IML] *
;* *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
;****************************** Equates ************************************
;
;............................ Shape Types ..................................
;
TRUE equ 1 ; Boolean 'true' value
FALSE equ 0 ; Boolean 'false' value
MAKESHAPE_NORMAL EQU 0 ; 256-color compressed shape
MAKESHAPE_COMPACT EQU 1 ; 16-color shape (built-in color table)
MAKESHAPE_NOCOMP EQU 2 ; non-wwcomped shape
MAKESHAPE_VARIABLE EQU 4 ; <16-color shape with variable #
; of colors (ColorTable[0] = # of colors)
; old names:
;COLOR_SHAPE EQU 1 ; flag which determines a color shape
;NORM_SHAPE EQU 2 ; flag that indicates non wwcomped shp
;NORM_SHAPE_16 EQU 4 ; flag that tells us if we have a variable sized table
; variable sized table
;
;...........................................................................
; Drawing flags:
; The low byte is for coordinate transformations.
; The high byte is for drawing effects.
;...........................................................................
;
SHAPE_NORMAL EQU 0000h ; no options; just a copy
SHAPE_HORZ_REV EQU 0001h ; reverse horizontally
SHAPE_VERT_REV EQU 0002h ; reverse vertically
SHAPE_SCALING EQU 0004h ; scale
SHAPE_VIEWPORT_REL EQU 0010h ; viewport-relative coordinates
SHAPE_CENTER EQU 0020h ; use centered coordinates
SHAPE_FADING EQU 0100h ; fading effect shape
SHAPE_PREDATOR EQU 0200h ; predator effect shape
SHAPE_COMPACT EQU 0400h ; shape is in 16 colors
SHAPE_PRIORITY EQU 0800h ; priority draw shape
SHAPE_GHOST EQU 1000h ; ghosting effect
SHAPE_SHADOW EQU 2000h ; shadow effect
SHAPE_PARTIAL EQU 4000h ; partial predator effect
SHAPE_COLOR EQU 8000h ; use alternative color table effect
SHAPE_EFFECTS EQU 03F00h ; shape effect flags
;
;.......................... Shadow Effect ..................................
;
SHADOW_COL EQU 00FFh ; magic number for shadows
;......................... Priority System .................................
;
CLEAR_UNUSED_BITS EQU 0007h ; and with 0000-0111 to clear
; non-walkable high bit and
; scaling id bits
NON_WALKABLE_BIT EQU 0080h ; and with 1000-0000 to clear all
; but non-walkable bit
;
;......................... Predator Effect .................................
;
PRED_MASK EQU 0007h ; mask used for predator pixel puts
;---------------------------------------------------------------------------
; This table is a list of the local stack variables in the function
; Draw_Shape. Many other functions in other modules access these variables
; on the stack. Since the BP is not changed when these other functions are
; called by Draw_Shape (possibly indirectly), they can also access these
; stack varibles. When adding or removing from the table, one must be very
; careful to change the offsets.
;---------------------------------------------------------------------------
;.......................... proc addresses .................................
LSkipRout EQU DWORD PTR ebp - 04h ;DWORD pointer to the skip routine
RSkipRout EQU DWORD PTR ebp - 08h ;DWORD pointer to the skip routine
DrawRout EQU DWORD PTR ebp - 0Ch ;DWORD pointer to the draw routine
;........................ optional arguments ...............................
ColorTable EQU DWORD PTR ebp - 10h ;DWORD ptr to the shapes color table
FadingTable EQU DWORD PTR ebp - 14h ;DWORD ptr to the fading table
FadingNum EQU DWORD PTR ebp - 18h ;DWORD number of times to fade
IsTranslucent EQU DWORD PTR ebp - 1Ch ;DWORD ptr to is_translucent table
Translucent EQU DWORD PTR ebp - 20h ;DWORD ptr to actual translucent tbl
PriLevel EQU BYTE PTR ebp - 24h ;BYTE priority level of the object
ScaleX EQU DWORD PTR ebp - 28h ;DWORD the x increment to scale by
ScaleY EQU DWORD PTR ebp - 2Ch ;DWORD the y increment to scale by
ShadowingTable EQU DWORD PTR ebp - 30h ;DWORD ptr to the shadowing table
;........................ Shape header values ..............................
ShapeType EQU DWORD PTR ebp - 34h ;DWORD shape type
ShapeWidth EQU DWORD PTR ebp - 38h ;DWORD shape's unscaled width
ShapeHeight EQU DWORD PTR ebp - 3Ch ;DWORD shape's unscaled height
UncompDataLen EQU DWORD PTR ebp - 40h ;DWORD uncompressed data length
ShapeData EQU DWORD PTR ebp - 44h ;DWORD pointer to shape data
;...................... Scaled shape dimensions ............................
ScaledWidth EQU DWORD PTR ebp - 48h ;DWORD shape's scaled width
ScaledHeight EQU DWORD PTR ebp - 4Ch ;DWORD shape's scaled height
;...................... Pixel clipping variables ...........................
LeftClipPixels EQU DWORD PTR ebp - 50h ;DWORD # left-clipped pixels
RightClipPixels EQU DWORD PTR ebp - 54h ;DWORD # right-clipped pixels
TopClipPixels EQU DWORD PTR ebp - 58h ;DWORD # top-clipped pixels
BotClipPixels EQU DWORD PTR ebp - 5Ch ;DWORD # bottom-clipped pixels
PixelWidth EQU DWORD PTR ebp - 60h ;DWORD drawable area in pixels
PixelHeight EQU DWORD PTR ebp - 64h ;DWORD drawable area in pixels
;......................... Drawing variables ...............................
NumColors EQU DWORD PTR ebp - 68h ;DWORD # colors for 16-color shapes
StartDraw EQU DWORD PTR ebp - 6Ch ;DWORD offset of drawing start pos
NextLine EQU DWORD PTR ebp - 70h ;DWORD offset of next drawing line
LeftClipBytes EQU DWORD PTR ebp - 74h ;DWORD # left-clipped bytes
XTotal EQU DWORD PTR ebp - 78h ;DWORD accumulated x-pixels
XTotalInit EQU DWORD PTR ebp - 7Ch ;DWORD initial roundoff for XTotal
YTotal EQU DWORD PTR ebp - 80h ;DWORD accumulated y-pixels
HeightCount EQU DWORD PTR ebp - 84h ;DWORD ht counter for drawing lines
LineStart EQU DWORD PTR ebp - 88h ;DWORD address of start of line
WidthCount EQU DWORD PTR ebp - 8Ch ;DWORD counts down # bytes skipped
StashReg EQU DWORD PTR ebp - 90h ;DWORD temp variable for draw routines
MaskAdjust EQU DWORD PTR ebp - 94h ;DWORD priority buffer offset
BackAdjust EQU DWORD PTR ebp - 98h ;DWORD background buffer offset
StashECX EQU DWORD PTR ebp - 9Ch ;DWORD temp variable for ECX register
StashEDX EQU DWORD PTR ebp -0A0h ;DWORD temp variable for EDX register
Local_Size EQU 00A4h ; Amt of data on stack: 4+last offset
;****************************** Declarations *******************************
;---------------------------------------------------------------------------
; Global variables used by the shape routines, defined in drawshp.asm
;---------------------------------------------------------------------------
GLOBAL _ShapeBuffer:DWORD
GLOBAL _ShapeBufferSize:DWORD
GLOBAL _MaskPage:DWORD
GLOBAL _BackGroundPage:DWORD
GLOBAL PredCount:DWORD
GLOBAL PredTable:BYTE
GLOBAL PredValue:DWORD
GLOBAL PartialPred:DWORD
GLOBAL PartialCount:DWORD
GLOBAL Flags:DWORD
;---------------------------------------------------------------------------
; External tables that are defined in ds_table.asm.
;---------------------------------------------------------------------------
GLOBAL LSkipTable:DWORD
GLOBAL RSkipTable:DWORD
GLOBAL DrawTable:DWORD
;------------------------------------------------------------------------------
; Public functions, declared in the order they appear in the function tables.
;--------------------------------------------------------------------------------
GLOBAL C Not_Supported:NEAR
; LSkipTable:
GLOBAL Left_Skip:NEAR ; ds_ls
GLOBAL Left_Reverse_Skip:NEAR ; ds_lrs
GLOBAL Left_Skip:NEAR ; ds_ls
GLOBAL Left_Reverse_Skip:NEAR ; ds_lrs
GLOBAL Left_Scale_Skip:NEAR ; ds_lss
GLOBAL Left_Scale_Reverse_Skip:NEAR ; ds_lsrs
GLOBAL Left_Scale_Skip:NEAR ; ds_lss
GLOBAL Left_Scale_Reverse_Skip:NEAR ; ds_lsrs
; RSkipTable:
GLOBAL Right_Skip:NEAR ; ds_rs
GLOBAL Right_Reverse_Skip:NEAR ; ds_rrs
GLOBAL Right_Skip:NEAR ; ds_rs
GLOBAL Right_Reverse_Skip:NEAR ; ds_rrs
GLOBAL Right_Scale_Skip:NEAR ; ds_rss
GLOBAL Right_Scale_Reverse_Skip:NEAR ; ds_rsrs
GLOBAL Right_Scale_Skip:NEAR ; ds_rss
GLOBAL Right_Scale_Reverse_Skip:NEAR ; ds_rsrs
; DrawTable:
GLOBAL Draw_Normal:NEAR ; ds_dn
GLOBAL Draw_Reverse:NEAR ; ds_dr
GLOBAL Draw_Normal:NEAR ; ds_dn
GLOBAL Draw_Reverse:NEAR ; ds_dr
GLOBAL Draw_Scale:NEAR ; ds_ds
GLOBAL Draw_Scale_Reverse:NEAR ; ds_dsr
GLOBAL Draw_Scale:NEAR ; ds_ds
GLOBAL Draw_Scale_Reverse:NEAR ; ds_dsr
;************************* End of shape.inc ********************************


565
WWFLAT32/INCLUDE/SOS.H Normal file
View File

@@ -0,0 +1,565 @@
/*
** 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/>.
*/
/****************************************************************************
File : sos.h
Programmer(s) : Don Fowler, Nick Skrepetos
Date :
Purpose : Include Files For Zortech C++ Compiler
Last Updated :
****************************************************************************
Copyright(c) 1993,1994 Human Machine Interfaces
All Rights Reserved
****************************************************************************/
#ifndef _SOS_DEFINED
#define _SOS_DEFINED
#include "sosdefs.h"
#pragma pack(4)
// error definition for sound operating system
#define _SOS_ERR -1
// number of drivers allowed to be open at one time
#define _SOS_MAX_DRIVERS 5
// structure definition for the capabilities
typedef struct _tagCAPABILITIES
{
BYTE szDeviceName[ 32 ]; // device name
WORD wDeviceVersion; // device version
WORD wBitsPerSample; // bits per sound sample
WORD wChannels; // stereo/mono sound card
WORD wMinRate; // minimum rate
WORD wMaxRate; // maximum rate
WORD wMixerOnBoard; // board contains mixer
WORD wMixerFlags; // mixer capabilities
WORD wFlags; // miscellaneous flags
short far * lpPortList; // list of usable ports
short far * lpDMAList; // list of usable dma channels
short far * lpIRQList; // list of usable irq channels
short far * lpRateList; // list of usable rates, -1 if any in min to max
WORD fBackground; // foreground or background driver
WORD wDeviceID; // ID for the device
WORD wTimerID; // ID for the timer
} _SOS_CAPABILITIES;
// far pointer to the device capabilities structure
typedef _SOS_CAPABILITIES far * LPSOSDEVICECAPS;
// flag types for driver
#define _FLAGS_SIGNED 0x8000
// devices that can be loaded
#define _SOUND_BLASTER_8_MONO 0xe000
#define _SOUND_BLASTER_8_ST 0xe001
#define _SBPRO_8_ST _SOUND_BLASTER_8_ST
#define _SBPRO_8_MONO 0xe00f
#define _SOUND_MASTER_II_8_MONO 0xe002
#define _MV_PAS_8_MONO 0xe003
#define _MV_PAS_16_MONO 0xe004
#define _MV_PAS_8_ST 0xe005
#define _MV_PAS_16_ST 0xe006
#define _ADLIB_GOLD_8_ST 0xe007
#define _ADLIB_GOLD_16_ST 0xe008
#define _ADLIB_GOLD_8_MONO 0xe009
#define _ADLIB_GOLD_16_MONO 0xe00a
#define _MICROSOFT_8_MONO 0xe00b
#define _MICROSOFT_8_ST 0xe00c
#define _MICROSOFT_16_MONO 0xe00d
#define _MICROSOFT_16_ST 0xe00e
#define _SOUND_SOURCE_8_MONO_PC 0xe010
#define _SOUND_SOURCE_8_MONO_TANDY 0xe011
#define _GENERAL_PORT_8_MONO 0xe012
#define _GENERAL_PORT_8_MONO_R 0xe013
#define _SIERRA_8_MONO 0xe014
#define _SB16_8_MONO 0xe015
#define _SB16_8_ST 0xe016
#define _SB16_16_MONO 0xe017
#define _SB16_16_ST 0xe018
#define _ESS_AUDIODRIVE_8_MONO 0xe019
#define _ESS_AUDIODRIVE_8_ST 0xe01a
#define _ESS_AUDIODRIVE_16_MONO 0xe01b
#define _ESS_AUDIODRIVE_16_ST 0xe01c
#define _SOUNDSCAPE_8_MONO 0xe01d
#define _SOUNDSCAPE_8_ST 0xe01e
#define _SOUNDSCAPE_16_MONO 0xe01f
#define _SOUNDSCAPE_16_ST 0xe020
#define _RAP10_8_MONO 0xe021
#define _RAP10_16_MONO 0xe022
#define _GUS_8_MONO 0xe023
#define _GUS_8_ST 0xe024
#define _GUS_16_MONO 0xe025
#define _GUS_16_ST 0xe026
#define _GUS_MAX_8_MONO 0xe027
#define _GUS_MAX_8_ST 0xe028
#define _GUS_MAX_16_MONO 0xe029
#define _GUS_MAX_16_ST 0xe02a
#define _WAVEJAMMER_8_MONO 0xe02b
#define _WAVEJAMMER_8_ST 0xe02c
#define _WAVEJAMMER_16_MONO 0xe02d
#define _WAVEJAMMER_16_ST 0xe02e
#define _TEMPOCS_8_MONO 0xe02f
#define _TEMPOCS_8_ST 0xe030
#define _TEMPOCS_16_MONO 0xe031
#define _TEMPOCS_16_ST 0xe032
#define _WAVEJAMMERCD_8_MONO 0xe033
#define _WAVEJAMMERCD_8_ST 0xe034
#define _WAVEJAMMERCD_16_MONO 0xe035
#define _WAVEJAMMERCD_16_ST 0xe036
#define _SOUND_BLASTER_8_MONO_R 0xe050
#define _MICROSOFT_8_MONO_R 0xe051
#define _SOUND_MASTER_II_8_MONO_R 0xe052
#define _ADLIB_GOLD_8_MONO_R 0xe053
#define _MV_PAS_8_MONO_R 0xe054
#define _RAP10_8_MONO_R 0xe058
#define _RAP10_16_MONO_R 0xe059
#define _SB16_8_MONO_R 0xe05a
#define _SB16_8_ST_R 0xe05b
#define _SB16_16_MONO_R 0xe05c
#define _SB16_16_ST_R 0xe05d
#define _MV_PAS_16_MONO_R 0xe060
#define _SOUNDSCAPE_8_MONO_R 0xe061
#define _SOUNDSCAPE_8_ST_R 0xe062
#define _SOUNDSCAPE_16_MONO_R 0xe063
#define _SOUNDSCAPE_16_ST_R 0xe064
#define _ESS_AUDIODRIVE_8_MONO_R 0xe065
#define _ESS_AUDIODRIVE_8_ST_R 0xe066
#define _ESS_AUDIODRIVE_16_MONO_R 0xe067
#define _ESS_AUDIODRIVE_16_ST_R 0xe068
#define _SPEECH_THING_8_MONO 0xe090
#define _YAMAHA_8_MONO 0xe106
#define _INT_SPEAKER_8_MONO 0xe107
// call indexes for the loadable drivers
enum
{
_DRV_INIT,
_DRV_UNINIT,
_DRV_SETRATE,
_DRV_SETACTION,
_DRV_START,
_DRV_STOP,
_DRV_PAUSE,
_DRV_RESUME,
_DRV_CAPABILITIES,
_DRV_PLAY_FOREGROUND,
_DRV_GET_FILL_INFO,
_DRV_GET_CALL_FUNCTIONS,
_DRV_SET_CALL_FUNCTIONS
};
// fill info
typedef struct _tagFillInfo
{
LPSTR lpFillHandler; // pointer to fill handler
LPWORD lpDMAFillCount; // pointer to dma count
LPSTR lpSampleList; // pointer to sample list
LPWORD lpDMAMasterVolume; // pointer to dma count
} _SOS_FILL_INFO;
// caps info structure
typedef struct _tagCapsInfo
{
LPSTR lpPortList; // pointer to port list
LPSTR lpDMAList; // pointer to DMA list
LPSTR lpIRQList; // pointer to IRQ list
LPSTR lpRateList; // pointer to rate list
} _SOS_CAPS_INFO;
// maximum number of available voice
#define _MAX_VOICES 32
// structure definition
typedef struct _tagSAMPLE
{
LPSTR samplePtr; // pointer to data buffer
LPSTR sampleData; // pointer to active data
LPSTR sampleLoopPtr; // pointer for loop back
WORD sampleLength; // length of sample
WORD sampleIndex; // index into sample
WORD sampleLoopLength; // length of loop
WORD sampleBytesLeft; // bytes left to play in sample
WORD sampleLoopPoint; // byte count for loop point
WORD sampleLoopEndLength; // length of remaining chunk
short sampleFlags; // control sample
short sampleVolume; // volume control
short sampleID; // sample ID
short sampleChannel; // channel to play sample on
short sampleLoopCount; // loop count
short sampleLastFill; // last fill position
VOID ( far cdecl * sampleCallback )( WORD, WORD, WORD ); // callback function for sample
WORD samplePitchAdd;
short samplePitchFraction;
short samplePort; // port to use for non-dma digitized
WORD sampleTotalBytes;
WORD sampleByteLength;
short samplePanLocation;
short samplePanSpeed;
short samplePanDirection;
short samplePanStart;
short samplePanEnd;
short sampleDelayBytes;
short sampleDelayRepeat;
WORD sampleADPCMPredicted;
short sampleADPCMIndex;
short sampleRootNoteMIDI;
WORD sampleTemp1;
} _SOS_SAMPLE;
// enumeration for left or right channel
enum
{
_LEFT_CHANNEL,
_RIGHT_CHANNEL,
_CENTER_CHANNEL,
_INTERLEAVED
};
// enumeration for foreground and background
enum
{
_FOREGROUND,
_BACKGROUND
};
// defines for the sample flags
#define _ACTIVE 0x8000
#define _LOOPING 0x4000
#define _FIRST_TIME 0x2000
#define _PENDING_RELEASE 0x1000
#define _CONTINUE_BLOCK 0x0800
#define _PITCH_SHIFT 0x0400
#define _PANNING 0x0200
#define _VOLUME 0x0100
#define _TRANSLATE16TO8 0x0080
#define _STAGE_LOOP 0x0040
#define _TRANSLATE8TO16 0x0020
#define _STEREOTOMONO 0x0010
// defines for the wParam flags
#define _SINGLE_SAMPLE 0x01
#define _SOS_DCAPS_AUTO_REINIT 0x01
#define _SOS_DCAPS_MPU_401 0x02
#define _SOS_DCAPS_OPL2 0x04
#define _SOS_DCAPS_OPL3 0x08
#define _SOS_DCAPS_OPL4 0x10
#define _SOS_DCAPS_WAVETABLE 0x20
#define _SOS_DCAPS_DL_SAMPLES 0x40
#define _SOS_DCAPS_FIFO_DEVICE 0x80
#define _SOS_DCAPS_ENV_NEEDED 0x100
#define _SOS_DCAPS_PSEUDO_DMA1 0x200
#define _SOS_DCAPS_SIGNED_DATA 0x8000
// file header structure
typedef struct
{
// name ID
BYTE szName[ 32 ];
// number of drivers in the file
WORD wDrivers;
// offset of first driver
WORD lOffset;
// size of the file
WORD lFileSize;
} _FILEHEADER;
// driver header structure
typedef struct
{
// name ID
BYTE szName[ 32 ];
// offset of next driver
WORD lNextDriver;
// size of current driver
WORD wSize;
// id for the current device
WORD wDeviceID;
// id for the type of DOS extender
WORD wExtenderType;
} _DRIVERHEADER;
// device hardware information
typedef struct
{
// port to be used
WORD wPort;
// irq to use
WORD wIRQ;
// dma channel to se
WORD wDMA;
// extra parameter
WORD wParam;
} _SOS_HARDWARE;
// structure definition for start sample
typedef struct
{
// pointer to sample
LPSTR lpSamplePtr;
// size of the sample
WORD dwSampleSize;
// number of times to loop the sample -1 is infinite
WORD wLoopCount;
// channel to play sample on
WORD wChannel;
// volume to play sample at
WORD wVolume;
// id for the sample
WORD wSampleID;
// far pointer to the callback function
VOID ( far cdecl *lpCallback )( WORD, WORD, WORD );
// port to use if driver is a non-dma background driver
WORD wSamplePort;
// flags field
WORD wSampleFlags;
// total length of sample including loops, etc..
WORD dwSampleByteLength;
// loop point for the sample
WORD dwSampleLoopPoint;
WORD dwSampleLoopLength;
// pitch shifting components
WORD dwSamplePitchAdd;
WORD wSamplePitchFraction;
// pan components
WORD wSamplePanLocation;
WORD wSamplePanSpeed;
WORD wSamplePanDirection;
WORD wSamplePanStart;
WORD wSamplePanEnd;
// delay parts
WORD wSampleDelayBytes;
WORD wSampleDelayRepeat;
// compression components
WORD dwSampleADPCMPredicted;
WORD wSampleADPCMIndex;
// root note for pitch shifting
WORD wSampleRootNoteMIDI;
// filler for future upgrades
WORD dwSampleTemp1;
WORD dwSampleTemp2;
WORD dwSampleTemp3;
} _SOS_START_SAMPLE;
// structure for initializing a driver
typedef struct
{
WORD wBufferSize;
LPSTR lpBuffer;
BOOL wAllocateBuffer;
WORD wSampleRate;
WORD wParam;
LONG dwParam;
VOID ( far *lpFillHandler )( VOID );
LPSTR lpDriverMemory;
LPSTR lpDriverMemoryCS;
LPSTR lpTimerMemory;
LPSTR lpTimerMemoryCS;
WORD wTimerID;
WORD wPhysical;
} _SOS_INIT_DRIVER;
// define for the timer types to use
#define _SOS_NORMAL_TIMER 0x00
// enumeration for the timer types
enum
{
_TIMER_8_MONO = 0x1000,
_TIMER_8_ST,
_TIMER_16_MONO,
_TIMER_16_ST,
_TIMER_8_MONO_ULAW,
_TIMER_8_ST_ULAW,
_TIMER_16_MONO_ULAW,
_TIMER_16_ST_ULAW,
_TIMER_8_MONO_REC,
_TIMER_8_MONO_ULAW_REC,
_TIMER_UNDEFINED_1,
_TIMER_UNDEFINED_2,
_TIMER_UNDEFINED_3,
_TIMER_UNDEFINED_4,
_TIMER_UNDEFINED_5,
_TIMER_UNDEFINED_6,
_TIMER_UNDEFINED_7,
_TIMER_UNDEFINED_8,
_TIMER_UNDEFINED_9,
_TIMER_UNDEFINED_A,
_TIMER_UNDEFINED_B,
_TIMER_UNDEFINED_C,
_TIMER_UNDEFINED_D,
_TIMER_UNDEFINED_E,
_TIMER_UNDEFINED_F,
_TIMER_UNDEFINED_10,
_TIMER_UNDEFINED_11,
_TIMER_UNDEFINED_12,
_TIMER_UNDEFINED_13,
_TIMER_UNDEFINED_14,
_TIMER_UNDEFINED_15,
_TIMER_UNDEFINED_16,
_TIMER_8_SOUND_SOURCE,
_TIMER_8_SOUND_SOURCE_TANDY,
_TIMER_8_GENERAL_PORT,
_TIMER_8_GENERAL_PORT_REC
};
// define for no slots available
#define _ERR_NO_SLOTS ( WORD )-1
// error codes for the system
enum
{
_ERR_NO_ERROR,
_ERR_DRIVER_NOT_LOADED,
_ERR_INVALID_POINTER,
_ERR_DETECT_INITIALIZED,
_ERR_FAIL_ON_FILE_OPEN,
_ERR_MEMORY_FAIL,
_ERR_INVALID_DRIVER_ID,
_ERR_NO_DRIVER_FOUND,
_ERR_DETECTION_FAILURE,
_ERR_DRIVER_LOADED,
_ERR_INVALID_HANDLE,
_ERR_NO_HANDLES,
_ERR_PAUSED,
_ERR_NOT_PAUSED,
_ERR_INVALID_DATA,
_ERR_DRV_FILE_FAIL,
_ERR_INVALID_PORT,
_ERR_INVALID_IRQ,
_ERR_INVALID_DMA,
_ERR_INVALID_DMA_IRQ
};
// maximum number of timer events that can be registered
#define _TIMER_MAX_EVENTS 0x10
// flags for the debugging system
#define _SOS_DEBUG_NORMAL 0x0000
#define _SOS_DEBUG_NO_TIMER 0x0001
#define _SOS_TIMER_DPMI 0x0002
// define for types of DOS extenders
#define _SOS_RATIONAL 0x8000
#define _SOS_FLASHTECK 0x4000
// defines for the types of timers for different
// dos extenders
#define _SOS_TIMER_NEAR 0x8000
#define _SOS_TIMER_FAR 0x4000
// values for callback information
enum
{
_SAMPLE_PROCESSED,
_SAMPLE_LOOPING,
_SAMPLE_DONE
};
// define for special 18.2 callback rate to dos
#define _TIMER_DOS_RATE 0xff00
#pragma pack()
#pragma aux int_3 = "int 3"
#pragma pack( 1 )
typedef struct
{
unsigned region_size;
unsigned offset;
unsigned segment;
unsigned short number_available;
unsigned short number_used;
unsigned page0;
} EVDS_STRUCT;
typedef struct
{
unsigned region_size;
unsigned offset;
unsigned short segment;
unsigned short ID;
unsigned physical;
} VDS_STRUCT;
#pragma pack()
#include "sosdata.h"
#include "sosfnct.h"
#endif

View File

@@ -0,0 +1,83 @@
/*
** 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/>.
*/
/****************************************************************************
*
* File : soscomp.h
* Date Created : 6/1/94
* Description :
*
* Programmer(s) : Nick Skrepetos
* Last Modification : 10/1/94 - 11:37:9 AM
* Additional Notes : Modified by Denzil E. Long, Jr.
*
*****************************************************************************
* Copyright (c) 1994, HMI, Inc. All Rights Reserved *
****************************************************************************/
#ifndef _SOS_COMPRESS
#define _SOS_COMPRESS
/* compression types */
enum {
_ADPCM_TYPE_1,
};
/* define compression structure */
typedef struct _tagCOMPRESS_INFO {
char *lpSource;
char *lpDest;
unsigned long dwCompSize;
unsigned long dwUnCompSize;
unsigned long dwSampleIndex;
long dwPredicted;
long dwDifference;
short wCodeBuf;
short wCode;
short wStep;
short wIndex;
unsigned long dwSampleIndex2; //added BP for channel 2
long dwPredicted2; //added BP for channel 2
long dwDifference2; //added BP for channel 2
short wCodeBuf2; //added BP for channel 2
short wCode2; //added BP for channel 2
short wStep2; //added BP for channel 2
short wIndex2; //added BP for channel 2
short wBitSize;
short wChannels; //added BP for # of channels
} _SOS_COMPRESS_INFO;
/* compressed file type header */
typedef struct _tagCOMPRESS_HEADER {
unsigned long dwType; // type of compression
unsigned long dwCompressedSize; // compressed file size
unsigned long dwUnCompressedSize; // uncompressed file size
unsigned long dwSourceBitSize; // original bit size
char szName[16]; // file type, for error checking
} _SOS_COMPRESS_HEADER;
/* Prototypes */
extern "C" {
void sosCODECInitStream(_SOS_COMPRESS_INFO *);
unsigned long sosCODECCompressData(_SOS_COMPRESS_INFO *, unsigned long);
unsigned long sosCODECDecompressData(_SOS_COMPRESS_INFO *, unsigned long);
}
#endif


128
WWFLAT32/INCLUDE/SOSDATA.H Normal file
View File

@@ -0,0 +1,128 @@
/*
** 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/>.
*/
/****************************************************************************
File : sosdata.h
Programmer(s) : Don Fowler, Nick Skrepetos
Date :
Purpose : Include Files For Zortech C++ Compiler
Last Updated :
****************************************************************************
Copyright(c) 1993,1994 Human Machine Interfaces
All Rights Reserved
****************************************************************************/
#ifndef _SOS_DATA
#define _SOS_DATA
#include <stddef.h>
#pragma pack(4)
extern WORD _sosDIGIData_Start;
extern WORD _sosDIGIData_End;
extern WORD _wSOSDriverLinear[];
extern WORD _wSOSTimerLinear[];
extern LPSTR _lpSOSDriver[];
extern LPSTR _lpSOSTimer[];
extern LPSTR _lpSOSDriverCS[];
extern LPSTR _lpSOSTimerCS[];
extern BOOL _wSOSDriverLoaded[];
extern BOOL _wSOSTimerLoaded[];
extern BOOL _wSOSDriverInitialized[];
extern WORD _wSOSOutputRate[];
extern WORD _wSOSDMABuffersize[];
extern LONG _dwSOSDMABufferPhysical[];
extern LPSTR _lpSOSDMABuffer[];
extern BOOL _wTimerUsed;
extern VOID ( far *_lpSOSFillHandler[] )( VOID );
extern WORD _wSOSTimerType[];
extern WORD _wSOSDriverType[];
extern _SOS_SAMPLE far * _lpSOSSampleList[][ _MAX_VOICES ];
extern LPWORD _lpSOSDMAIrqCount[];
extern LPWORD _lpSOSDMAFillCount[];
extern WORD _wSOSTmrNextCount;
extern VOID ( interrupt far *_lpSOSOldTimer )( VOID );
extern WORD _wSOSDriverID[];
extern _SOS_CAPABILITIES _sSOSDriverCaps[];
extern WORD _wSOSDMAPortList[];
extern BYTE _bSOSDMAChannel[];
extern _SOS_INIT_DRIVER _sSOSDIGIInitDriver[];
extern BYTE _pSOSDriverPath[];
extern BYTE _pSOSTempDriverPath[];
extern BOOL _wTIMERUsed;
extern WORD _wTIMERValue;
extern VOID ( far * _lpTIMEREvents[] )( VOID );
extern WORD _wTIMEREventRate[];
extern WORD _dwTIMEREventFraction[];
extern WORD _dwTIMEREventFractionCurrent[];
extern BYTE _bSOSMIDITimerSongHandler[];
extern BYTE _bSOSMIDISongHandle;
extern WORD _wSOSTimerMemHandle[];
extern WORD _wSOSDriverMemHandle[];
extern WORD _wSOSRealSeg[];
extern _FILEHEADER _sDETFileHeader;
extern _DRIVERHEADER _sDETDriverHeader;
extern _FILEHEADER sLOADFileHeader;
extern _DRIVERHEADER sLOADDriverHeader;
extern BOOL _wDETInitialized;
extern WORD _wDETLinear;
extern LPSTR _lpDETDriverBuffer;
extern LPSTR _lpDETDriverBufferCS;
extern WORD _hDETFile;
extern DWORD _dwDETDriverIndex;
extern WORD _wDETDriverIndexCur;
extern WORD _wDETMemHandle;
extern LPSOSDEVICECAPS _lpDETDeviceCaps;
extern _SOS_CAPABILITIES _sDETCaps;
extern PSTR _pSOSErrorStrings[];
extern BOOL _wSOSBufferAllocated[];
extern BOOL _wSOSSystemInitialized;
extern VDS_STRUCT _sSOSVDSInfo;
extern _SOS_FILL_INFO _sSOSFillInfo;
extern WORD _wSOSTimerEventIndex;
extern WORD _wSOSTimerEntered;
extern WORD _wSOSDriverSize[];
extern WORD _wSOSTimerSize[];
#ifdef __cplusplus
extern "C" {
#endif
extern WORD _sosDIGIData1_Start;
extern WORD _sosDIGIData1_End;
extern WORD _sosDIGIData2_Start;
extern WORD _sosDIGIData2_End;
extern BYTE _bTIMERInstalled;
extern BYTE _bTIMERDPMI;
extern WORD wDetectPort;
extern WORD wDetectIRQ;
extern WORD wDetectDMA;
extern WORD wDetectParam;
#ifdef __cplusplus
}
#endif
#pragma pack()
#endif


View File

@@ -0,0 +1,83 @@
/*
** 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/>.
*/
/****************************************************************************
File : sosdefs.h
Programmer(s) : Don Fowler, Nick Skrepetos
Date :
Purpose : Include Files For Zortech C++ Compiler
Last Updated :
****************************************************************************
Copyright(c) 1993,1994 Human Machine Interfaces
All Rights Reserved
****************************************************************************/
#ifndef _SOSDEFS_DEFINED
#define _SOSDEFS_DEFINED
#undef _TRUE
#undef _FALSE
#undef _NULL
enum
{
_FALSE,
_TRUE
};
#define _NULL 0
#ifndef VOID
#define VOID void
#endif
typedef int BOOL;
typedef unsigned int UINT;
typedef unsigned char BYTE;
typedef unsigned WORD;
#ifndef LONG
typedef signed long LONG;
#endif
typedef unsigned long DWORD;
typedef BYTE * PBYTE;
typedef char near * PSTR;
typedef WORD * PWORD;
typedef LONG * PLONG;
typedef VOID * PVOID;
typedef BYTE far * LPBYTE;
typedef BYTE far * LPSTR;
typedef WORD far * LPWORD;
typedef LONG far * LPLONG;
typedef VOID far * LPVOID;
typedef BYTE huge * HPBYTE;
typedef BYTE huge * HPSTR;
typedef WORD huge * HPWORD;
typedef LONG huge * HPLONG;
typedef VOID huge * HPVOID;
typedef unsigned HANDLE;
#endif


218
WWFLAT32/INCLUDE/SOSFNCT.H Normal file
View File

@@ -0,0 +1,218 @@
/*
** 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/>.
*/
/****************************************************************************
File : sosfnct.h
Programmer(s) : Don Fowler, Nick Skrepetos
Date :
Purpose : Include Files For Zortech C++ Compiler
Last Updated :
****************************************************************************
Copyright(c) 1993,1994 Human Machine Interfaces
All Rights Reserved
****************************************************************************/
#ifndef _SOS_FUNCTIONS
#define _SOS_FUNCTIONS
#pragma pack(4)
WORD sosDIGILockMemory ( VOID );
WORD sosDIGIUnLockMemory ( VOID );
WORD sosDIGIInitSystem ( LPSTR, WORD );
WORD sosDIGIUnInitSystem ( VOID );
WORD sosDIGIInitDriver ( WORD, _SOS_HARDWARE far *,
_SOS_INIT_DRIVER far *, WORD far * );
WORD sosDIGIUnInitDriver ( WORD, BOOL, BOOL );
WORD sosDIGILoadDriver ( WORD, WORD, LPSTR far *, LPSTR far *, PSTR, PSTR, WORD * );
WORD sosDIGIUnLoadDriver ( WORD );
WORD sosDIGIGetDeviceCaps ( WORD, LPSOSDEVICECAPS );
#ifdef PHARLAP
LPSTR sosDIGIAllocateBuffer ( WORD , WORD *, WORD * );
#else
LPSTR sosDIGIAllocateBuffer ( WORD , WORD *, WORD * );
#endif
WORD sosDIGIStopSample ( WORD, WORD );
WORD sosDIGISamplesPlaying ( WORD );
BOOL sosDIGISampleDone ( WORD, WORD );
BOOL sosDIGISampleFilling ( WORD, WORD );
WORD sosDIGIStartSample ( WORD, _SOS_START_SAMPLE far * );
WORD sosDIGIContinueSample ( WORD, WORD, _SOS_START_SAMPLE far * );
WORD sosDIGIDetectInit ( LPSTR );
WORD sosDIGIDetectUnInit ( VOID );
WORD sosDIGIDetectFindHardware ( WORD, _SOS_CAPABILITIES far *, WORD far * );
WORD sosDIGIDetectFindFirst ( _SOS_CAPABILITIES far *, WORD far * );
WORD sosDIGIDetectFindNext ( _SOS_CAPABILITIES far *, WORD far * );
WORD sosDIGIDetectGetSettings ( _SOS_HARDWARE far * );
WORD sosDIGIDetectGetCaps ( WORD, _SOS_CAPABILITIES far * );
WORD sosDIGIDetectVerifySettings( _SOS_HARDWARE far * );
PSTR sosGetErrorString ( WORD );
WORD sosDIGILoadTimer ( WORD , LPSTR far *, LPSTR far *, PSTR, PSTR, WORD * );
WORD sosDIGIUnLoadTimer ( WORD );
WORD sosTIMERRegisterEvent ( WORD wCallRate, VOID ( far * lpTimerEvent )( VOID ), WORD far *lpTimerHandle );
WORD sosTIMERInitSystem ( WORD, WORD );
WORD sosTIMERUnInitSystem ( WORD );
WORD sosTIMERSetRate ( WORD );
WORD sosTIMERRemoveEvent ( WORD );
WORD sosTIMERAlterEventRate ( WORD, WORD );
WORD sosTIMERGetEventRate ( WORD );
VOID far sosTIMEROldHandler ( VOID );
VOID far sosTIMERHandler ( VOID );
// functions in soscntl.c
WORD sosDIGISetSampleVolume ( WORD, WORD, WORD );
WORD sosDIGIGetSampleVolume ( WORD, WORD );
WORD sosDIGISetChannel ( WORD, WORD, WORD );
WORD sosDIGIGetChannel ( WORD, WORD );
WORD sosDIGIGetBytesProcessed ( WORD, WORD );
WORD sosDIGIGetLoopCount ( WORD, WORD );
WORD sosDIGISetPanLocation ( WORD, WORD, WORD );
WORD sosDIGIGetPanLocation ( WORD, WORD );
DWORD sosDIGISetPitch ( WORD, WORD, DWORD );
DWORD sosDIGIGetPitch ( WORD, WORD );
WORD sosDIGIGetDMAPosition ( WORD );
WORD sosDIGISetPanSpeed ( WORD, WORD, WORD );
WORD sosDIGIGetPanSpeed ( WORD, WORD );
WORD sosDIGIGetSampleID ( WORD, WORD );
WORD sosDIGIGetSampleHandle ( WORD, WORD );
WORD sosDIGISetMasterVolume ( WORD, WORD );
#ifdef PHARLAP
VOID sosFreeVDSPage ( unsigned short, unsigned short, DWORD );
WORD sosAllocVDSPage ( unsigned short *, unsigned short *, DWORD * );
#else
WORD sosAllocVDSPage ( LPSTR *, WORD *, WORD * );
VOID sosFreeVDSPage ( WORD, WORD, LONG );
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef PHARLAP
extern int cdecl sosRealFree ( int );
extern BOOL cdecl _sos_read( WORD, LPSTR, WORD, WORD * );
extern int cdecl sosRealAlloc( int, int *, int * );
extern void cdecl sosDRVFarMemCopy( LPSTR, LPSTR, WORD );
extern int cdecl sosGetCS( VOID );
extern int cdecl sosGetES( VOID );
#else
extern int cdecl sosRealAlloc ( int, int *, int * );
extern int cdecl sosRealFree ( int );
#endif
// sos driver functions
extern WORD cdecl sosDRVLockMemory ( DWORD, DWORD );
extern WORD cdecl sosDRVUnLockMemory ( DWORD, DWORD );
extern void cdecl sosDRVGetCapsInfo ( LPSTR, LPSTR, _SOS_CAPABILITIES far * );
extern void cdecl sosDetDRVGetCapsInfo ( LPSTR, LPSTR, _SOS_CAPABILITIES far * );
extern void cdecl sosDRVGetCapsPtr ( LPSTR, LPSTR, _SOS_CAPABILITIES far * );
extern void cdecl sosDRVInit ( LPSTR, LPSTR, int, int, int, int, int, int );
extern void cdecl sosDRVStart ( LPSTR, LPSTR, int, int );
extern void cdecl sosDRVSetRate ( LPSTR, LPSTR, int );
extern void cdecl sosDRVSetAction ( LPSTR, LPSTR );
extern void cdecl sosDRVStop ( LPSTR, LPSTR );
extern void cdecl sosDRVUnInit ( LPSTR, LPSTR );
extern void cdecl sosDRVGetFillInfo ( LPSTR, LPSTR, LPSTR, int, int, int, _SOS_FILL_INFO * );
extern void cdecl sosFillSampleStructs ( PSTR, LPSTR );
extern WORD cdecl sosDetDRVExist ( LPSTR, LPSTR );
extern WORD cdecl sosDetDRVGetSettings ( LPSTR, LPSTR );
extern WORD cdecl sosDetDRVVerifySettings( LPSTR, WORD, WORD, WORD, LPSTR );
extern WORD cdecl sosDIGIInitForWindows( WORD );
extern WORD cdecl sosDIGIUnInitForWindows( WORD );
extern LPSTR cdecl sosAllocateFarMem ( WORD, PSTR, WORD * );
extern LPSTR cdecl sosCreateAliasCS ( LPSTR );
extern VOID cdecl sosFreeSelector ( LPSTR, DWORD );
extern LPSTR cdecl sosMAKEDOSPtr ( PSTR );
extern VOID cdecl sosDetDRVSetEnvString ( DWORD, PSTR );
extern PSTR cdecl sosDetDRVGetEnvString ( DWORD );
extern VOID cdecl sosDetDRVEnvStringInit ( LPSTR, LPSTR );
extern VOID cdecl sosDRVSetupCallFunctions( LPSTR, LPSTR, LPSTR, LPSTR );
extern WORD cdecl sosDRVGetFreeMemory ( VOID );
extern WORD cdecl sosDRVAllocVDSStruct ( WORD, WORD *, WORD * );
extern WORD cdecl sosDRVFreeVDSStruct ( WORD, WORD );
extern WORD cdecl sosDRVIsWindowsActive ( VOID );
extern WORD cdecl sosDRVVDSGetBuffer ( WORD );
extern WORD cdecl sosDRVVDSFreeBuffer ( WORD );
extern WORD cdecl getDS( VOID );
extern WORD cdecl sosDRVMakeDMASelector ( WORD );
extern WORD cdecl sosDRVFreeDMASelector ( WORD );
extern void cdecl sosTIMERDRVInit( int wRate, void ( far * )( void ) );
extern void cdecl sosTIMERDRVUnInit( void );
extern void cdecl sosTIMERDRVHandler( void );
extern void cdecl sosTIMERDRVFHandler( void );
extern void cdecl sosTIMERDRVEnable( void );
extern void cdecl sosTIMERDRVDisable( void );
extern void cdecl sosTIMERDRVCallOld( void );
extern void cdecl sosTIMERDRVSetRate( WORD );
extern void cdecl sosDIGITimer_Start( void );
extern void cdecl sosDIGITimer_End( void );
extern void cdecl sosDIGIDrv_Start( void );
extern void cdecl sosDIGIDrv_End( void );
#ifdef __cplusplus
}
#endif
// external functions for handling system initialization and
// uninitialization
WORD sosEXDIGInitDriver ( WORD, WORD, WORD, LPSTR,
_SOS_HARDWARE far *, WORD * );
WORD sosEXDIGIUnInitDriver ( VOID );
WORD sosEXDETFindDriver ( WORD, LPSTR, _SOS_HARDWARE far *,
_SOS_CAPABILITIES far * );
// memory locking prototypes
VOID sosDIGICaps_Start( VOID );
VOID sosDIGICaps_End( VOID );
VOID sosDIGIErr_Start( VOID );
VOID sosDIGIErr_End( VOID );
VOID sosDIGITmr_Start( VOID );
VOID sosDIGITmr_End( VOID );
VOID sosDIGIStart_Start( VOID );
VOID sosDIGIStart_End( VOID );
VOID sosDIGIPlyng_Start( VOID );
VOID sosDIGIPlyng_End( VOID );
VOID sosDIGIRate_Start( VOID );
VOID sosDIGIRate_End( VOID );
VOID sosDIGIDone_Start( VOID );
VOID sosDIGIDone_End( VOID );
VOID sosDIGIDetec_Start( VOID );
VOID sosDIGIDetec_End( VOID );
VOID sosDIGIInit_Start( VOID );
VOID sosDIGIInit_End( VOID );
VOID sosDIGILoad_Start( VOID );
VOID sosDIGILoad_End( VOID );
VOID sosDIGICntl_Start( VOID );
VOID sosDIGICntl_End( VOID );
#pragma pack()
#endif

129
WWFLAT32/INCLUDE/SOSRES.H Normal file
View File

@@ -0,0 +1,129 @@
/*
** 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/>.
*/
/****************************************************************************
File : sosres.h
Programmer(s) : Don Fowler, Nick Skrepetos
Date :
Purpose : Include Files For Zortech C++ Compiler
Last Updated :
****************************************************************************
Copyright(c) 1993,1994 Human Machine Interfaces
All Rights Reserved
****************************************************************************/
#define _SOS_RESOURCE
#ifndef _SOS_RESOURCE
#define _SOS_RESOURCE
// structure for resource file header
typedef struct
{
// file version
WORD wVersion;
// file size
LONG dwFileSize;
// number of resources in file
WORD wResCount;
// offset of resource data from top of file
LONG dwResOffset;
// offset of sync track from top of file
LONG dwSyncTrackOffset;
} _RES_FILE_HEADER;
// structure for resource block header
typedef struct
{
// resource id
WORD wID;
// resource type
WORD wResType;
// offset of next block
LONG dwNextBlock;
// size of the current resource information
LONG dwResSize;
// rate to play block at
WORD wBlockRate;
// id for the sync track to use
WORD wSyncTrackID;
} _RES_BLOCK_HEADER;
// structure for sync mark tag
typedef struct _tagSYNCMARK
{
// ID of the type of mark being used
WORD wID;
// location in data of sync mark
LONG dwSyncOffset;
// length of sync block
LONG dwSyncSize;
// start sample data
_SOS_START_SAMPLE sampleData;
} _RES_SYNCMARK;
typedef union
{
// structure for sync mark tag
_RES_SYNCMARK syncMark;
} _RES_TAG;
// union for filter information for prepareWave
typedef union
{
// filter type
WORD wFilterID;
// structure for volume
struct volume
{
WORD wVolume;
};
// structure for delay
struct delay
{
WORD wDelaySamples;
};
} _SOS_FILTER;
#endif


54
WWFLAT32/INCLUDE/SOUND.H Normal file
View File

@@ -0,0 +1,54 @@
/*
** 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 : Westwood Library *
* *
* File Name : SOUND.H *
* *
* Programmer : Joe L. Bostic *
* *
* Start Date : September 1, 1993 *
* *
* Last Update : September 1, 1993 [JLB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef SOUND_H
#define SOUND_H
#define HMI_DRIVER TRUE
#include "sos.h"
#include "soscomp.h"
/*
** Maximum number of sound effects that may run at once.
*/
#define MAX_SFX 4
/*
** Size of temp HMI low memory staging buffer.
*/
#define SFX_MINI_STAGE_BUFFER_SIZE (1024*4)
#endif

253
WWFLAT32/INCLUDE/SOUNDINT.H Normal file
View File

@@ -0,0 +1,253 @@
/*
** 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 : Westwood 32 bit Library *
* *
* File Name : SOUNDINT.H *
* *
* Programmer : Phil W. Gorrow *
* *
* Start Date : June 23, 1995 *
* *
* Last Update : June 23, 1995 [PWG] *
* *
* This file is the include file for the Westwood Sound Sytem defines and *
* routines that are handled in an interrupt.
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include "sound.h"
/*
** Defines for true and false. These are included because we do not allow
** the sound int to include any of the westwood standard headers. If we
** did, there might be too much temptation to call another library function.
** this would be bad, because then that function would not be locked.
*/
#define FALSE 0
#define TRUE 1
/*
** Define the different type of sound compression avaliable to the westwood
** library.
*/
typedef enum {
SCOMP_NONE=0, // No compression -- raw data.
SCOMP_WESTWOOD=1, // Special sliding window delta compression.
SCOMP_SONARC=33, // Sonarc frame compression.
SCOMP_SOS=99 // SOS frame compression.
} SCompressType;
/*
** This is the safety overrun margin for the sonarc compressed
** data frames. This value should be equal the maximum 'order' times
** the maximum number of bytes per sample. It should be evenly divisible
** by 16 to aid paragraph alignment.
*/
#define SONARC_MARGIN 32
/*
** Define the sample control structure which helps us to handle feeding
** data to the sound interrupt.
*/
#pragma pack(1);
typedef struct {
/*
** This flags whether this sample structure is active or not.
*/
unsigned Active:1;
/*
** This flags whether the sample is loading or has been started.
*/
unsigned Loading:1;
/*
** This semaphore ensures that simultaneous update of this structure won't
** occur. This is necessary since both interrupt and regular code can modify
** this structure.
*/
unsigned DontTouch:1;
/*
** If this sample is really to be considered a score rather than
** a sound effect, then special rules apply. These largely fall into
** the area of volume control.
*/
unsigned IsScore:1;
/*
** This is the original sample pointer. It is used to control the sample based on
** pointer rather than handle. The handle method is necessary when more than one
** sample could be playing simultaneously. The pointer method is necessary when
** the dealing with a sample that may have stopped behind the programmer's back and
** this occurance is not otherwise determinable. It is also used in
** conjunction with original size to unlock a sample which has been DPMI
** locked.
*/
void const *Original;
long OriginalSize;
/*
** These are pointers to the double buffers in low ram.
*/
VOID *Buffer[2];
/*
** The number of bytes in the buffer that has been filled but is not
** yet playing. This value is normally the size of the buffer,
** except for the case of the last bit of the sample.
*/
LONG DataLength;
/*
** This is the buffer index for the low buffer that
** has been filled with data but not yet being
** played.
*/
WORD Index;
/*
** Pointer to the sound data that has not yet been copied
** to the playback buffers.
*/
VOID *Source;
/*
** This is the number of bytes remaining in the source data as
** pointed to by the "Source" element.
*/
LONG Remainder;
/*
** Samples maintain a priority which is used to determine
** which sounds live or die when the maximum number of
** sounds are being played.
*/
WORD Priority;
/*
** This is the handle as returned by sosDIGIStartSample function.
*/
WORD Handle;
/*
** This is the current volume of the sample as it is being played.
*/
WORD Volume;
WORD Reducer; // Amount to reduce volume per tick.
/*
** This flags whether the sample is in stereo.
*/
WORD Stereo;
/*
** This is the compression that the sound data is using.
*/
SCompressType Compression;
WORD TrailerLen; // Number of trailer bytes in buffer.
BYTE Trailer[SONARC_MARGIN]; // Maximum number of 'order' samples needed.
DWORD Pitch;
WORD Flags;
/*
** This flag indicates whether this sample needs servicing.
** Servicing entails filling one of the empty low buffers.
*/
WORD Service;
/*
** This flag is TRUE when the sample has stopped playing,
** BUT there is more data available. The sample must be
** restarted upon filling the low buffer.
*/
BOOL Restart;
/*
** Streaming control handlers.
*/
BOOL (*Callback)(WORD id, WORD *odd, VOID **buffer, LONG *size);
VOID *QueueBuffer; // Pointer to continued sample data.
LONG QueueSize; // Size of queue buffer attached.
WORD Odd; // Block number tracker (0..StreamBufferCount-1).
int FilePending; // Number of buffers already filled ahead.
long FilePendingSize; // Number of bytes in last filled buffer.
/*
** The file variables are used when streaming directly off of the
** hard drive.
*/
WORD FileHandle; // Streaming file handle (ERROR = not in use).
VOID *FileBuffer; // Temporary streaming buffer (allowed to be freed).
/*
** The following structure is used if the sample if compressed using
** the sos 16 bit compression Codec.
*/
_SOS_COMPRESS_INFO sosinfo;
} SampleTrackerType;
typedef struct LockedData {
unsigned int DigiHandle; // = -1;
BOOL ServiceSomething; // = FALSE;
long MagicNumber; // = 0xDEAF;
VOID *UncompBuffer; // = NULL;
long StreamBufferSize; // = (2*SFX_MINI_STAGE_BUFFER_SIZE)+128;
short StreamBufferCount; // = 32;
SampleTrackerType SampleTracker[MAX_SFX];
unsigned int SoundVolume;
unsigned int ScoreVolume;
BOOL _int;
int MaxSamples;
int Rate;
} LockedDataType;
extern LockedDataType LockedData;
#pragma pack(4);
void Init_Locked_Data(void);
void Unlock_Locked_Data(void);
long Simple_Copy(void ** source, long * ssize, void ** alternate, long * altsize, void **dest, long size);
long Sample_Copy(SampleTrackerType *st, void ** source, long * ssize, void ** alternate, long * altsize, void * dest, long size, SCompressType scomp, void * trailer, WORD *trailersize);
VOID far cdecl maintenance_callback(VOID);
VOID cdecl far DigiCallback(unsigned int driverhandle, unsigned int callsource, unsigned int sampleid);
void far HMI_TimerCallback(void);
void *Audio_Add_Long_To_Pointer(void const *ptr, long size);
void DPMI_Unlock(VOID const *ptr, long const size);
extern "C" {
void Audio_Mem_Set(void const *ptr, unsigned char value, long size);
void Mem_Copy(void const *source, void *dest, unsigned long bytes_to_copy);
long Decompress_Frame(void * source, void * dest, long size);
int Decompress_Frame_Lock(void);
int Decompress_Frame_Unlock(void);
int sosCODEC_Lock(void);
int sosCODEC_Unlock(void);
void __GETDS(void);
}

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/>.
;
; This is the control structure at the start of a loaded icon set. It must match
; the structure in ICONSET.C!
STRUC IControl_Type
Width DW ? ; Width in pixels (per icon).
Height DW ? ; Height in pixels (per icon).
Count DW ? ; Number of icons in this set.
Allocated DW ? ; Was this iconset allocated?
MapWidth DW ? ; Width of icon map (in icons).
MapHeight DW ? ; Height of icon map (in icons).
Size DD ? ; Size of entire iconset memory block.
Icons DD ? ; Offset from buffer start to icon data.
Palettes DD ? ; Offset from buffer start to palette data.
Remaps DD ? ; Offset from buffer start to remap index data.
TransFlag DD ? ; Offset for transparency flag data.
ColorMap DD ? ; Color control map offset.
Map DD ? ; Icon map offset.
ENDS
ICON256 EQU 1

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 : Westwood 32 bit Library *
;* *
;* File Name : SVGAPRIM.INC *
;* *
;* Programmer : Phil W. Gorrow *
;* *
;* Start Date : December 8, 1994 *
;* *
;* Last Update : December 8, 1994 [PWG] *
;* *
;*-------------------------------------------------------------------------*
; Externs from VIDEO.CPP module of the VIDEO library
GLOBAL BankTable :DWORD
GLOBAL VesaFunc :DWORD
GLOBAL XRes :DWORD
GLOBAL YRes :DWORD
GLOBAL CurrentMode :DWORD
global cpu_video_page :dword
global cpu_page_limit :dword
; Externs from VESA.ASM module of the SVGAPRIM library
GLOBAL Vesa_Asm_Set_Win :NEAR
GLOBAL Vesa_Asm_Next_Win :NEAR
; Externs from VGETPIX.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_Get_Pixel :NEAR
; Externs from VPUTTPIX.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_Put_Pixel :NEAR
; Externs from VCLEAR.ASM module of the MCGA/SVGAPRIM library
GLOBAL Vesa_Clear :NEAR
; Externs from VBITBLIT.ASM module of the MCGA/SVGAPRIM library
GLOBAL Linear_Blit_To_Vesa :NEAR
GLOBAL Vesa_Blit_To_Linear :NEAR
GLOBAL Vesa_Blit_To_Vesa :NEAR
; Externs from VTOBUFF.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_To_Buffer :NEAR
; Externs from VTOPAGE.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_Buffer_To_Page :NEAR
; Externs from VSCALE.ASM module of the SVGA/MCGAPRIM library
GLOBAL Linear_Scale_To_Vesa :NEAR
GLOBAL Vesa_Scale_To_Linear :NEAR
GLOBAL Vesa_Scale_To_Vesa :NEAR
; Externs from VSCALE.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_Print :NEAR

57
WWFLAT32/INCLUDE/TILE.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 A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Part of the TILE Library *
* *
* File Name : TILE.H *
* *
* Programmer : Barry W. Green *
* *
* Start Date : February 2, 1995 *
* *
* Last Update : February 2, 1995 [BWG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef TILE_H
#define TILE_H
/*=========================================================================*/
/* The following prototypes are for the file: ICONSET.CPP */
/*=========================================================================*/
void * Load_Icon_Set(char const *filename, void *iconsetptr, long buffsize);
void Free_Icon_Set(void const *iconset);
long Get_Icon_Set_Size(void const *iconset);
int Get_Icon_Set_Width(void const *iconset);
int Get_Icon_Set_Height(void const *iconset);
void * Get_Icon_Set_Icondata(void const *iconset);
void * Get_Icon_Set_Trans(void const *iconset);
void * Get_Icon_Set_Remapdata(void const *iconset);
void * Get_Icon_Set_Palettedata(void const *iconset);
int Get_Icon_Set_Count(void const *iconset);
void * Get_Icon_Set_Map(void const *iconset);
#endif //TILE_H

153
WWFLAT32/INCLUDE/TIMER.BAK Normal file
View File

@@ -0,0 +1,153 @@
/*
** 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 : Timer Class Functions *
* *
* File Name : TIMER.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : July 6, 1994 *
* *
* Last Update : July 12, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef TIMER_H
#define TIMER_H
/*=========================================================================*/
/* The following prototypes are for the file: TIMERA.ASM */
/*=========================================================================*/
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////// Externs /////////////////////////////////////////////
extern BOOL TimerSystemOn;
/*=========================================================================*/
typedef enum BaseTimerEnum {
BT_SYSTEM, // System timer (60 / second).
BT_USER // User controllable timer (? / second).
} BaseTimerEnum;
class TimerClass {
public:
// Constructor. Timers set before low level init has been done will not
// be able to be 'Started' or 'on' until timer system is in place.
TimerClass(BaseTimerEnum timer=BT_SYSTEM, BOOL start=FALSE);
// No destructor.
~TimerClass(void){}
//
long Set(long value, BOOL start=TRUE); // Set initial timer value.
long Stop(void); // Pause timer.
long Start(void); // Resume timer.
long Reset(BOOL start=TRUE); // Reset timer to zero.
long Time(void); // Fetch current timer value.
protected:
long Started; // Time last started (0 == not paused).
long Accumulated; // Total accumulated ticks.
private:
long (*Get_Ticks)(void); // System timer fetch.
};
inline long TimerClass::Reset(BOOL start)
{
return(Set(0, start));
}
class CountDownTimerClass : private TimerClass {
public:
// Constructor. Timers set before low level init has been done will not
// be able to be 'Started' or 'on' until timer system is in place.
CountDownTimerClass(BaseTimerEnum timer, long set, int on=FALSE);
CountDownTimerClass(BaseTimerEnum timer=BT_SYSTEM, int on=FALSE);
// No destructor.
~CountDownTimerClass(void){}
// Public functions
long Set(long set, BOOL start=TRUE); // Set count down value.
long Reset(BOOL start=TRUE); // Reset timer to zero.
long Stop(void); // Pause timer.
long Start(void); // Resume timer.
long Time(void); // Fetch current count down value.
protected:
long DelayTime; // Ticks remaining before countdown timer expires.
};
inline long CountDownTimerClass::Stop(void)
{
TimerClass::Stop();
return(Time());
}
inline long CountDownTimerClass::Start(void)
{
TimerClass::Start();
return(Time());
}
inline long CountDownTimerClass::Reset(BOOL start)
{
return (TimerClass::Reset(start));
}
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////// externs //////////////////////////////////////////
//extern TimerClass TickCount;
extern CountDownTimerClass CountDown;
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////// Prototypes //////////////////////////////////////////
extern "C" {
long Get_System_Tick_Count(void);
long Get_User_Tick_Count(void);
void far Timer_Interrupt_Func(void);
// long Get_Num_Interrupts(unsigned int realmode);
void Disable_Timer_Interrupt(void);
void Enable_Timer_Interrupt(void);
}
/*=========================================================================*/
/* The following prototypes are for the file: TIMER.CPP */
/*=========================================================================*/
BOOL Init_Timer_System(unsigned int freq, int partial = FALSE);
BOOL Remove_Timer_System(VOID);
#endif // TIMER_H


154
WWFLAT32/INCLUDE/TIMER.H Normal file
View File

@@ -0,0 +1,154 @@
/*
** 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 : Timer Class Functions *
* *
* File Name : TIMER.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : July 6, 1994 *
* *
* Last Update : July 12, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef TIMER_H
#define TIMER_H
/*=========================================================================*/
/* The following prototypes are for the file: TIMERA.ASM */
/*=========================================================================*/
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////// Externs /////////////////////////////////////////////
extern BOOL TimerSystemOn;
/*=========================================================================*/
typedef enum BaseTimerEnum {
BT_SYSTEM, // System timer (60 / second).
BT_USER // User controllable timer (? / second).
} BaseTimerEnum;
class TimerClass {
public:
// Constructor. Timers set before low level init has been done will not
// be able to be 'Started' or 'on' until timer system is in place.
TimerClass(BaseTimerEnum timer=BT_SYSTEM, BOOL start=FALSE);
// No destructor.
~TimerClass(void){}
//
long Set(long value, BOOL start=TRUE); // Set initial timer value.
long Stop(void); // Pause timer.
long Start(void); // Resume timer.
long Reset(BOOL start=TRUE); // Reset timer to zero.
long Time(void); // Fetch current timer value.
protected:
long Started; // Time last started (0 == not paused).
long Accumulated; // Total accumulated ticks.
private:
long (*Get_Ticks)(void); // System timer fetch.
};
inline long TimerClass::Reset(BOOL start)
{
return(Set(0, start));
}
//lint -esym(1509,TimerClass)
class CountDownTimerClass : private TimerClass {
public:
// Constructor. Timers set before low level init has been done will not
// be able to be 'Started' or 'on' until timer system is in place.
CountDownTimerClass(BaseTimerEnum timer, long set, int on=FALSE);
CountDownTimerClass(BaseTimerEnum timer=BT_SYSTEM, int on=FALSE);
// No destructor.
~CountDownTimerClass(void){}
// Public functions
long Set(long set, BOOL start=TRUE); // Set count down value.
long Reset(BOOL start=TRUE); // Reset timer to zero.
long Stop(void); // Pause timer.
long Start(void); // Resume timer.
long Time(void); // Fetch current count down value.
protected:
long DelayTime; // Ticks remaining before countdown timer expires.
};
inline long CountDownTimerClass::Stop(void)
{
TimerClass::Stop();
return(Time());
}
inline long CountDownTimerClass::Start(void)
{
TimerClass::Start();
return(Time());
}
inline long CountDownTimerClass::Reset(BOOL start)
{
return (TimerClass::Reset(start));
}
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////// externs //////////////////////////////////////////
//extern TimerClass TickCount;
extern CountDownTimerClass CountDown;
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////// Prototypes //////////////////////////////////////////
extern "C" {
long Get_System_Tick_Count(void);
long Get_User_Tick_Count(void);
void far Timer_Interrupt_Func(void);
// long Get_Num_Interrupts(unsigned int realmode);
void Disable_Timer_Interrupt(void);
void Enable_Timer_Interrupt(void);
}
/*=========================================================================*/
/* The following prototypes are for the file: TIMER.CPP */
/*=========================================================================*/
BOOL Init_Timer_System(unsigned int freq, int partial = FALSE);
BOOL Remove_Timer_System(VOID);
#endif // TIMER_H


1034
WWFLAT32/INCLUDE/VBUFFER.H Normal file

File diff suppressed because it is too large Load Diff

213
WWFLAT32/INCLUDE/VIDEO.H Normal file
View File

@@ -0,0 +1,213 @@
/*
** 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 : 32 bit library *
* *
* File Name : VIDEO.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : August 3, 1994 *
* *
* Last Update : August 3, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef VIDEO_H
#define VIDEO_H
#ifndef WWSTD_H
#include "wwstd.h"
#endif
/*=========================================================================*/
/* The machine can be in one of the following graphic modes. The global */
/* GraphicMode is set to one of these values. */
/*=========================================================================*/
#define CGA_MODE 4 // DOS 320x200 4 color mode
#define TGA_MODE 9 // TANDY 320x200 16 color mode
#define EGA_MODE 13 // DOS 320x200 16 color mode
#define MCGA_MODE 0x13 // DOS 320x200 256 color mode
#define VGA_MODE 0x13 // DOS 320x200 256 color mode
#define EEGA_MODE 14 // DOS 640x400 16 color mode
#define ETGA_MODE 9 // TANDY 640x400 16 color mode
#define HGA_MODE 7 // DOS 768x400 2 color mode
#define TXT_MODE 3 // DOS plain old color text mode
#define VESA_640X400_256 0x100 // VESA 640x400 256 color mode
#define VESA_640X480_256 0x101 // VESA 640x480 256 color mode
#define VESA_800X600_256 0x103 // VESA 800x600 256 color mode
#define VESA_1024X768_256 0x105 // VESA 1024x768 256 color mode
#define VESA_1280X400_256 0x107 // VESA 1280x400 256 color mode
#define VESA_TEXT_80X60 0x108 // VESA 80x60 text mode
#define VESA_TEXT_132X25 0x109 // VESA 132x25 text mode
#define VESA_TEXT_132X60 0x10C // VESA 132x60 text mode
#define RESET_MODE -1
#define UNINITIALIZED_MODE -1
#define VESA_MIN VESA_640X400_256
#define VESA_MAX VESA_TEXT_132X60
/*=========================================================================*/
/* Define the maximum number of bank entries */
/*=========================================================================*/
#define MAX_BANK_ENTRIES ((1280L*1024L)/65536L)
/*=========================================================================*
* VesaInfoType - General info about this VESA implementation *
* (Filled in by VESA BIOS Function 0) *
* *
* Signature - Will always be 'VESA' *
* Version - Version # *
* OEMString - OEM ID string *
* Capabilities - Not defined by VESA yet *
* AvailModes - List of available modes; terminated with -1 (0xffff) *
* TotalMemory - ??? *
* Reserved - Pads structure to 256 bytes total *
*=========================================================================*/
typedef struct {
char Signature[4];
short Version;
REALPTR OEMString;
long Capabilities;
REALPTR AvailModes;
short TotalMemory;
char Reserved[236];
} VesaInfoType;
/*=========================================================================*
* VesaModeInfoType - Info about this VESA mode *
* (Filled in by VESA BIOS Function 1) *
* *
* Attributes - bit 0: 1 = mode is supported *
* bit 1: 1 = optional info available *
* bit 2: 1 = std BIOS output funcs valid in this mode *
* bit 3: 0 = monochrome, 1 = color *
* bit 4: 0 = text mode, 1 = graphics *
* WinA_Attributes - bit 0 = win exists, bit 1=readable, bit 2= writable *
* WinB_Attributes - bit 0 = win exists, bit 1=readable, bit 2= writable *
* WinGranularity - smallest address boundary window can be placed upon; *
* size is in KB (ie 64, 32, 4) *
* WinSize - size of windows in KB (ie 64, 32) *
* WinA_Segment - location of Window A in CPU space (usually 0xa000) *
* WinB_Segment - location of Window B in CPU space (usually 0xb000) *
* WinFunc - address of window-setting function (This is provided *
* as an alternative to Int 10 for speed.) *
* BytesPerScanline - # bytes per scan line *
* *
* Optional info (available if bit 1 of Attributes is set): *
* *
* XRes - X-resolution *
* YRes - Y-resolution *
* XCharSize - Horizontal size of char cell *
* YCharSize - Vertical size of char cell *
* NumPlanes - # of memory planes (???) *
* BitsPerPixel - # bites per pixel *
* NumBanks - # of banks (ie planes) *
* MemoryModel - 00h = Text mode *
* 01h = CGA mode *
* 02h = Hercules *
* 03h = 4 plane planar mode *
* 04h = packed pixel mode (1 byte/pixel) *
* 05h = non-chain 4, 256-color mode *
* 06-0Fh = *
* 10-FFh = OEM-specific *
* BankSize - Bank size in KB *
*=========================================================================*/
typedef struct {
short Attributes;
char WinA_Attributes;
char WinB_Attributes;
short WinGranularity;
short WinSize;
short WinA_Segment;
short WinB_Segment;
REALPTR WinFunc;
short BytesPerScanline;
short XRes;
short YRes;
char XCharSize;
char YCharSize;
char NumPlanes;
char BitsPerPixel;
char NumBanks;
char MemoryModel;
char BankSize;
char NumInputPages;
char Reserved;
char RedMaskSize;
char RedFieldPosition;
char GreenMaskSize;
char GreenFieldPosition;
char BlueMaskSize;
char BlueFieldPosition;
char RsvdMaskSize;
char RsvdFieldPosition;
char DirectColorModeInfo;
char pad[216];
} VesaModeInfoType;
extern "C" {
extern int GraphicMode;
extern long XRes;
extern long YRes;
extern long BankTable [];
extern REALPTR VesaFunc;
extern unsigned long RMVesaVector ;
extern unsigned long RMVesaRegs ;
}
/*=========================================================================*/
/* The following prototypes are for the file: VIDEO.CPP */
/*=========================================================================*/
extern "C" int Set_Video_Mode(int mode);
int Get_Video_Mode(void);
void Update_Video_Mode (void) ;
void Vesa_Info(void);
void Vesa_Set_Window(long grain_num);
int Get_Original_Video_Mode(void);
void Set_Original_Video_Mode(int mode);
/*=========================================================================*/
/* The following prototypes are for the file: INITDLAY.CPP */
/*=========================================================================*/
extern VOID Init_Delay(VOID);
extern BOOL VertBlank;
/*=========================================================================*/
/* The following prototypes are for the file: VERTBLNK.ASM */
/*=========================================================================*/
extern "C" {
extern WORD Get_Vert_Blank(VOID);
extern VOID Wait_Vert_Blank(BOOL blank);
}
/*=========================================================================*/
#endif // VIDEO_H

96
WWFLAT32/INCLUDE/WINDOW.H Normal file
View File

@@ -0,0 +1,96 @@
/*
** 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 A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Part of the WINDOWS Library *
* *
* File Name : WINDOWS.H *
* *
* Programmer : Barry W. Green *
* *
* Start Date : February 16, 1995 *
* *
* Last Update : February 16, 1995 [BWG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef WINDOWSs_H
#define WINDOWSs_H
/*=========================================================================*/
/* The following prototypes are for the file: WINHIDE.CPP */
/*=========================================================================*/
void Window_Hide_Mouse(int window);
void Window_Show_Mouse(void);
/*=========================================================================*/
/* The following prototypes are for the file: WINDOWS.CPP */
/*=========================================================================*/
void Standard_More_Prompt(char const *prompt, int space, int fcolor, int bcolor);
void Set_More_Prompt(char const *prompt, int space, int fcolor, int bcolor);
void Set_More_On(void);
void Set_More_Off(void);
int Change_Window(int windnum);
int Change_New_Window(int windnum);
void New_Window(void);
void Window_Int_Print(int num);
void Window_Print(char const string[], ...);
/*
** The WindowList[][8] array contains the following elements. Use these
** defines when accessing the WindowList.
*/
typedef enum {
WINDOWX, // X byte position of left edge.
WINDOWY, // Y pixel position of top edge.
WINDOWWIDTH, // Width in bytes of the window.
WINDOWHEIGHT, // Height in pixels of the window.
WINDOWFCOL, // Default foreground color.
WINDOWBCOL, // Default background color.
WINDOWCURSORX, // Current cursor X position (in rows).
WINDOWCURSORY, // Current cursor Y position (in lines).
WINDOWPADDING=0x1000
} WindowIndexType;
extern int WindowList[][8];
extern int WindowColumns;
extern int WindowLines;
extern int WindowWidth;
extern unsigned int WinB;
extern unsigned int WinC;
extern unsigned int WinX;
extern unsigned int WinY;
extern unsigned int WinCx;
extern unsigned int WinCy;
extern unsigned int WinH;
extern unsigned int WinW;
extern unsigned int Window;
extern int MoreOn;
extern char *TXT_MoreText;
extern void (*Window_More_Ptr)(char const *, int, int, int);
#endif //WINDOWS_H


166
WWFLAT32/INCLUDE/WSA.H Normal file
View File

@@ -0,0 +1,166 @@
/*
** 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 A S S O C I A T E S **
***************************************************************************
* *
* Project Name : WSA 32bit LIbrary *
* *
* File Name : WSA.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : May 23, 1994 *
* *
* Last Update : May 25, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* Open_Animation -- file name and flags, system allocates buffer. *
* Open_Animation -- file name, flags, palette, system allocates buffer. *
* Open_Animation -- file_name, graphic buffer, flags. *
* Open_Animation -- file name, bufferclass, flags, palette. *
* Open_Animation -- filename, ptr, size, flags, no palette. *
* Animate_Frame -- Animate a frame to a page with magic colors. *
* Animate_Frame -- Animate a frame to a viewport with magic colors. *
* Animate_Frame -- Animate a frame to a page. *
* Animate_Frame -- Animate a frame to a viewport. *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef WSA_H
#define WSA_H
#ifndef WWSTD_H
#include "wwstd.h"
#endif
#ifndef GBUFFER_H
#include "gbuffer.h"
#endif
#ifndef VBUFFER_H
#include "vbuffer.h"
#endif
//lint -strong(AJX,WSAType)
typedef enum {
WSA_NORMAL, // Normal WSA animation
WSA_GHOST = 0x1000, // Or'd with the above flags to get ghosting
WSA_PRIORITY2 = 0x2000, // Copy using a priority (or in the priority)
WSA_TRANS = 0x4000, // Copy frame, ignoring transparent colors
WSA_PRIORITY = 0x8000 // Copy using a priority (or in the priority)
} WSAType;
//lint -strong(AJX,WSAOpenType)
typedef enum {
WSA_OPEN_FROM_MEM = 0x0000, // Try to load entire anim into memory.
WSA_OPEN_INDIRECT = 0x0000, // First animate to internal buffer, then copy to page/viewport.
WSA_OPEN_FROM_DISK = 0x0001, // Force the animation to be disk based.
WSA_OPEN_DIRECT = 0x0002, // Animate directly to page or viewport.
// These next two have been added for the 32 bit library to give a better idea of what is
// happening. You may want to animate directly to the destination or indirectly to the
// destination by using the animations buffer. Indirecly is best if the dest is a seenpage
// and the animation is not linear or if the destination is modified between frames.
WSA_OPEN_TO_PAGE = WSA_OPEN_DIRECT ,
WSA_OPEN_TO_BUFFER= WSA_OPEN_INDIRECT ,
} WSAOpenType;
/*=========================================================================*/
/* The following prototypes are for the file: WSA.CPP */
/*=========================================================================*/
VOID * cdecl Open_Animation(BYTE const *file_name, BYTE *user_buffer, LONG user_buffer_size, WSAOpenType user_flags, UBYTE *palette=NULL);
VOID cdecl Close_Animation( VOID *handle );
BOOL cdecl Animate_Frame(VOID *handle, GraphicViewPortClass& view,
WORD frame_number, WORD x_pixel=0, WORD y_pixel=0,
WSAType flags_and_prio = WSA_NORMAL, VOID *magic_cols=NULL, VOID *magic=NULL);
WORD cdecl Get_Animation_Frame_Count(VOID *handle);
BOOL cdecl Animate_Frame(VOID *handle, VideoViewPortClass& view,
WORD frame_number, WORD x_pixel=0, WORD y_pixel=0,
WSAType flags_and_prio = WSA_NORMAL, VOID *magic_cols=NULL, VOID *magic=NULL);
WORD cdecl Get_Animation_Frame_Count(VOID *handle);
WORD cdecl Get_Animation_X(VOID const *handle);
WORD cdecl Get_Animation_Y(VOID const *handle);
WORD cdecl Get_Animation_Width(VOID const *handle);
WORD cdecl Get_Animation_Height(VOID const *handle);
WORD cdecl Get_Animation_Palette(VOID const *handle);
ULONG cdecl Get_Animation_Size(VOID const *handle);
/***************************************************************************
* OPEN_ANIMATION -- file name, flags, palette, system allocates buffer. *
* *
* *
* INPUT: BYTE *file_name - name of file to open. *
* WSAOpenType user_flags - flags on how to open. *
* UBYTE *palette - pointer to a palette buffer to fill. *
* *
* OUTPUT: VOID *pointer to animation data. Must be used for all *
* other WSA calls. *
* *
* WARNINGS: *
* *
* HISTORY: *
* 05/24/1994 SKB : Created. *
*=========================================================================*/
inline VOID *cdecl Open_Animation(BYTE *file_name, WSAOpenType user_flags, UBYTE *palette=NULL)
{
return (Open_Animation(file_name, NULL, 0L, user_flags, palette));
}
/***************************************************************************
* OPEN_ANIMATION -- file_name, bufferclass, flags. *
* *
* *
* INPUT: BYTE *file_name - name of file to open. *
* GraphicBufferClass - pointer to a buffer. *
* WSAOpenType user_flags - flags on how to open. *
* UBYTE *palette - pointer to a palette buffer to fill. *
* *
* OUTPUT: VOID *pointer to animation data. Must be used for all *
* other WSA calls. *
* *
* WARNINGS: *
* *
* HISTORY: *
* 05/24/1994 SKB : Created. *
*=========================================================================*/
inline VOID *cdecl Open_Animation(BYTE *file_name, BufferClass& buffer, WSAOpenType user_flags, UBYTE *palette=NULL)
{
return (Open_Animation(file_name, (BYTE *)buffer.Get_Buffer(), buffer.Get_Size(), user_flags, palette));
}
/*=========================================================================*/
/* The following prototypes are for the file: LP_ASM.ASM */
/*=========================================================================*/
extern "C" {
UWORD Apply_XOR_Delta(BYTE *source_ptr, BYTE *delta_ptr);
VOID Apply_XOR_Delta_To_Page_Or_Viewport(VOID *target, VOID *delta, WORD width, WORD nextrow, WORD copy);
}
#endif // WSA_H

View File

@@ -0,0 +1,68 @@
/*
** 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 : WWLIB32 User include file *
* *
* File Name : WWLIB32.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : August 3, 1994 *
* *
* Last Update : August 3, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef WWLIB32_H
#define WWLIB32_H
#include <wwstd.h>
#include <audio.h>
#include <buffer.h>
#include <descmgmt.h>
#include <dipthong.h>
#include <file.h>
#include <font.h>
#include <gbuffer.h>
#include <iff.h>
#include <keyboard.h>
#include <mcgaprim.h>
#include <misc.h>
#include <mono.h>
#include <palette.h>
#include <playcd.h>
#include <shape.h>
#include <tile.h>
#include <timer.h>
#include <video.h>
#include <vbuffer.h>
#include <window.h>
#include <wsa.h>
#include <wwmem.h>
#endif // WWLIB32_H


69
WWFLAT32/INCLUDE/WWMEM.H Normal file
View File

@@ -0,0 +1,69 @@
/*
** 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 : Memory System *
* *
* File Name : MEM.H *
* *
* Programmer : Jeff Wilson *
* *
* Start Date : April 4, 1994 *
* *
* Last Update : September 8, 1994 [IML] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef WWMEM_H
#define WWMEM_H
#include "wwstd.h"
#include "new.h"
#include "memflag.h"
// Defines
//==============
/*=========================================================================*/
/* The following prototypes are for the file: MEM.CPP */
/*=========================================================================*/
int Mem_Init(void *buffer, long size);
void *Mem_Alloc(void *poolptr, long lsize, unsigned long id);
int Mem_Free(void *poolptr, void *buffer);
void Mem_Reference(void *node);
void Mem_Lock_Block(void *node);
void Mem_In_Use(void *node);
void *Mem_Find(void *poolptr, unsigned long id);
unsigned long Mem_Get_ID(void *node);
void *Mem_Find_Oldest(void *poolptr);
void *Mem_Free_Oldest(void *poolptr);
long Mem_Pool_Size(void *poolptr);
long Mem_Avail(void *poolptr);
long Mem_Largest_Avail(void *poolptr);
void Mem_Cleanup(void *poolptr);
#endif


View File

@@ -0,0 +1,43 @@
;
; 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 A S S O C I A T E S **
;***************************************************************************
;* *
;* Project Name : Memory System *
;* *
;* File Name : WWMEM.INC *
;* *
;* Programmer : Ian M. Leslie *
;* *
;* Start Date : August 11, 1994 *
;* *
;* Last Update : August 17, 1994 [IML] *
;* *
;*-------------------------------------------------------------------------*
;* Functions: *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
MEM_NORMAL EQU 0000h ; Default memory (normal).
MEM_NEW EQU 0001h ; Called by the operator new and was overloaded.
MEM_CLEAR EQU 0002h ;
GLOBAL @Alloc$qul14MemoryFlagType:PROC
GLOBAL @Free$qpv:PROC

308
WWFLAT32/INCLUDE/WWSTD.H Normal file
View File

@@ -0,0 +1,308 @@
/*
** 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 : wwstd.h *
* *
* File Name : WWLIB.H *
* *
* Programmer : Jeff Wilson *
* *
* Start Date : March 1, 1994 *
* *
* Last Update : March 1, 1994 [] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef WWSTD_H
#define WWSTD_H
// Note: SKB 4/11/94
// Before this library is done, this needs to be able to be set to TRUE.
// Once it is, the FALSE parts should be removed from the source code.
#define LIB_EXTERNS_RESOLVED FALSE
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <bios.h>
//================================
// TRUE and FALSE are defined in pltypes.h
#ifndef IBM
#define IBM TRUE
#endif
#ifndef AMIGA
#define AMIGA FALSE
#endif
#ifndef SEGA
#define SEGA FALSE
#endif
/*
** Common constants used in normal code.
*/
#define WWERROR -1
#ifdef NULL
#undef NULL
#endif
#ifndef NULL
#define NULL 0L
#endif
#ifdef VOID
#undef VOID
#endif
#define PRIVATE static
#define PUBLIC /* Routines & data don't have a specifier */
#ifdef __cplusplus
#define __CPPARGS ...
#else
#define __CPPARGS
#endif
// This macro will get the size (in elements) of the specified array.
#ifdef GET_SIZE
#undef GET_SIZE
#endif
#define GET_SIZE(a) ((sizeof(a) / sizeof(*a)))
// Returns the absolute value of the number.
#ifdef ABS
#undef ABS
#endif
template<class T> T ABS(T a)
{
return (a < 0) ? -a : a;
}
inline int ABS(int);
inline long ABS(long);
// Returns the minimum of the two numbers.
#ifdef MIN
#undef MIN
#endif
template<class T> T MIN(T a, T b)
{
return (b < a) ? b : a;
};
inline short MIN(short, short);
inline int MIN(int, int);
inline long MIN(long, long);
// Returns the maximum of the two numbers.
#ifdef MAX
#undef MAX
#endif
template<class T> T MAX(T a, T b)
{
return (b > a) ? b : a;
};
inline short MAX(short, short);
inline int MAX(int, int);
inline long MAX(long, long);
// Returns the low word of a long
#define LOW_WORD(a) ((unsigned short)((long)(a) & 0x0000FFFFL))
// Returns the high word of a long
#define HIGH_WORD(a) ((unsigned long)(a) >> 16)
// Merges to shorts to become a long
#define MAKE_LONG(a,b) (((long)(a) << 16) | (long)((b)&0x0000FFFFL))
/*
** Macro allows our routines to act like
** sprintf etc..
*/
#ifdef AssembleTo
#undef AssembleTo
#endif
#define AssembleTo(dest,fmt)\
{\
va_list argptr;\
if (fmt != (dest))\
{\
va_start (argptr, fmt);\
vsprintf ((dest), fmt, argptr);\
va_end (argptr);\
}\
}
// type definitions
//=======================================
typedef void VOID;
//==================================================
// Pharlape defines these for use so we use their
// typedefs!
// typedef unsigned char BOOL;
// typedef signed long LONG;
// typedef unsigned long ULONG;
//==================================================
#ifndef PRIVATE
#define PRIVATE static
#endif
// The purpose of the INT and UINT is for efficiency. It says that while a short int (16 bit)
// has enough precision, it is more efficient to pass in an int (32 bits). For efficiency, most
// WORD and UWORD should be an INT or UINT, especially on the stack and structures that will
// not be in large arrays. When size efficiency is more important then speed, use WORD UWORD.
#define VOID void
#pragma warn -eas
#define TRUE 1
#define FALSE 0
#define BOOL int // 32 bits for speed. use CHAR for size optimizations.
#ifndef HMI_DRIVER
#define INT int
#define UINT unsigned int
#define BYTE char
#define UBYTE unsigned char
#define UCHAR unsigned char
#define WORD signed short
#define UWORD unsigned short
#define USHORT unsigned short
#define LONG signed long
#define ULONG unsigned long
#define REALPTR unsigned long
#define FARPTR char far *
#endif
/*
** The type of processor running on this system as
** returned by Processor().
*/
#define PROC_80386 0
#define PROC_80486 1
#define PROC_PENTIUM 2
// Inline Routines
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//
// These Template functions are generally used
// by classes when they havce over loaded > and <.
//
#ifdef __cplusplus
template<class T> T Min(T a, T b)
{
return (a<b ? a : b);
}
template<class T> inline T Max(T a, T b)
{
return (a>b ? a : b);
}
template<class T> T Abs(T a)
{
return ((a<0) ? -(a) : a);
}
template<class T> VOID minimize(T &a, T b)
{
if( b<a )
a=b;
}
template<class T> VOID maximize(T &a, T b)
{
if( b>a )
a=b;
}
#endif
/*
** Macros that control bit settings in a variable.
*/
#define Bit_Flags_On(a,b) (a |= (b))
#define Bit_Flags_Off(a,b) (a &= (~(b)))
#define Bit_Flags_Value(a,b) (a & (b))
#define Bit_Flags_Flip(a,b) (a ^= (b))
// Template replacements for the user defines above
#ifdef __cplusplus
template<class T> VOID BitFlagsOn(T &a, T b)
{
a |= (b);
}
template<class T> VOID BitFlagsOff(T &a, T b)
{
a &= (~(b));
}
template<class T> T BitFlagsValue(T a, T b)
{
return (a & (b));
}
template<class T> VOID BitFlagsFlip(T &a, T b)
{
a ^= (b);
}
#endif
typedef enum {
TBLACK,
PURPLE,
CYAN,
GREEN,
LTGREEN,
YELLOW,
PINK,
BROWN,
RED,
LTCYAN,
LTBLUE,
BLUE,
BLACK,
GREY,
LTGREY,
WHITE,
COLOR_PADDING=0x1000
} ColorType;
#endif

View File

@@ -0,0 +1,308 @@
/*
** 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 : wwstd.h *
* *
* File Name : WWLIB.H *
* *
* Programmer : Jeff Wilson *
* *
* Start Date : March 1, 1994 *
* *
* Last Update : March 1, 1994 [] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef WWSTD_H
#define WWSTD_H
// Note: SKB 4/11/94
// Before this library is done, this needs to be able to be set to TRUE.
// Once it is, the FALSE parts should be removed from the source code.
#define LIB_EXTERNS_RESOLVED FALSE
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <bios.h>
//================================
// TRUE and FALSE are defined in pltypes.h
#ifndef IBM
#define IBM TRUE
#endif
#ifndef AMIGA
#define AMIGA FALSE
#endif
#ifndef SEGA
#define SEGA FALSE
#endif
/*
** Common constants used in normal code.
*/
#define ERROR -1
#ifdef NULL
#undef NULL
#endif
#ifndef NULL
#define NULL 0L
#endif
#ifdef VOID
#undef VOID
#endif
#define PRIVATE static
#define PUBLIC /* Routines & data don't have a specifier */
#ifdef __cplusplus
#define __CPPARGS ...
#else
#define __CPPARGS
#endif
// This macro will get the size (in elements) of the specified array.
#ifdef GET_SIZE
#undef GET_SIZE
#endif
#define GET_SIZE(a) ((sizeof(a) / sizeof(*a)))
// Returns the absolute value of the number.
#ifdef ABS
#undef ABS
#endif
template<class T> T ABS(T a)
{
return (a < 0) ? -a : a;
}
inline int ABS(int);
inline long ABS(long);
// Returns the minimum of the two numbers.
#ifdef MIN
#undef MIN
#endif
template<class T> T MIN(T a, T b)
{
return (b < a) ? b : a;
};
inline short MIN(short, short);
inline int MIN(int, int);
inline long MIN(long, long);
// Returns the maximum of the two numbers.
#ifdef MAX
#undef MAX
#endif
template<class T> T MAX(T a, T b)
{
return (b > a) ? b : a;
};
inline short MAX(short, short);
inline int MAX(int, int);
inline long MAX(long, long);
// Returns the low word of a long
#define LOW_WORD(a) ((unsigned short)((long)(a) & 0x0000FFFFL))
// Returns the high word of a long
#define HIGH_WORD(a) ((unsigned long)(a) >> 16)
// Merges to shorts to become a long
#define MAKE_LONG(a,b) (((long)(a) << 16) | (long)((b)&0x0000FFFFL))
/*
** Macro allows our routines to act like
** sprintf etc..
*/
#ifdef AssembleTo
#undef AssembleTo
#endif
#define AssembleTo(dest,fmt)\
{\
va_list argptr;\
if (fmt != (dest))\
{\
va_start (argptr, fmt);\
vsprintf ((dest), fmt, argptr);\
va_end (argptr);\
}\
}
// type definitions
//=======================================
typedef void VOID;
//==================================================
// Pharlape defines these for use so we use their
// typedefs!
// typedef unsigned char BOOL;
// typedef signed long LONG;
// typedef unsigned long ULONG;
//==================================================
#ifndef PRIVATE
#define PRIVATE static
#endif
// The purpose of the INT and UINT is for efficiency. It says that while a short int (16 bit)
// has enough precision, it is more efficient to pass in an int (32 bits). For efficiency, most
// WORD and UWORD should be an INT or UINT, especially on the stack and structures that will
// not be in large arrays. When size efficiency is more important then speed, use WORD UWORD.
#define VOID void
#pragma warn -eas
#define TRUE 1
#define FALSE 0
#define BOOL int // 32 bits for speed. use CHAR for size optimizations.
#ifndef HMI_DRIVER
#define INT int
#define UINT unsigned int
#define BYTE char
#define UBYTE unsigned char
#define UCHAR unsigned char
#define WORD signed short
#define UWORD unsigned short
#define USHORT unsigned short
#define LONG signed long
#define ULONG unsigned long
#define REALPTR unsigned long
#define FARPTR char far *
#endif
/*
** The type of processor running on this system as
** returned by Processor().
*/
#define PROC_80386 0
#define PROC_80486 1
#define PROC_PENTIUM 2
// Inline Routines
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//
// These Template functions are generally used
// by classes when they havce over loaded > and <.
//
#ifdef __cplusplus
template<class T> T Min(T a, T b)
{
return (a<b ? a : b);
}
template<class T> inline T Max(T a, T b)
{
return (a>b ? a : b);
}
template<class T> T Abs(T a)
{
return ((a<0) ? -(a) : a);
}
template<class T> VOID minimize(T &a, T b)
{
if( b<a )
a=b;
}
template<class T> VOID maximize(T &a, T b)
{
if( b>a )
a=b;
}
#endif
/*
** Macros that control bit settings in a variable.
*/
#define Bit_Flags_On(a,b) (a) |= (b)
#define Bit_Flags_Off(a,b) a &= (~(b))
#define Bit_Flags_Value(a,b) (a & (b))
#define Bit_Flags_Flip(a,b) a ^= (b)
// Template replacements for the user defines above
#ifdef __cplusplus
template<class T> VOID BitFlagsOn(T &a, T b)
{
a |= (b);
}
template<class T> VOID BitFlagsOff(T &a, T b)
{
a &= (~(b));
}
template<class T> T BitFlagsValue(T a, T b)
{
return (a & (b));
}
template<class T> VOID BitFlagsFlip(T &a, T b)
{
a ^= (b);
}
#endif
typedef enum {
TBLACK,
PURPLE,
CYAN,
GREEN,
LTGREEN,
YELLOW,
PINK,
BROWN,
RED,
LTCYAN,
LTBLUE,
BLUE,
BLACK,
GREY,
LTGREY,
WHITE,
COLOR_PADDING=0x1000
} ColorType;
#endif

183
WWFLAT32/INCLUDE/_FILE.H Normal file
View File

@@ -0,0 +1,183 @@
/*
** 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 A S S O C I A T E S **
;***************************************************************************
;* *
;* Project Name : Library - Filio header stuff. *
;* *
;* File Name : FILE.H *
;* *
;* Programmer : Scott K. Bowen *
;* *
;* Start Date : September 13, 1993 *
;* *
;* Last Update : April 11, 1994 *
;* *
;*-------------------------------------------------------------------------*
;* Functions: *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef FILE_H
#include "file.h"
#endif
#ifndef _FILE_H
#define _FILE_H
/*=========================================================================*/
/* Fileio defines */
/*=========================================================================*/
#define LIB_CDROM TRUE
#define MODE_OLDFILE (O_RDONLY | O_BINARY)
#define MODE_NEWFILE (O_WRONLY | O_BINARY | O_CREAT | O_TRUNC)
#define MODE_READWRITE (O_RDWR | O_BINARY)
#define FILEOPENERROR -1
#define FILEOPEN(f,m) ibm_open(f, m, (((UWORD) m) == MODE_OLDFILE) ? S_IREAD : (S_IREAD | S_IWRITE))
#define FILECLOSE(fd) ibm_close(fd)
#define FILEREAD(f,b,n) ibm_read(f,b,(WORD)(n))
#define FILEWRITE(f,b,n) ibm_write(f,b,(WORD)(n))
#define FILESEEK(f,b,n) ibm_lseek(f, b, n)
#define FILEDELETE(f) ibm_unlink(f)
#define CHANGEDIR(p) ibm_chdir(p)
#define FILENAMESIZE 13
#define IO_CHUNK_SIZE 0xfff0UL
/*
** Maximum number of file handles
*/
#define TABLE_MAX 20
/*=========================================================================*/
/* The file handle table */
/*=========================================================================*/
typedef struct {
BOOL Empty; // Is this handle empty?
WORD Handle; // DOS file handle (0 = resident).
LONG Pos; // Current file position.
LONG Start; // Offset of file from pointer.
WORD Index; // FileData[] index.
WORD Mode; // Access mode (WW).
BYTE *Name; // File name pointer.
} FileHandleType;
/*=========================================================================*/
/* The following prototypes are for the file: FILEIO.CPP */
/*=========================================================================*/
WORD ibm_getdisk(VOID);
WORD ibm_setdisk(WORD drive);
WORD ibm_close(WORD handle);
WORD ibm_unlink(BYTE const *name);
LONG ibm_lseek(WORD handle, LONG offset, WORD where);
UWORD ibm_read(WORD handle, VOID *ptr, UWORD bytes);
UWORD ibm_write(WORD handle, VOID *ptr, UWORD bytes);
WORD ibm_open(BYTE const *name, UWORD mode, WORD attrib);
WORD ibm_chdir(BYTE const *path);
/*=========================================================================*/
/* The following prototypes are for the file: FILELIB.CPP */
/*=========================================================================*/
WORD cdecl Do_Open_Error(FileErrorType errormsgnum, BYTE const *file_name);
VOID cdecl Do_IO_Error(FileErrorType errormsgnum, BYTE const *filename);
LONG cdecl Read_File_With_Recovery( WORD handle, VOID *buf, UWORD bytes );
int cdecl Open_File_With_Recovery( BYTE const *file_name, unsigned int mode );
BOOL cdecl Cache_File(WORD index, WORD file_handle);
/*=========================================================================*/
/* The following prototypes are for the file: DEVICES.ASM */
/*=========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
extern VOID Get_Devices(VOID);
extern WORD Is_Device_Real(WORD device);
#ifdef __cplusplus
}
#endif
/*=========================================================================*/
/* The following prototypes are for the file: DEVTABLE.ASM */
/*=========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
extern VOID Init_Device_Table(BYTE *table);
extern WORD Max_Device(VOID);
#ifdef __cplusplus
}
#endif
/*=========================================================================*/
/* The following prototypes are for the file: HARDERR.ASM */
/*=========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
extern VOID Install_Hard_Error_Handler(VOID);
extern VOID Remove_Hard_Error_Handler(VOID);
#ifdef __cplusplus
}
#endif
/*=========================================================================*/
/* Globale variables in the fileio system. */
/*=========================================================================*/
extern BYTE CallingDOSInt;
extern "C" extern BYTE MaxDevice,DefaultDrive;
extern BYTE MultiDriveSearch;
extern FileDataType *FileDataPtr;
extern FileHandleType FileHandleTable[TABLE_MAX];
extern UWORD NumFiles; // Number of files, except PAK, in file table.
extern UWORD NumPAKFiles; // Number of PAK files in filetable.
extern VOID *FileCacheHeap; // Pointer to the cache in memory.
extern WORD DiskNumber;
extern WORD MaxDirNum;
/*=========================================================================*/
#endif // _FILE_H