From d89eb0014e72da9fe561a5a150943d6b962c3dd9 Mon Sep 17 00:00:00 2001 From: Steven Fuller Date: Wed, 4 Jul 2001 22:58:50 +0000 Subject: [PATCH] First wave of changes: Removed inclusion of Windows header files and remove some Windows-specific declarations. --- src/avp/support/indexfnt.hpp | 2 +- src/include/shape.h | 14 ++------ src/map.c | 1 - src/morph.c | 29 ++-------------- src/win95/aw.h | 14 -------- src/win95/inline.h | 26 +++++++++++++-- src/win95/mmx_math.h | 24 ++++++------- src/win95/platform.h | 65 +++--------------------------------- 8 files changed, 43 insertions(+), 132 deletions(-) diff --git a/src/avp/support/indexfnt.hpp b/src/avp/support/indexfnt.hpp index 5afa66a..9521966 100644 --- a/src/avp/support/indexfnt.hpp +++ b/src/avp/support/indexfnt.hpp @@ -35,7 +35,7 @@ /* Version settings *****************************************************/ /* Constants ***********************************************************/ -#include "HUD_layout.h" +#include "hud_layout.h" /* Macros ***************************************************************/ /* Type definitions *****************************************************/ diff --git a/src/include/shape.h b/src/include/shape.h index f0acdf4..32ed022 100644 --- a/src/include/shape.h +++ b/src/include/shape.h @@ -6,18 +6,10 @@ */ -#ifndef SupportWindows95 - #if defined(_WIN32)||defined(WIN32) - #define SupportWindows95 1 - #else - #define SupportWindows95 0 - #endif -#endif -#if SupportWindows95 - #include - #include - #include "aw.h" +#ifndef SupportWindows95 /* Enable so that PC code is used */ +#define SupportWindows95 1 #endif + #include "shpanim.h" diff --git a/src/map.c b/src/map.c index c926cbd..f29049a 100644 --- a/src/map.c +++ b/src/map.c @@ -243,4 +243,3 @@ void MapBlockInit(DISPLAYBLOCK *dptr) } - diff --git a/src/morph.c b/src/morph.c index d868a50..341f988 100644 --- a/src/morph.c +++ b/src/morph.c @@ -1,36 +1,23 @@ #include "3dc.h" - #include "inline.h" - /* externs for commonly used global variables and arrays */ - extern MORPHDISPLAY MorphDisplay; - extern int NormalFrameTime; - +extern MORPHDISPLAY MorphDisplay; +extern int NormalFrameTime; /* - Global Variables - */ - - - - /* - Update Morphing Animation Control Block - */ void UpdateMorphing(MORPHCTRL *mcptr) - { - MORPHHEADER *mhdr = mcptr->ObMorphHeader; int UpdateRate; @@ -130,13 +117,10 @@ void UpdateMorphing(MORPHCTRL *mcptr) */ void UpdateMorphingDptr(DISPLAYBLOCK *dptr) - { - SHAPEHEADER *sptr1; SHAPEHEADER *sptr2; - /* Update object radius and extents */ GetMorphDisplay(&MorphDisplay, dptr); @@ -284,9 +268,7 @@ void UpdateMorphingDptr(DISPLAYBLOCK *dptr) */ void GetMorphDisplay(MORPHDISPLAY *md, DISPLAYBLOCK *dptr) - { - MORPHFRAME *mdata; MORPHCTRL *mc = dptr->ObMorphCtrl; MORPHHEADER *mhdr = mc->ObMorphHeader; @@ -303,20 +285,13 @@ void GetMorphDisplay(MORPHDISPLAY *md, DISPLAYBLOCK *dptr) md->md_sptr1 = GetShapeData(md->md_shape1); md->md_sptr2 = GetShapeData(md->md_shape2); - } void CopyMorphCtrl(MORPHCTRL *src, MORPHCTRL *dst) - { - dst->ObMorphCurrFrame = src->ObMorphCurrFrame; dst->ObMorphFlags = src->ObMorphFlags; dst->ObMorphSpeed = src->ObMorphSpeed; dst->ObMorphHeader = src->ObMorphHeader; - } - - - \ No newline at end of file diff --git a/src/win95/aw.h b/src/win95/aw.h index 8e43f33..1b4fa3b 100644 --- a/src/win95/aw.h +++ b/src/win95/aw.h @@ -1,20 +1,6 @@ #ifndef _INCLUDED_AW_H_ #define _INCLUDED_AW_H_ -#include - -typedef IDirectDraw DDObject; -typedef IDirect3DDevice D3DDevice; -typedef IDirect3DTexture D3DTexture; -typedef IDirectDrawSurface DDSurface; -typedef IDirectDrawPalette DDPalette; - -#define GUID_D3D_TEXTURE IID_IDirect3DTexture -#define GUID_DD_SURFACE IID_IDirectDrawSurface - -typedef DDSURFACEDESC DD_SURFACE_DESC; -typedef DDSCAPS DD_S_CAPS; - struct AwBackupTexture; typedef struct AwBackupTexture * AW_BACKUPTEXTUREHANDLE; diff --git a/src/win95/inline.h b/src/win95/inline.h index fdc5c60..30b7faa 100644 --- a/src/win95/inline.h +++ b/src/win95/inline.h @@ -1,4 +1,5 @@ #ifndef INLINE_INCLUDED +#define INLINE_INCLUDED #if SUPPORT_MMX #include "mmx_math.h" @@ -1207,7 +1208,27 @@ a = itmp;} #else /* other compiler ? */ -#error "Unknown compiler" +/* #error "Unknown compiler" */ +void ADD_LL(LONGLONGCH *a, LONGLONGCH *b, LONGLONGCH *c); +void ADD_LL_PP(LONGLONGCH *c, LONGLONGCH *a); +void SUB_LL(LONGLONGCH *a, LONGLONGCH *b, LONGLONGCH *c); +void SUB_LL_MM(LONGLONGCH *c, LONGLONGCH *a); +void MUL_I_WIDE(int a, int b, LONGLONGCH *c); +int CMP_LL(LONGLONGCH *a, LONGLONGCH *b); +void EQUALS_LL(LONGLONGCH *a, LONGLONGCH *b); +void NEG_LL(LONGLONGCH *a); +void ASR_LL(LONGLONGCH *a, int shift); +void IntToLL(LONGLONGCH *a, int *b); +int MUL_FIXED(int a, int b); +int DIV_FIXED(int a, int b); + +#define DIV_INT(a, b) ((a) / (b)) + +int NarrowDivide(LONGLONGCH *a, int b); +int WideMulNarrowDiv(int a, int b, int c); +void RotateVector_ASM(VECTORCH *v, MATRIXCH *m); +void RotateAndCopyVector_ASM(VECTORCH *v1, VECTORCH *v2, MATRIXCH *m); +int f2i(float f); #endif @@ -1241,6 +1262,5 @@ void CopyClipPoint(CLIP_POINT *cp1, CLIP_POINT *cp2); } #endif -#define INLINE_INCLUDED -#endif +#endif diff --git a/src/win95/mmx_math.h b/src/win95/mmx_math.h index 594ac0e..9382c0e 100644 --- a/src/win95/mmx_math.h +++ b/src/win95/mmx_math.h @@ -70,18 +70,6 @@ To ensure this in arrays of vectors/matrices, the structure should contain a dummy padding 32-bit value (recommended). */ -/* storage class specifier for assembler calls */ - -#ifdef __WATCOMC__ -#define _asmcall -#define _asminline -#elif defined(_MSC_VER) -#define _asmcall static __inline -#define _asminline static __inline -#else -#error "Unknown compiler" -#endif - /* forward reference declared in global scope */ struct vectorch; struct matrixch; @@ -202,7 +190,13 @@ _asmcall signed MMX_VectorDot16(struct vectorch const * v1, struct vectorch cons #else -#error "Unknown compiler" +/* #error "Unknown compiler" */ +void MMX_VectorTransform(struct vectorch * vector, struct matrixch const * matrix); +void MMX_VectorTransformed(struct vectorch * v_result, struct vectorch const * v_parm, struct matrixch const * matrix); +void MMX_VectorTransformAndAdd(struct vectorch * vector, struct matrixch const * matrix, struct vectorch const * v_add); +void MMX_VectorTransformedAndAdd(struct vectorch * v_result, struct vectorch const * v_parm, struct matrixch const * matrix, struct vectorch const * v_add); +int MMX_VectorDot(struct vectorch const * v1, struct vectorch const * v2); +int MMX_VectorDot16(struct vectorch const * v1, struct vectorch const * v2); #endif @@ -456,7 +450,9 @@ _asminline signed MMXInline_VectorDot16(struct vectorch const * v1, struct vecto #else -#error "Unknown compiler" +/* #error "Unknown compiler" */ +int MMXInline_VectorDot(struct vectorch const * v1, struct vectorch const * v2); +int MMXInline_VectorDot16(struct vectorch const * v1, struct vectorch const * v2); #endif diff --git a/src/win95/platform.h b/src/win95/platform.h index 7cab03d..31a0d68 100644 --- a/src/win95/platform.h +++ b/src/win95/platform.h @@ -1,4 +1,5 @@ #ifndef PLATFORM_INCLUDED +#define PLATFORM_INCLUDED /* @@ -10,41 +11,13 @@ extern "C" { #endif -/* - Minimise header files to - speed compiles... -*/ +#define PACKED __attribute__((packed)) -#define WIN32_LEAN_AND_MEAN - -/* - Standard windows functionality -*/ - -#include -#include -#include -#include -#include -#include -#include - -/* - DirectX functionality -*/ - -#include "ddraw.h" -#include "d3d.h" -#include "dsound.h" -#include "dplay.h" -#include "dinput.h" -#include "dplobby.h" //#include "fastfile.h" #define platform_pc Yes - -#define Saturn No +#define Saturn No #define Hardware2dTextureClipping No @@ -607,10 +580,6 @@ typedef enum { loader works (John's code, still under test). */ -#ifdef __WATCOMC__ -#pragma pack (1) -#endif - typedef struct bmpheader { unsigned short BMP_ID; /* Contains 'BM' */ @@ -634,11 +603,7 @@ typedef struct bmpheader { int BMP_Colours; /* Number of colours used, below (N) */ int BMP_ImpCols; /* Number of important colours */ -} BMPHEADER; - -#ifdef __WATCOMC__ -#pragma pack (4) -#endif +} PACKED BMPHEADER; /* Types of texture files that can be @@ -785,27 +750,6 @@ void UnlockBackdropSurface(void); void ComposeBackdropBackBuffer(void); int GetSingleColourForPrimary(int Colour); -/* - DirectX functionality only available in - C++ under Watcom at present -*/ -#ifdef __cplusplus -HRESULT CALLBACK EnumDisplayModesCallback(LPDDSURFACEDESC pddsd, LPVOID Context); -BOOL FAR PASCAL EnumDDObjectsCallback(GUID FAR* lpGUID, LPSTR lpDriverDesc, - LPSTR lpDriverName, LPVOID lpContext); -#if triplebuffer -/* - must be WINAPI to support Windows FAR PASCAL - calling convention. Must be HRESULT to support - enumeration return value. NOTE THIS FUNCTION - DOESN'T WORK (DOCS WRONG) AND TRIPLE BUFFERING - HAS BEEN REMOVED ANYWAY 'COS IT'S USELESS... -*/ -HRESULT WINAPI InitTripleBuffers(LPDIRECTDRAWSURFACE lpdd, - LPDDSURFACEDESC lpsd, LPVOID lpc); -#endif -#endif - /* Direct 3D Immediate Mode Rasterisation Module */ BOOL InitialiseDirect3DImmediateMode(void); BOOL LockExecuteBuffer(void); @@ -934,6 +878,5 @@ void ProcessProjectWhileWaitingToBeFlippable(); }; #endif -#define PLATFORM_INCLUDED #endif