/*
** 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 .
*/
#ifndef VQAPLAY_H
#define VQAPLAY_H
/****************************************************************************
*
* 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
* VQA player library. (32-Bit protected mode)
*
* FILE
* vqaplay.h
*
* DESCRIPTION
* VQAPlay library definitions.
*
* PROGRAMMER
* Bill Randolph
* Denzil E. Long, Jr.
*
* DATE
* April 10, 1995
*
****************************************************************************/
/*---------------------------------------------------------------------------
* CONDITIONAL COMPILATION FLAGS
*-------------------------------------------------------------------------*/
// MEG - 11.28.95 - added for debug
extern void Debug_Printf( char *format_string, ... );
#ifdef __WATCOMC__
#define VQASTANDALONE 0 /* Stand alone player */
#define VQAVOC_ON 0 /* Enable VOC file override */
#define VQAMONO_ON 0 /* Mono display output enable/disable */
#define VQAAUDIO_ON 0 /* Audio playback enable/disable */
#define VQAVIDEO_ON 0 /* Video manager enable/disable */
#define VQAMCGA_ON 1 /* MCGA enable/disable */
#define VQAXMODE_ON 0 /* Xmode enable/disable */
#define VQAVESA_ON 0 /* VESA enable/disable */
#define VQABLOCK_2X2 0 /* 2x2 block decode enable/disable */
#define VQABLOCK_2X3 0 /* 2x2 block decode enable/disable */
#define VQABLOCK_4X2 1 /* 4x2 block decode enable/disable */
#define VQABLOCK_4X4 0 /* 4x4 block decode enable/disable */
#define VQAWOOFER_ON 0
#else
#define VQASTANDALONE 0 /* Stand alone player */
#define VQAVOC_ON 0 /* Enable VOC file override */
#define VQAMONO_ON 1 /* Mono display output enable/disable */
#define VQAAUDIO_ON 0 /* Audio playback enable/disable */
#define VQAVIDEO_ON 0 /* Video manager enable/disable */
#define VQAMCGA_ON 1 /* MCGA enable/disable */
#define VQAXMODE_ON 0 /* Xmode enable/disable */
#define VQAVESA_ON 0 /* VESA enable/disable */
#define VQABLOCK_2X2 0 /* 2x2 block decode enable/disable */
#define VQABLOCK_2X3 0 /* 2x2 block decode enable/disable */
#define VQABLOCK_4X2 1 /* 4x2 block decode enable/disable */
#define VQABLOCK_4X4 0 /* 4x4 block decode enable/disable */
#define VQAWOOFER_ON 0
#endif
/*---------------------------------------------------------------------------
* GENERAL CONSTANT DEFINITIONS
*-------------------------------------------------------------------------*/
/* Playback modes. */
#define VQAMODE_RUN 0 /* Run the movie through the end. */
#define VQAMODE_WALK 1 /* Draw the next frame then return. */
#define VQAMODE_PAUSE 2 /* Suspend movie playback. */
#define VQAMODE_STOP 3 /* Stop the movie. */
/* Playback timer methods */
#define VQA_TMETHOD_DEFAULT -1 /* Use default timer method. */
#define VQA_TMETHOD_DOS 1 /* DOS timer method */
#define VQA_TMETHOD_INT 2 /* Interrupt timer method */
#define VQA_TMETHOD_AUDIO 3 /* Audio timer method */
#define VQA_TIMETICKS 60 /* Clock ticks per second */
/* Error/Status conditions */
#define VQAERR_NONE 0 /* No error */
#define VQAERR_EOF -1 /* Valid end of file */
#define VQAERR_OPEN -2 /* Unable to open */
#define VQAERR_READ -3 /* Read error */
#define VQAERR_WRITE -4 /* Write error */
#define VQAERR_SEEK -5 /* Seek error */
#define VQAERR_NOTVQA -6 /* Not a valid VQA file. */
#define VQAERR_NOMEM -7 /* Unable to allocate memory */
#define VQAERR_NOBUFFER -8 /* No buffer avail for load/draw */
#define VQAERR_NOT_TIME -9 /* Not time for frame yet */
#define VQAERR_SLEEPING -10 /* Function is in a sleep state */
#define VQAERR_VIDEO -11 /* Video related error. */
#define VQAERR_AUDIO -12 /* Audio related error. */
#define VQAERR_PAUSED -13 /* In paused state. */
/* Event flags. */
#define VQAEVENT_PALETTE (1<<0)
#define VQAEVENT_SYNC (1<<1)
/*---------------------------------------------------------------------------
* STRUCTURES AND RELATED DEFINITIONS
*-------------------------------------------------------------------------*/
/* VQAConfig: Player configuration structure
*
* DrawerCallback - User routine for Drawer to call each frame (NULL = none)
* EventHandler - User routine for notification to client of events.
* NotifyFlags - User specified events to be notified about.
* Vmode - Requested Video mode (May be promoted).
* VBIBit - Vertical blank bit polarity.
* ImageBuf - Pointer to caller's buffer for the Drawer to use as its
* ImageBuf; NULL = player will allocate its own, if
* VQACFGF_BUFFER is set in DrawFlags.
* ImageWidth - Width of Image buffer.
* ImageHeight - Height of Image buffer.
* X1 - Draw window X coordinate (-1 = Center).
* Y1 - Draw window Y coordinate (-1 = Center).
* FrameRate - Desired frames per second (-1 = use VQA header's value).
* DrawRate - Desired drawing frame rate; allows the Drawer to draw at
* a separate rate from the Loader.
* TimerMethod - Timer method to use during playback.
* DrawFlags - Bits control various special drawing options. (See below)
* OptionFlags - Bits control various special misc options. (See below)
* NumFrameBufs - Desired number of frame buffers. (Default = 6)
* NumCBBufs - Desired number of codebook buffers. (Default = 3)
* VocFile - Name of VOC file to play instead of VQA audio track.
* AudioBuf - Pointer to audio buffer.
* AudioBufSize - Size of audio buffer. (Default = 32768)
* AudioRate - Audio data playback rate (-1 = use samplerate scaled
* to the frame rate)
* Volume - Audio playback volume. (0x7FFF = max)
* HMIBufSize - Desired HMI buffer size. (Default = 2000)
* DigiHandle - Handle to an initialized sound driver. (-1 = none)
* DigiCard - HMI ID of card to use. (0 = none, -1 = auto-detect)
* DigiPort - Audio port address. (-1 = auto-detect)
* DigiIRQ - Audio IRQ. (-1 = auto-detect)
* DigiDMA - Audio DMA channel. (-1 = auto-detect)
* Language - Language identifier. (Not used)
* CapFont - Pointer to font to use for subtitle text captions.
*/
typedef struct _VQAConfig {
long (*DrawerCallback)(unsigned char *screen, long framenum);
long (*EventHandler)(unsigned long event,void *buffer,long nbytes);
unsigned long NotifyFlags;
long Vmode;
long VBIBit;
unsigned char *ImageBuf;
long ImageWidth;
long ImageHeight;
long X1,Y1;
long FrameRate;
long DrawRate;
long TimerMethod;
long DrawFlags;
long OptionFlags;
long NumFrameBufs;
long NumCBBufs;
char *VocFile;
unsigned char *AudioBuf;
long AudioBufSize;
long AudioRate;
long Volume;
long HMIBufSize;
long DigiHandle;
long DigiCard;
long DigiPort;
long DigiIRQ;
long DigiDMA;
long Language;
char *CapFont;
} VQAConfig;
/* Drawer Configuration flags (DrawFlags) */
#define VQACFGB_BUFFER 0 /* Buffer UnVQ enable */
#define VQACFGB_NODRAW 1 /* Drawing disable */
#define VQACFGB_NOSKIP 2 /* Disable frame skipping. */
#define VQACFGB_VRAMCB 3 /* XMode VRAM copy enable */
#define VQACFGB_ORIGIN 4 /* 0,0 origin position */
#define VQACFGB_SCALEX2 6 /* Scale X2 enable (VESA 320x200 to 640x400) */
#define VQACFGB_WOOFER 7
#define VQACFGF_BUFFER (1<