diff options
| author | Steven Fuller <relnev@icculus.org> | 2001-07-29 20:57:33 +0000 |
|---|---|---|
| committer | Patryk Obara <dreamer.tan@gmail.com> | 2019-08-20 02:22:36 +0200 |
| commit | 4db15e7459ab06860cb7a7e162ca6d2b52a68b9c (patch) | |
| tree | d26b85d52ff351d029f8138b58fbebee3464c1e1 /src/win95 | |
| parent | 5c497c61a656f338eb9599fb5f364ad853d0eccf (diff) | |
More compiling. Things are starting to get hacky (adding stubs, commenting
out unimplemented windows stuff, and so on).
Diffstat (limited to 'src/win95')
| -rw-r--r-- | src/win95/aw.h | 23 | ||||
| -rw-r--r-- | src/win95/awiffld.cpp | 41 | ||||
| -rw-r--r-- | src/win95/awtexld.h | 82 | ||||
| -rw-r--r-- | src/win95/awtexld.hpp | 7 | ||||
| -rw-r--r-- | src/win95/chnktexi.cpp | 28 | ||||
| -rw-r--r-- | src/win95/texio.c | 8 |
6 files changed, 149 insertions, 40 deletions
diff --git a/src/win95/aw.h b/src/win95/aw.h index 73c9b42..a70be64 100644 --- a/src/win95/aw.h +++ b/src/win95/aw.h @@ -4,4 +4,27 @@ struct AwBackupTexture; typedef struct AwBackupTexture * AW_BACKUPTEXTUREHANDLE; +typedef struct DIRECTDRAWSURFACE +{ + int x; +} DIRECTDRAWSURFACE; + +typedef DIRECTDRAWSURFACE * LPDIRECTDRAWSURFACE; +typedef DIRECTDRAWSURFACE DDSurface; + +typedef struct DIRECT3DTEXTURE +{ + int x; +} DIRECT3DTEXTURE; + +typedef DIRECT3DTEXTURE * LPDIRECT3DTEXTURE; +typedef DIRECT3DTEXTURE D3DTexture; + +//typedef struct D3DTEXTUREHANDLE +//{ +// int x; +//} D3DTEXTUREHANDLE; + +typedef int D3DTEXTUREHANDLE; + #endif /* _INCLUDED_AW_H_ */ diff --git a/src/win95/awiffld.cpp b/src/win95/awiffld.cpp index de3be19..0493d64 100644 --- a/src/win95/awiffld.cpp +++ b/src/win95/awiffld.cpp @@ -1,4 +1,5 @@ -#include "advwin32.h" +#include "fixer.h" + #ifndef DB_LEVEL #define DB_LEVEL 4 #endif @@ -7,12 +8,10 @@ #define DB_COMMA , #endif -#pragma warning(disable: 4701) -#include "awTexLd.hpp" -#pragma warning(default: 4701) +#include "awtexld.hpp" #include "iff.hpp" -#include "iff_ILBM.hpp" +#include "iff_ilbm.hpp" #include "list_tem.hpp" @@ -245,12 +244,12 @@ void AwIffLoader::LoadHeaderInfo(MediaMedium * pMedium) if (!m_ifData.Load(pMedium) || !m_ifData.GetContents()) { - if (NO_ERROR == (awTlLastWinErr = GetLastError())) - awTlLastErr = AW_TLE_BADFILEDATA; - else - awTlLastErr = AW_TLE_CANTREADFILE; +// if (NO_ERROR == (awTlLastWinErr = GetLastError())) +// awTlLastErr = AW_TLE_BADFILEDATA; +// else +// awTlLastErr = AW_TLE_CANTREADFILE; - db_log3("AwCreateTexture(): ERROR: IFF file load failed"); + db_log3("AwCreateTexture() [AwIffLoader::LoadHeaderInfo] : ERROR: IFF file load failed"); } else { @@ -378,20 +377,20 @@ void AwIffLoader::OnBeginRestoring(unsigned nMaxPaletteSize) |static_cast<unsigned>(m_pPalette[AwIffConvTransp::iTranspCol].b)>>pixelFormat.blueRightShift<<pixelFormat.blueLeftShift; break; default: - db_log3("AwCreateTexture(): ERROR: IFF mask field wrong"); - awTlLastErr = AW_TLE_BADFILEDATA; + db_log3("AwCreateTexture() [AwIffLoader::OnBeginRestoring] : ERROR: IFF mask field wrong"); +// awTlLastErr = AW_TLE_BADFILEDATA; } } else { - awTlLastErr = AW_TLE_CANTPALETTIZE; // no suitable chunk found - db_log3("AwCreateTexture(): ERROR: No suitable IFF body chunk found"); +// awTlLastErr = AW_TLE_CANTPALETTIZE; // no suitable chunk found + db_log3("AwCreateTexture() [AwIffLoader::OnBeginRestoring] : ERROR: No suitable IFF body chunk found"); } } else { - awTlLastErr = AW_TLE_BADFILEDATA; - db_log3("AwCreateTexture(): ERROR: IFF file not loaded or contains no image data"); +// awTlLastErr = AW_TLE_BADFILEDATA; + db_log3("AwCreateTexture() [AwIffLoader::OnBeginRestoring] : ERROR: IFF file not loaded or contains no image data"); } } @@ -465,8 +464,8 @@ void AwIffLoader::ConvertRow(AwTl::PtrUnion pDest, unsigned nDestWidth, AwTl::Pt GenericConvertRow<AwIffConvTransp,unsigned>::Do(pDest, nDestWidth, pSrc.uintP+nSrcOffset, nSrcWidth, pPalette db_code1(DB_COMMA nPaletteSize)); break; default: - db_log3("AwCreateTexture(): ERROR: IFF mask field wrong"); - awTlLastErr = AW_TLE_BADFILEDATA; + db_log3("AwCreateTexture() [AwIffLoader::ConvertRow] : ERROR: IFF mask field wrong"); +// awTlLastErr = AW_TLE_BADFILEDATA; } } } @@ -497,11 +496,7 @@ AwBackupTexture * AwIffLoader::CreateBackupTexture() } // Valid file ID fields: 'FORM' 'LIST' 'CAT ' - we can load them all -#ifdef _MSC_VER - // VC5.0 tries to compile out code that is in a library - // and it thinks isn't being used - #line 427 -#endif + AWTEXLD_IMPLEMENT_DYNCREATE("FORM",AwIffLoader) AWTEXLD_IMPLEMENT_DYNCREATE("LIST",AwIffLoader) AWTEXLD_IMPLEMENT_DYNCREATE("CAT ",AwIffLoader) diff --git a/src/win95/awtexld.h b/src/win95/awtexld.h index 8b143a9..5f03df1 100644 --- a/src/win95/awtexld.h +++ b/src/win95/awtexld.h @@ -1,6 +1,77 @@ #ifndef _INCLUDED_AWTEXLD_H_ #define _INCLUDED_AWTEXLD_H_ +#ifdef __cplusplus + extern "C" { + #define _AWTL_DEFAULTPARM(v) = (v) +#else /* ! __cplusplus */ + #define _AWTL_DEFAULTPARM(v) +#endif /* ? __cplusplus */ + +#ifdef _MSC_VER + #define _AWTL_VARARG __cdecl +#else + #define _AWTL_VARARG +#endif + +#include "aw.h" + +/******************************/ +/* return codes & error codes */ +/******************************/ + +typedef +enum AwTlErc +{ + /* General Errors */ + AW_TLE_OK /* apparent success */ + , AW_TLE_DXERROR /* unexpected DirectX error - see awTlLastDxErr */ + , AW_TLE_BADPARMS /* parameters passed to function were invalid, or requested unsupported functionality */ + , AW_TLE_NOINIT /* initialization functions have not been successfully called */ + /* File reading errors */ + , AW_TLE_CANTOPENFILE /* file open failed - see awTlLastWinErr for the Windows error code */ + , AW_TLE_CANTREADFILE /* unexpected error reading file - see awTlLastWinErr for the Windows error code */ + , AW_TLE_EOFMET /* unexpected end of file encountered */ + , AW_TLE_BADFILEFORMAT /* file format identifier not recognized */ + , AW_TLE_BADFILEDATA /* file data not consistent */ + /* Conversion errors */ + , AW_TLE_CANTPALETTIZE /* texture format is palettized; file data is not */ + , AW_TLE_IMAGETOOLARGE /* image size is larger in one or both dimensions than maximum texture size */ + , AW_TLE_CANTRELOAD /* loading a new texture into an existing surface failed because the existing surface is an unsuitable size, etc. */ +} + AW_TL_ERC; + + +/*********/ +/* Flags */ +/*********/ + +enum +{ + AW_TLF_DEFAULT = 0x00000000U /* no flags set */ + , AW_TLF_TRANSP = 0x00000001U /* src data has transparency */ + , AW_TLF_PREVSRC = 0x00000002U /* in AwRestoreTexture, use previously stored source data flags (AW_TLF_TRANSP only) */ + , AW_TLF_COMPRESS = 0x00000004U /* use ALLOCONLOAD flag */ + , AW_TLF_CHROMAKEY = 0x00000008U /* use chroma keying for transparency when the texture format has an alpha channel */ + , AW_TLF_VIDMEM = 0x00000010U /* use Video memory for surfaces which are not textures */ + , AW_TLF_PREVSRCALL = 0x00000020U /* in AwRestoreTexture, use ALL previously stored flags, except AW_TLF_CHECKLOST and AW_TLF_SKIPNOTLOST */ + , AW_TLF_TEXTURE = 0x00000040U /* in AwCreateSurface, create a surface in the texture format with the texture flag set */ + , AW_TLF_MINSIZE = 0x00000080U /* with the 'a' option, ensure all surfaces/textures created are at least as big as the rectangle specified even if the rect is partially off the image */ + , AW_TLF_CHECKLOST = 0x00000100U /* checks for lost surfaces and calls restore on them */ + , AW_TLF_SKIPNOTLOST = 0x00000200U /* if the above flag also is specified, does not bother trying to restore surfaces which weren't lost */ + + , _AW_TLF_FORCE32BITENUM = 0x0fffffffU /* probably entirely unnecessary */ +}; + +/* alt_tab junk */ +#define ATIncludeSurfaceDb(p, d, s) fprintf(stderr, "ATIncludeSurfaceDb: %s/%d: %s\n", __FILE__, __LINE__, s) +#define ATIncludeTextureDb(p, d, s) fprintf(stderr, "ATIncludeTextureDb: %s/%d: %s\n", __FILE__, __LINE__, s) + +extern D3DTexture * AwCreateTexture(char const * _argFormatS, ...); +extern DDSurface * AwCreateSurface(char const * _argFormatS, ...); + +#if 0 + #include <windows.h> #include <d3d.h> @@ -557,6 +628,17 @@ extern DDSurface * _AWTL_VARARG AwCreateSurface(char const * _argFormatS, ...); */ extern AW_TL_ERC AwDestroyBackupTexture(AW_BACKUPTEXTUREHANDLE _bH); +#endif + + + + + + + + + + /* End Wrappers */ #ifdef __cplusplus } diff --git a/src/win95/awtexld.hpp b/src/win95/awtexld.hpp index e47d87e..d869511 100644 --- a/src/win95/awtexld.hpp +++ b/src/win95/awtexld.hpp @@ -1,7 +1,7 @@ #ifndef _INCLUDED_AWTEXLD_HPP_ #define _INCLUDED_AWTEXLD_HPP_ -#include "awTexLd.h" +#include "awtexld.h" #include "media.hpp" #include "db.h" #ifndef DB_COMMA @@ -51,7 +51,7 @@ namespace AwTl { unsigned blueLeftShift; unsigned blueRightShift; - DDPIXELFORMAT ddpf; +// DDPIXELFORMAT ddpf; }; // DO SOMTHING ABOUT THIS @@ -76,7 +76,8 @@ namespace AwTl { static_cast<unsigned>(_colP->r)>>pixelFormat.redRightShift<<pixelFormat.redLeftShift |static_cast<unsigned>(_colP->g)>>pixelFormat.greenRightShift<<pixelFormat.greenLeftShift |static_cast<unsigned>(_colP->b)>>pixelFormat.blueRightShift<<pixelFormat.blueLeftShift - |pixelFormat.ddpf.dwRGBAlphaBitMask +/* TODO */ +/*|pixelFormat.ddpf.dwRGBAlphaBitMask*/ ; } static inline unsigned DoConv(BYTE const * _colP, Colour const * _paletteP db_code1(DB_COMMA unsigned _paletteSize)) diff --git a/src/win95/chnktexi.cpp b/src/win95/chnktexi.cpp index 7dad3d9..8fe0345 100644 --- a/src/win95/chnktexi.cpp +++ b/src/win95/chnktexi.cpp @@ -1,11 +1,15 @@ -#include <windows.h> #include <string.h> + +#include "fixer.h" + #include "string.hpp" #ifndef DB_LEVEL #define DB_LEVEL 4 #endif #include "db.h" -#include "awTexLd.h" + +#include "awtexld.h" + #include "chnkload.hpp" #include "chunkpal.hpp" @@ -16,12 +20,12 @@ #include "ffstdio.h" #endif -#ifndef CL_SUPPORT_ALTTAB - #error "Please #define CL_SUPPORT_ALTTAB to 0 or 1 in projload.hpp" -#endif -#if CL_SUPPORT_ALTTAB - #include "alt_tab.h" -#endif +//#ifndef CL_SUPPORT_ALTTAB +// #error "Please #define CL_SUPPORT_ALTTAB to 0 or 1 in projload.hpp" +//#endif +//#if CL_SUPPORT_ALTTAB +// #include "alt_tab.h" +//#endif #include "chnktexi.h" @@ -36,7 +40,9 @@ char const * cl_pszGameMode = NULL; // used to determine if the display is palettized // currently assuming that if this is <= 8 then all // surfaces et. except d3d textures have a global palette -extern "C" extern int VideoModeColourDepth; +extern "C" { + extern int VideoModeColourDepth; +}; // useful filename handling functions @@ -649,7 +655,9 @@ char * CL_GetImageFileName(char * pszDestBuf, unsigned nBufSize, char const * ps } } -extern "C" extern void CheckForWindowsMessages(void); +extern "C" { + extern void CheckForWindowsMessages(void); +}; int CL_LoadImageOnce(char const * pszFileName, unsigned fFlagsEtc) { diff --git a/src/win95/texio.c b/src/win95/texio.c index 6cea7d8..9dffdcf 100644 --- a/src/win95/texio.c +++ b/src/win95/texio.c @@ -34,8 +34,8 @@ #endif -#include "awTexLd.h" -#include "alt_tab.h" +#include "awtexld.h" +//#include "alt_tab.h" /* #define for experimental purposes @@ -1557,7 +1557,7 @@ static void DeallocateImageHeader(IMAGEHEADER * ihptr) { ReleaseD3DTexture(ihptr->D3DTexture); ihptr->D3DTexture = (void*) 0; - ihptr->D3DHandle = (void*) 0; + ihptr->D3DHandle = /* (void*) */ 0; } } @@ -1573,7 +1573,7 @@ static void MinimizeImageHeader(IMAGEHEADER * ihptr) { ReleaseD3DTexture(ihptr->D3DTexture); ihptr->D3DTexture = (void*) 0; - ihptr->D3DHandle = (void*) 0; + ihptr->D3DHandle = /* (void*) */ 0; } } |
