diff options
Diffstat (limited to 'sword2/driver')
-rw-r--r-- | sword2/driver/driver96.h | 92 | ||||
-rw-r--r-- | sword2/driver/keyboard.cpp | 7 | ||||
-rw-r--r-- | sword2/driver/language.cpp | 11 | ||||
-rw-r--r-- | sword2/driver/render.cpp | 29 |
4 files changed, 42 insertions, 97 deletions
diff --git a/sword2/driver/driver96.h b/sword2/driver/driver96.h index da99a0d467..dbb26d3b11 100644 --- a/sword2/driver/driver96.h +++ b/sword2/driver/driver96.h @@ -898,10 +898,6 @@ extern "C" { // Key buffer size #define MAX_KEY_BUFFER 32 -typedef int BOOL; -#define TRUE 1 -#define FALSE 0 - // // Structure definitions // --------------------- @@ -921,11 +917,10 @@ typedef struct { #pragma START_PACK_STRUCTS #endif -typedef struct -{ - uint16 w; - uint16 h; - uint32 offset[2]; // 2 is arbitrary +typedef struct { + uint16 w; + uint16 h; + uint32 offset[2]; // 2 is arbitrary } GCC_PACK _parallax; #if !defined(__GNUC__) @@ -933,30 +928,29 @@ typedef struct #endif -// The _spriteInfo structure is used to tell the driver96 code what attributes -// are linked to a sprite for drawing. These include position, scaling and -// compression. -typedef struct -{ - int16 x; // coords for top-left of sprite - int16 y; - uint16 w; // dimensions of sprite (before scaling) - uint16 h; - uint16 scale; // scale at which to draw, given in 256ths ['0' or '256' MEANS DON'T SCALE] - uint16 scaledWidth; // new dimensions (we calc these for the mouse area, so may as well pass to you to save time) - uint16 scaledHeight; // - uint16 type; // mask containing 'RDSPR_' bits specifying compression type, flip, transparency, etc - uint16 blend; // holds the blending values. - uint8 *data; // pointer to the sprite data - uint8 *colourTable; // pointer to 16-byte colour table, only applicable to 16-col compression type +// The _spriteInfo structure is used to tell the driver96 code what attributes +// are linked to a sprite for drawing. These include position, scaling and +// compression. + +typedef struct { + int16 x; // coords for top-left of sprite + int16 y; + uint16 w; // dimensions of sprite (before scaling) + uint16 h; + uint16 scale; // scale at which to draw, given in 256ths ['0' or '256' MEANS DON'T SCALE] + uint16 scaledWidth; // new dimensions (we calc these for the mouse area, so may as well pass to you to save time) + uint16 scaledHeight; // + uint16 type; // mask containing 'RDSPR_' bits specifying compression type, flip, transparency, etc + uint16 blend; // holds the blending values. + uint8 *data; // pointer to the sprite data + uint8 *colourTable; // pointer to 16-byte colour table, only applicable to 16-col compression type } _spriteInfo; // This is the format of a .WAV file. Somewhere after this header is the string // 'DATA' followed by an int32 size which is the size of the data. Following // the size of the data is the data itself. -typedef struct -{ +typedef struct { uint32 riff; uint32 fileLength; uint32 wavID; @@ -977,8 +971,7 @@ typedef struct // It includes the smack to play, and any text lines which are // to be displayed over the top of the sequence. -typedef struct -{ +typedef struct { uint16 startFrame; uint16 endFrame; _spriteInfo *textSprite; @@ -986,25 +979,6 @@ typedef struct uint16 *speech; } _movieTextObject; - - -typedef struct -{ uint8 manufacturer; - uint8 version; - uint8 encoding; - uint8 bitsPerPixel; - int16 xmin,ymin; - int16 xmax,ymax; - int16 hres; - int16 vres; - char palette[48]; - char reserved; - uint8 colourPlanes; - int16 bytesPerLine; - int16 paletteType; - char filler[58]; -} _pcxHeader; - // // Function Prototypes // ------------------- @@ -1068,7 +1042,7 @@ extern void ResetRenderEngine(void); //----------------------------------------------------------------------------- // Keyboard functions - from keyboard.c //----------------------------------------------------------------------------- -extern BOOL KeyWaiting(void); +extern bool KeyWaiting(void); extern int32 ReadKey(_keyboardEvent *ke); //----------------------------------------------------------------------------- @@ -1089,7 +1063,7 @@ extern int32 CloseLightMask(void); extern int32 SetScrollTarget(int16 sx, int16 sy); extern int32 InitialiseRenderCycle(void); extern int32 StartRenderCycle(void); -extern int32 EndRenderCycle(BOOL *end); +extern int32 EndRenderCycle(bool *end); extern int32 RenderParallax(_parallax *p, int16 layer); extern int32 SetLocationMetrics(uint16 w, uint16 h); extern int32 CopyScreenBuffer(void); @@ -1110,7 +1084,6 @@ extern int32 SetMenuIcon(uint8 menu, uint8 pocket, uint8 *icon); extern uint8 GetMenuStatus(uint8 menu); extern int32 CloseMenuImmediately(void); - //----------------------------------------------------------------------------- // Misc functions - from misc.cpp //----------------------------------------------------------------------------- @@ -1121,18 +1094,13 @@ extern int32 SVM_GetVolumeInformation(char *cdPath, char *sCDName, uint32 maxPat extern void scumm_mkdir(const char *pathname); extern void SVM_GetModuleFileName(void *module, char *destStr, uint32 maxLen); - //----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -extern int16 screenWide; // Width of the screen display -extern int16 screenDeep; // Height of the screen display -extern int16 mousex; // Mouse screen x coordinate -extern int16 mousey; // Mouse screen y coordinate -extern int32 renderCaps; // Flags which determine how to render the scene. -extern uint8 palCopy[256][4]; // Current palette. -//----------------------------------------------------------------------------- - -extern long int myTimers[10][2]; +extern int16 screenWide; // Width of the screen display +extern int16 screenDeep; // Height of the screen display +extern int16 mousex; // Mouse screen x coordinate +extern int16 mousey; // Mouse screen y coordinate +extern int32 renderCaps; // Flags which determine how to render the scene. +extern uint8 palCopy[256][4]; // Current palette. #ifdef __cplusplus } diff --git a/sword2/driver/keyboard.cpp b/sword2/driver/keyboard.cpp index 7de0225c1a..e25eb4714e 100644 --- a/sword2/driver/keyboard.cpp +++ b/sword2/driver/keyboard.cpp @@ -70,11 +70,8 @@ void WriteKey(uint16 ascii, int keycode, int modifiers) { } } -BOOL KeyWaiting(void) { - if (keyBacklog) - return TRUE; - - return FALSE; +bool KeyWaiting(void) { + return keyBacklog != 0; } int32 ReadKey(_keyboardEvent *ev) { diff --git a/sword2/driver/language.cpp b/sword2/driver/language.cpp index 41db961d9b..81e63f4663 100644 --- a/sword2/driver/language.cpp +++ b/sword2/driver/language.cpp @@ -67,12 +67,11 @@ int32 GetLanguageVersion(uint8 *version) { } else { versionFromFile = 1; languageVersion = AMERICAN; - return(RDERR_OPENVERSIONFILE); + return RDERR_OPENVERSIONFILE; } return RD_OK; } - int32 SetLanguageVersion(uint8 version) { languageVersion = version; return RD_OK; @@ -86,17 +85,17 @@ int32 GetGameName(uint8 *name) { switch (version) { case ENGLISH: - strcpy((char *)name, "Broken Sword II"); + strcpy((char *) name, "Broken Sword II"); break; case AMERICAN: - strcpy((char *)name, "Circle of Blood II"); + strcpy((char *) name, "Circle of Blood II"); break; case GERMAN: - strcpy((char *)name, "Baphomet's Fluch II"); + strcpy((char *) name, "Baphomet's Fluch II"); break; default: strcpy((char *)name, "Some game or other, part 86"); - return(RDERR_INVALIDVERSION); + return RDERR_INVALIDVERSION; } return rv; diff --git a/sword2/driver/render.cpp b/sword2/driver/render.cpp index d7db73e5b6..4874d92aa3 100644 --- a/sword2/driver/render.cpp +++ b/sword2/driver/render.cpp @@ -809,8 +809,6 @@ int32 SetLocationMetrics(uint16 w, uint16 h) } - - int32 RenderParallax(_parallax *p, int16 l) { int16 x, y; int16 i, j; @@ -854,10 +852,6 @@ int32 RenderParallax(_parallax *p, int16 l) { } - - - - /* #define LOGSIZE 10 int32 previousTimeLog[LOGSIZE]; @@ -902,8 +896,6 @@ int32 InitialiseRenderCycle(void) { return RD_OK; } - - int32 StartRenderCycle(void) { scrollxOld = scrollx; scrollyOld = scrolly; @@ -924,7 +916,6 @@ int32 StartRenderCycle(void) { return RD_OK; } - // FIXME: Move this to some better place? void sleepUntil(int32 time) { @@ -939,7 +930,7 @@ void sleepUntil(int32 time) { } } -int32 EndRenderCycle(BOOL *end) { +int32 EndRenderCycle(bool *end) { int32 time; time = SVM_timeGetTime(); @@ -953,23 +944,23 @@ int32 EndRenderCycle(BOOL *end) { renderCountIndex = 0; if (renderTooSlow) { - *end = TRUE; + *end = true; InitialiseRenderCycle(); } else if (startTime + renderAverageTime >= totalTime) { - *end = TRUE; + *end = true; totalTime += MILLISECSPERCYCLE; initialTime = time; #ifdef LIMIT_FRAME_RATE } else if (scrollxTarget == scrollx && scrollyTarget == scrolly) { // If we have already reached the scroll target sleep for the // rest of the render cycle. - *end = TRUE; + *end = true; sleepUntil(totalTime); initialTime = SVM_timeGetTime(); totalTime += MILLISECSPERCYCLE; #endif } else { - *end = FALSE; + *end = false; // This is an attempt to ensure that we always reach the scroll // target. Otherwise the game frequently tries to pump out new @@ -987,7 +978,6 @@ int32 EndRenderCycle(BOOL *end) { return RD_OK; } - int32 SetScrollTarget(int16 sx, int16 sy) { scrollxTarget = sx; scrollyTarget = sy; @@ -1000,7 +990,6 @@ int32 CopyScreenBuffer(void) { return RD_OK; } - int32 InitialiseBackgroundLayer(_parallax *p) { uint8 *memchunk; uint8 zeros; @@ -1121,7 +1110,6 @@ int32 InitialiseBackgroundLayer(_parallax *p) { } - int32 CloseBackgroundLayer(void) { debug(2, "CloseBackgroundLayer"); @@ -1140,10 +1128,3 @@ int32 CloseBackgroundLayer(void) { layer = 0; return RD_OK; } - - -int32 EraseSoftwareScreenBuffer(void) -{ - // memset(myScreenBuffer, 0, RENDERWIDE * RENDERDEEP); - return(RD_OK); -} |