summaryrefslogtreecommitdiff
path: root/src/win95
diff options
context:
space:
mode:
Diffstat (limited to 'src/win95')
-rw-r--r--src/win95/awtexld.cpp2
-rw-r--r--src/win95/awtexld.hpp28
-rw-r--r--src/win95/chnkload.hpp2
-rw-r--r--src/win95/chunkpal.hpp6
-rw-r--r--src/win95/d3load.c316
-rw-r--r--src/win95/iff.hpp2
-rw-r--r--src/win95/ltchunk.hpp2
-rw-r--r--src/win95/media.cpp14
-rw-r--r--src/win95/media.hpp20
-rw-r--r--src/win95/mishchnk.cpp18
-rw-r--r--src/win95/mishchnk.hpp5
-rw-r--r--src/win95/shpchunk.hpp27
-rw-r--r--src/win95/sprchunk.cpp2
-rw-r--r--src/win95/zbuffer.c91
14 files changed, 51 insertions, 484 deletions
diff --git a/src/win95/awtexld.cpp b/src/win95/awtexld.cpp
index 0d3ab5b..08067b8 100644
--- a/src/win95/awtexld.cpp
+++ b/src/win95/awtexld.cpp
@@ -99,8 +99,8 @@ namespace AwTl
if (!pUnknown) return 0;
pUnknown->AddRef();
return static_cast<unsigned>(pUnknown->Release());
+#endif
return 0;
-#endif
}
#endif
diff --git a/src/win95/awtexld.hpp b/src/win95/awtexld.hpp
index d869511..e39ef39 100644
--- a/src/win95/awtexld.hpp
+++ b/src/win95/awtexld.hpp
@@ -8,25 +8,6 @@
#define DB_COMMA ,
#endif
-// Nasty hack to touch the classes so MSVC++ doesn't discards them.
-#ifdef _MSC_VER
- extern class AwTlRegisterLoaderClass_AwBmpLoader_187 rlcAwBmpLoader_187;
-
- extern class AwTlRegisterLoaderClass_AwIffLoader_428 rlcAwIffLoader_428;
- extern class AwTlRegisterLoaderClass_AwIffLoader_429 rlcAwIffLoader_429;
- extern class AwTlRegisterLoaderClass_AwIffLoader_430 rlcAwIffLoader_430;
-
- extern class AwTlRegisterLoaderClass_AwPpmLoader_229 rlcAwPpmLoader_229;
- extern class AwTlRegisterLoaderClass_AwPgmLoader_230 rlcAwPgmLoader_230;
- extern class AwTlRegisterLoaderClass_AwPbmLoader_231 rlcAwPbmLoader_231;
-
- extern class RegisterChunkClassIlbmBmhdChunk_4 rccIlbmBmhdChunk_4;
- extern class RegisterChunkClassIlbmCmapChunk_5 rccIlbmCmapChunk_5;
- extern class RegisterChunkClassIlbmBodyChunk_6 rccIlbmBodyChunk_6;
- extern class RegisterChunkClassIlbmGrabChunk_7 rccIlbmGrabChunk_7;
-
-#endif
-
namespace AwTl {
#define CANT_HAPPEN db_msgf1(("AwCreateTexture(): (Line %u) CAN'T HAPPEN!",__LINE__));
@@ -208,11 +189,6 @@ namespace AwTl {
static void Do (PtrUnion _dstRowP, unsigned _dstWidth, SRCTYPE const * _srcRowP, unsigned _srcWidth, Colour const * _paletteP = NULL db_code1(DB_COMMA unsigned _paletteSize = 0));
};
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable: 4701)
-#endif
-
template<class CONVERT, class SRCTYPE>
void GenericConvertRow<CONVERT, SRCTYPE>::Do (PtrUnion _dstRowP, unsigned _dstWidth, SRCTYPE const * _srcRowP, unsigned _srcWidth, Colour const * _paletteP db_code1(DB_COMMA unsigned _paletteSize))
{
@@ -300,10 +276,6 @@ namespace AwTl {
}
}
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
// reference counting support
class RefCntObj
{
diff --git a/src/win95/chnkload.hpp b/src/win95/chnkload.hpp
index 19325dc..adf2163 100644
--- a/src/win95/chnkload.hpp
+++ b/src/win95/chnkload.hpp
@@ -95,9 +95,9 @@ struct _RifHandle : Project_RifHandle
_RifHandle()
: fc(0)
, envd(0)
+ , palparent(0)
, max_index(0)
, tex_index_nos(0)
- , palparent(0)
{}
};
diff --git a/src/win95/chunkpal.hpp b/src/win95/chunkpal.hpp
index 5a51c6d..8bb3c6e 100644
--- a/src/win95/chunkpal.hpp
+++ b/src/win95/chunkpal.hpp
@@ -105,8 +105,8 @@ public:
, reserved1(0)
, reserved2(0)
, startpos(0)
- , pixel_data(0)
, name(0)
+ , pixel_data(0)
{}
// copy constructor
@@ -754,8 +754,8 @@ class RIF_Child_Chunk;
class BMP_Flags
{
public:
- BMP_Flags(void) : filename(0), enum_id(0), version_num(0), flags((BMPN_Flags)0){}
- BMP_Flags(const char * const fname) : enum_id(0), version_num(0), flags((BMPN_Flags)0), filename(0)
+ BMP_Flags(void) : filename(0), flags((BMPN_Flags)0), version_num(0), enum_id(0) {}
+ BMP_Flags(const char * const fname) : filename(0), flags((BMPN_Flags)0), version_num(0), enum_id(0)
{
if (fname)
{
diff --git a/src/win95/d3load.c b/src/win95/d3load.c
deleted file mode 100644
index 011106b..0000000
--- a/src/win95/d3load.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/***************************************************************************/
-/* Loading a PPM file into a surface */
-/***************************************************************************/
-/*
- * LoadSurface
- * Loads a ppm file into a texture map DD surface of the given format. The
- * memory flag specifies DDSCAPS_SYSTEMMEMORY or DDSCAPS_VIDEOMEMORY.
- */
-LPDIRECTDRAWSURFACE
-D3DAppILoadSurface(LPDIRECTDRAW lpDD, LPCSTR lpName,
- LPDDSURFACEDESC lpFormat, DWORD memoryflag)
-{
- LPDIRECTDRAWSURFACE lpDDS;
- DDSURFACEDESC ddsd, format;
- D3DCOLOR colors[256];
- D3DCOLOR c;
- DWORD dwWidth, dwHeight;
- int i, j;
- FILE *fp;
- char *lpC;
- CHAR buf[100];
- LPDIRECTDRAWPALETTE lpDDPal;
- PALETTEENTRY ppe[256];
- int psize;
- DWORD pcaps;
- int color_count;
- BOOL bQuant = FALSE;
- HRESULT ddrval;
-
- /*
- * Find the image file and open it
- */
- fp = D3DAppIFindFile(lpName, "rb");
- if (fp == NULL) {
- D3DAppISetErrorString("Cannot find %s.\n", lpName);
- return NULL;
- }
- /*
- * Is it a PPM file?
- */
- fgets(buf, sizeof buf, fp);
- if (lstrcmp(buf, "P6\n")) {
- fclose(fp);
- D3DAppISetErrorString("%s is not a PPM file.\n", lpName);
- return NULL;
- }
- /*
- * Skip any comments
- */
- do {
- fgets(buf, sizeof buf, fp);
- } while (buf[0] == '#');
- /*
- * Read the width and height
- */
- sscanf(buf, "%d %d\n", &dwWidth, &dwHeight);
- fgets(buf, sizeof buf, fp); /* skip next line */
- /*
- * Create a surface of the given format using the dimensions of the PPM
- * file.
- */
- memcpy(&format, lpFormat, sizeof(DDSURFACEDESC));
- if (format.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) {
- bQuant = TRUE;
- psize = 256;
- pcaps = DDPCAPS_8BIT | DDPCAPS_ALLOW256;
- } else if (format.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED4) {
- bQuant = TRUE;
- psize = 16;
- pcaps = DDPCAPS_4BIT;
- }
- memcpy(&ddsd, &format, sizeof(DDSURFACEDESC));
- ddsd.dwSize = sizeof(DDSURFACEDESC);
- ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
- ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | memoryflag;
- ddsd.dwHeight = dwHeight;
- ddsd.dwWidth = dwWidth;
-
- ddrval = lpDD->lpVtbl->CreateSurface(lpDD, &ddsd, &lpDDS, NULL);
- if (ddrval != DD_OK) {
- D3DAppISetErrorString("CreateSurface for texture failed (loadtex).\n%s",
- D3DAppErrorToString(ddrval));
- return NULL;
- }
- /*
- * Lock the surface so it can be filled with the PPM file
- */
- memset(&ddsd, 0, sizeof(DDSURFACEDESC));
- ddsd.dwSize = sizeof(DDSURFACEDESC);
- ddrval = lpDDS->lpVtbl->Lock(lpDDS, NULL, &ddsd, 0, NULL);
- if (ddrval != DD_OK) {
- lpDDS->lpVtbl->Release(lpDDS);
- D3DAppISetErrorString("Lock failed while loading surface (loadtex).\n%s",
- D3DAppErrorToString(ddrval));
- return NULL;
- }
- /*
- * The method of loading depends on the pixel format of the dest surface
- */
- if (!bQuant) {
- /*
- * The texture surface is not palettized
- */
- unsigned long* lpLP;
- unsigned short* lpSP;
- unsigned char* lpCP;
- unsigned long m;
- int s;
- int red_shift, red_scale;
- int green_shift, green_scale;
- int blue_shift, blue_scale;
- /*
- * Determine the red, green and blue masks' shift and scale.
- */
- for (s = 0, m = format.ddpfPixelFormat.dwRBitMask; !(m & 1);
- s++, m >>= 1);
- red_shift = s;
- red_scale = 255 / (format.ddpfPixelFormat.dwRBitMask >> s);
- for (s = 0, m = format.ddpfPixelFormat.dwGBitMask; !(m & 1);
- s++, m >>= 1);
- green_shift = s;
- green_scale = 255 / (format.ddpfPixelFormat.dwGBitMask >> s);
- for (s = 0, m = format.ddpfPixelFormat.dwBBitMask; !(m & 1);
- s++, m >>= 1);
- blue_shift = s;
- blue_scale = 255 / (format.ddpfPixelFormat.dwBBitMask >> s);
- /*
- * Each RGB bit count requires different pointers
- */
- switch (format.ddpfPixelFormat.dwRGBBitCount) {
- case 32 :
- for (j = 0; j < (int)dwHeight; j++) {
- /*
- * Point to next row in texture surface
- */
- lpLP = (unsigned long*)(((char*)ddsd.lpSurface) +
- ddsd.lPitch * j);
- for (i = 0; i < (int)dwWidth; i++) {
- int r, g, b;
- /*
- * Read each value, scale it and shift it into position
- */
- r = getc(fp) / red_scale;
- g = getc(fp) / green_scale;
- b = getc(fp) / blue_scale;
- *lpLP = (r << red_shift) | (g << green_shift) |
- (b << blue_shift);
- lpLP++;
- }
- }
- break;
- case 16 :
- for (j = 0; j < (int)dwHeight; j++) {
- lpSP = (unsigned short*)(((char*)ddsd.lpSurface) +
- ddsd.lPitch * j);
- for (i = 0; i < (int)dwWidth; i++) {
- int r, g, b;
- r = getc(fp) / red_scale;
- g = getc(fp) / green_scale;
- b = getc(fp) / blue_scale;
- *lpSP = (r << red_shift) | (g << green_shift) |
- (b << blue_shift);
- lpSP++;
- }
- }
- break;
- case 8:
- for (j = 0; j < (int)dwHeight; j++) {
- lpCP = (unsigned char*)(((char*)ddsd.lpSurface) +
- ddsd.lPitch * j);
- for (i = 0; i < (int)dwWidth; i++) {
- int r, g, b;
- r = getc(fp) / red_scale;
- g = getc(fp) / green_scale;
- b = getc(fp) / blue_scale;
- *lpCP = (r << red_shift) | (g << green_shift) |
- (b << blue_shift);
- lpCP++;
- }
- }
- break;
- default:
- /*
- * This wasn't a format I recognize
- */
- lpDDS->lpVtbl->Unlock(lpDDS, NULL);
- fclose(fp);
- lpDDS->lpVtbl->Release(lpDDS);
- D3DAppISetErrorString("Unknown pixel format (loadtex).");
- return NULL;
- }
- /*
- * Unlock the texture and return the surface pointer
- */
- lpDDS->lpVtbl->Unlock(lpDDS, NULL);
- fclose(fp);
- return (lpDDS);
- }
-
- /*
- * We assume the 8-bit palettized case
- */
- color_count = 0; /* number of colors in the texture */
- for (j = 0; j < (int)dwHeight; j++) {
- /*
- * Point to next row in surface
- */
- lpC = ((char*)ddsd.lpSurface) + ddsd.lPitch * j;
- for (i = 0; i < (int)dwWidth; i++) {
- int r, g, b, k;
- /*
- * Get the next red, green and blue values and turn them into a
- * D3DCOLOR
- */
- r = getc(fp);
- g = getc(fp);
- b = getc(fp);
- c = RGB_MAKE(r, g, b);
- /*
- * Search for this color in a table of colors in this texture
- */
- for (k = 0; k < color_count; k++)
- if (c == colors[k]) break;
- if (k == color_count) {
- /*
- * This is a new color, so add it to the list
- */
- color_count++;
- /*
- * More than 256 and we fail (8-bit)
- */
- if (color_count > psize) {
- color_count--;
- k = color_count - 1;
- //goto burst_colors;
- }
- colors[k] = c;
- }
- /*
- * Set the "pixel" value on the surface to be the index into the
- * color table
- */
- if (psize == 16) {
- if ((i & 1) == 0)
- *lpC = k & 0xf;
- else {
- *lpC |= (k & 0xf) << 4;
- lpC++;
- }
- } else {
- *lpC = (char)k;
- lpC++;
- }
- }
- }
- /*
- * Close the file and unlock the surface
- */
- fclose(fp);
- lpDDS->lpVtbl->Unlock(lpDDS, NULL);
-
-//burst_colors:
- if (color_count > psize) {
- /*
- * If there are more than 256 colors, we overran our palette
- */
- lpDDS->lpVtbl->Unlock(lpDDS, NULL);
- lpDDS->lpVtbl->Release(lpDDS);
- D3DAppISetErrorString("Palette burst. (loadtex).\n");
- return (NULL);
- }
-
- /*
- * Create a palette with the colors in our color table
- */
- memset(ppe, 0, sizeof(PALETTEENTRY) * 256);
- for (i = 0; i < color_count; i++) {
- ppe[i].peRed = (unsigned char)RGB_GETRED(colors[i]);
- ppe[i].peGreen = (unsigned char)RGB_GETGREEN(colors[i]);
- ppe[i].peBlue = (unsigned char)RGB_GETBLUE(colors[i]);
- }
- /*
- * Set all remaining entry flags to D3DPAL_RESERVED, which are ignored by
- * the renderer.
- */
- for (; i < 256; i++)
- ppe[i].peFlags = D3DPAL_RESERVED;
- /*
- * Create the palette with the DDPCAPS_ALLOW256 flag because we want to
- * have access to all entries.
- */
- ddrval = lpDD->lpVtbl->CreatePalette(lpDD,
- DDPCAPS_INITIALIZE | pcaps,
- ppe, &lpDDPal, NULL);
- if (ddrval != DD_OK) {
- lpDDS->lpVtbl->Release(lpDDS);
- D3DAppISetErrorString("Create palette failed while loading surface (loadtex).\n%s",
- D3DAppErrorToString(ddrval));
- return (NULL);
- }
- /*
- * Finally, bind the palette to the surface
- */
- ddrval = lpDDS->lpVtbl->SetPalette(lpDDS, lpDDPal);
- if (ddrval != DD_OK) {
- lpDDS->lpVtbl->Release(lpDDS);
- lpDDPal->lpVtbl->Release(lpDDPal);
- D3DAppISetErrorString("SetPalette failed while loading surface (loadtex).\n%s",
- D3DAppErrorToString(ddrval));
- return (NULL);
- }
-
- lpDDPal->lpVtbl->Release(lpDDPal);
-
- return lpDDS;
-}
diff --git a/src/win95/iff.hpp b/src/win95/iff.hpp
index 103ddb0..42de667 100644
--- a/src/win95/iff.hpp
+++ b/src/win95/iff.hpp
@@ -243,7 +243,7 @@ namespace IFF
{
public:
virtual ~SerialData();
- SerialData() : m_pPrev(NULL), m_pData(new DataBlock) {};
+ SerialData() : m_pData(new DataBlock), m_pPrev(NULL) {};
void Clear();
diff --git a/src/win95/ltchunk.hpp b/src/win95/ltchunk.hpp
index 2ed6b78..8fee87b 100644
--- a/src/win95/ltchunk.hpp
+++ b/src/win95/ltchunk.hpp
@@ -161,7 +161,7 @@ class Placed_Object_Light_Chunk : public Chunk
{
public :
Placed_Object_Light_Chunk (Chunk_With_Children * parent, Placed_Object_Light_Data & new_light)
- : Chunk (parent, "PLOBJLIT"), light (new_light),num_extra_data(0),extra_data(0) {}
+ : Chunk (parent, "PLOBJLIT"), light(new_light), extra_data(0), num_extra_data(0) {}
Placed_Object_Light_Chunk (Chunk_With_Children * parent, const char *, size_t const);
diff --git a/src/win95/media.cpp b/src/win95/media.cpp
index c039026..8243217 100644
--- a/src/win95/media.cpp
+++ b/src/win95/media.cpp
@@ -81,7 +81,7 @@ void const * MediaWinFileMedium::GetReadBuffer(unsigned * pSize, unsigned nDesir
DWORD nBytesRead = 0;
- if (!ReadFile(m_hFile, m_pBuffer, nDesiredSize, &nBytesRead, NULL))
+ if (!ReadFile(m_hFile, m_pBuffer, nDesiredSize, &nBytesRead, 0))
m_fError |= MME_IOERROR;
else if (!nBytesRead)
m_fError |= MME_EOFMET;
@@ -102,7 +102,7 @@ void MediaWinFileMedium::CloseWriteBuffer(unsigned nPosOffset)
DWORD nBytesWritten = 0;
- if (!WriteFile(m_hFile, m_pBuffer, nPosOffset, &nBytesWritten, NULL))
+ if (!WriteFile(m_hFile, m_pBuffer, nPosOffset, &nBytesWritten, 0))
m_fError |= MME_IOERROR;
else if (nBytesWritten < nPosOffset)
m_fError |= MME_EOFMET;
@@ -119,7 +119,7 @@ void MediaWinFileMedium::CloseReadBuffer(unsigned nPosOffset)
return;
}
- if (nPosOffset != m_nReadBufLen && 0xffffffff == SetFilePointer(m_hFile,nPosOffset - m_nReadBufLen,NULL,FILE_CURRENT))
+ if (nPosOffset != m_nReadBufLen && 0xffffffff == SetFilePointer(m_hFile,nPosOffset - m_nReadBufLen,0,FILE_CURRENT))
m_fError |= MME_UNAVAIL;
m_nReadBufLen = 0;
@@ -137,7 +137,7 @@ void MediaWinFileMedium::DoWriteBlock(void const * pData, unsigned nSize)
DWORD nBytesWritten = 0;
- if (!WriteFile(m_hFile, pData, nSize, &nBytesWritten, NULL))
+ if (!WriteFile(m_hFile, pData, nSize, &nBytesWritten, 0))
m_fError |= MME_IOERROR;
else if (nBytesWritten < nSize)
m_fError |= MME_EOFMET;
@@ -153,7 +153,7 @@ void MediaWinFileMedium::DoReadBlock(void * pData, unsigned nSize)
DWORD nBytesRead = 0;
- if (!ReadFile(m_hFile, pData, nSize, &nBytesRead, NULL))
+ if (!ReadFile(m_hFile, pData, nSize, &nBytesRead, 0))
m_fError |= MME_IOERROR;
else if (nBytesRead < nSize)
m_fError |= MME_EOFMET;
@@ -161,7 +161,7 @@ void MediaWinFileMedium::DoReadBlock(void * pData, unsigned nSize)
unsigned MediaWinFileMedium::DoGetPos()
{
- unsigned nFilePos = SetFilePointer(m_hFile,0,NULL,FILE_CURRENT);
+ unsigned nFilePos = SetFilePointer(m_hFile,0,0,FILE_CURRENT);
if (0xffffffff == nFilePos)
{
@@ -174,7 +174,7 @@ unsigned MediaWinFileMedium::DoGetPos()
void MediaWinFileMedium::DoSetPos(unsigned nPos)
{
- if (0xffffffff == SetFilePointer(m_hFile,nPos,NULL,FILE_BEGIN))
+ if (0xffffffff == SetFilePointer(m_hFile,nPos,0,FILE_BEGIN))
m_fError |= MME_UNAVAIL;
}
diff --git a/src/win95/media.hpp b/src/win95/media.hpp
index 533a8b3..337c790 100644
--- a/src/win95/media.hpp
+++ b/src/win95/media.hpp
@@ -37,11 +37,17 @@ class MediaMedium
{
protected:
// standard constructor
- MediaMedium() : m_nRefCnt(1),
- m_fError(0), m_nDefBufSize(1024),
- m_nWriteBufPos(0), m_nReadBufPos(0),
- m_nBufLenUsed(0), m_nBufSize(0),
- m_pReadBuffer(NULL), m_pWriteBuffer(NULL) {}
+ MediaMedium() :
+ m_fError(0),
+ m_nDefBufSize(1024),
+ m_pWriteBuffer(NULL),
+ m_pReadBuffer(NULL),
+ m_nReadBufPos(0),
+ m_nWriteBufPos(0),
+ m_nBufSize(0),
+ m_nBufLenUsed(0),
+ m_nRefCnt(1)
+ {}
virtual ~MediaMedium() {}
@@ -413,10 +419,10 @@ class MediaWinFileMedium : public MediaMedium
pszFileName,
dwDesiredAccess,
dwShareMode,
- NULL,
+ 0,
dwCreationDistribution,
FILE_ATTRIBUTE_NORMAL,
- NULL
+ 0
);
if (INVALID_HANDLE_VALUE == m_hFile)
m_fError |= MME_OPENFAIL;
diff --git a/src/win95/mishchnk.cpp b/src/win95/mishchnk.cpp
index b463028..f455f07 100644
--- a/src/win95/mishchnk.cpp
+++ b/src/win95/mishchnk.cpp
@@ -388,7 +388,7 @@ File_Chunk::File_Chunk(const char * file_name)
return;
}
- file_size = GetFileSize (rif_file, NULL);
+ file_size = GetFileSize (rif_file, 0);
if (!ReadFile(rif_file, id_buffer, 8, &bytes_read, 0)) {
@@ -1482,7 +1482,7 @@ void File_Chunk::list_objects(List<Object_Chunk *> * pList)
if (children)
while (child_ptr != NULL) {
- if (strncmp ("RBOBJECT", child_ptr->identifier, 8) == NULL)
+ if (strncmp ("RBOBJECT", child_ptr->identifier, 8) == 0)
{
assert (!child_ptr->r_u_miscellaneous());
pList->add_entry((Object_Chunk *)child_ptr);
@@ -1501,7 +1501,7 @@ void File_Chunk::list_shapes(List<Shape_Chunk *> * pList)
if (children)
while (child_ptr != NULL) {
- if (strncmp ("REBSHAPE", child_ptr->identifier, 8) == NULL)
+ if (strncmp ("REBSHAPE", child_ptr->identifier, 8) == 0)
{
assert (!child_ptr->r_u_miscellaneous());
pList->add_entry((Shape_Chunk *)child_ptr);
@@ -1519,7 +1519,7 @@ void File_Chunk::list_dummy_objects(List<Dummy_Object_Chunk *> * pList){
if (children)
while (child_ptr != NULL) {
- if (strncmp ("DUMMYOBJ", child_ptr->identifier, 8) == NULL)
+ if (strncmp ("DUMMYOBJ", child_ptr->identifier, 8) == 0)
{
assert (!child_ptr->r_u_miscellaneous());
pList->add_entry((Dummy_Object_Chunk *)child_ptr);
@@ -1536,7 +1536,7 @@ Environment_Data_Chunk * File_Chunk::get_env_data()
if (children)
while (child_ptr != NULL) {
- if (strncmp ("REBENVDT", child_ptr->identifier, 8) == NULL)
+ if (strncmp ("REBENVDT", child_ptr->identifier, 8) == 0)
{
assert (!child_ptr->r_u_miscellaneous());
e_list.add_entry((Environment_Data_Chunk *)child_ptr);
@@ -1776,7 +1776,7 @@ RIF_File_Chunk::RIF_File_Chunk (Chunk_With_Children * parent, const char * file_
return;
}
- file_size = GetFileSize (rif_file, NULL);
+ file_size = GetFileSize (rif_file, 0);
if (!ReadFile(rif_file, id_buffer, 8, &bytes_read, 0)) {
error_code = CHUNK_FAILED_ON_LOAD;
@@ -1943,7 +1943,7 @@ void RIF_File_Chunk::list_objects(List<Object_Chunk *> * pList)
if (children)
while (child_ptr != NULL) {
- if (strncmp ("RBOBJECT", child_ptr->identifier, 8) == NULL)
+ if (strncmp ("RBOBJECT", child_ptr->identifier, 8) == 0)
{
assert (!child_ptr->r_u_miscellaneous());
pList->add_entry((Object_Chunk *)child_ptr);
@@ -1961,7 +1961,7 @@ void RIF_File_Chunk::list_shapes(List<Shape_Chunk *> * pList)
if (children)
while (child_ptr != NULL) {
- if (strncmp ("REBSHAPE", child_ptr->identifier, 8) == NULL)
+ if (strncmp ("REBSHAPE", child_ptr->identifier, 8) == 0)
{
assert (!child_ptr->r_u_miscellaneous());
pList->add_entry((Shape_Chunk *)child_ptr);
@@ -1978,7 +1978,7 @@ Environment_Data_Chunk * RIF_File_Chunk::get_env_data()
if (children)
while (child_ptr != NULL) {
- if (strncmp ("REBENVDT", child_ptr->identifier, 8) == NULL)
+ if (strncmp ("REBENVDT", child_ptr->identifier, 8) == 0)
{
assert (!child_ptr->r_u_miscellaneous());
e_list.add_entry((Environment_Data_Chunk *)child_ptr);
diff --git a/src/win95/mishchnk.hpp b/src/win95/mishchnk.hpp
index 957398e..411e49c 100644
--- a/src/win95/mishchnk.hpp
+++ b/src/win95/mishchnk.hpp
@@ -39,8 +39,9 @@ public:
Lockable_Chunk_With_Children (Chunk_With_Children * parent, const char * identifier)
: Chunk_With_Children (parent, identifier),
- updated (FALSE),updated_outside (FALSE),local_lock (FALSE),external_lock(FALSE),
- output_chunk_for_process (FALSE), deleted (FALSE)
+ output_chunk_for_process(FALSE),
+ updated(FALSE), updated_outside(FALSE), local_lock(FALSE),
+ external_lock(FALSE), deleted(FALSE)
{}
diff --git a/src/win95/shpchunk.hpp b/src/win95/shpchunk.hpp
index 1529d19..accddf7 100644
--- a/src/win95/shpchunk.hpp
+++ b/src/win95/shpchunk.hpp
@@ -9,11 +9,11 @@
// shape flags
#define SHAPE_FLAG_PALETTISED 0x0000100
-#define SHAPE_FLAG_USEZSP 0x0000200
-#define SHAPE_FLAG_USEAUGZS 0x0000400
+#define SHAPE_FLAG_USEZSP 0x0000200
+#define SHAPE_FLAG_USEAUGZS 0x0000400
#define SHAPE_FLAG_USEAUGZSL 0x0000800
-#define SHAPE_FLAG_EXTERNALFILE 0x0001000
-#define SHAPE_FLAG_RECENTRED 0x0002000
+#define SHAPE_FLAG_EXTERNALFILE 0x0001000
+#define SHAPE_FLAG_RECENTRED 0x0002000
#define SHAPE_FLAG_UNSTABLEBOUND_ZPOS 0x00004000
@@ -23,7 +23,6 @@
#define SHAPE_FLAG_UNSTABLEBOUND_XPOS 0x00040000
#define SHAPE_FLAG_UNSTABLEBOUND_XNEG 0x00080000
-#define SHAPE_FLAG_PSX_SUBDIVIDE 0x80000000
//flags that need to be removed before being copied into the shapeheaders
#define ChunkInternalItemFlags 0x00000000
@@ -34,11 +33,6 @@ class Anim_Shape_Frame_Chunk;
class Console_Shape_Chunk;
// flags structure
-struct shape_flags
-{
- unsigned int locked : 1;
-// add more flags here as they are needed
-};
enum Console_Type
{
@@ -224,8 +218,8 @@ private:
// constructor from data
Shape_Sub_Shape_Header_Chunk (Shape_Sub_Shape_Chunk * parent)
: Chunk (parent, "SUBSHPHD"),
- shape_data (parent->shape_data_store),
- flags (0), file_id_num (-1)
+ shape_data(parent->shape_data_store),
+ file_id_num(-1), flags(0)
{}
};
@@ -621,8 +615,8 @@ private:
// constructor from data
Shape_Header_Chunk (Shape_Chunk * parent)
: Chunk (parent, "SHPHEAD1"),
- shape_data (parent->shape_data_store),
- flags (0), file_id_num (-1), version_no (0)
+ shape_data(parent->shape_data_store),
+ flags(0), version_no(0), file_id_num(-1)
{}
};
@@ -887,8 +881,9 @@ public:
// constructor from wherever
Shape_Morphing_Frame_Data_Chunk (Shape_Morphing_Data_Chunk * parent)
- : Chunk (parent, "FRMMORPH"), frame_store (0), num_frames(0)
+ : Chunk (parent, "FRMMORPH"), num_frames(0), frame_store(0)
{}
+
// constructor from buffer
Shape_Morphing_Frame_Data_Chunk (Shape_Morphing_Data_Chunk * parent,const char *, size_t);
@@ -925,7 +920,7 @@ class Shape_Poly_Change_Info_Chunk : public Chunk
public:
Shape_Poly_Change_Info_Chunk (Shape_Chunk * parent, List<poly_change_info> & pci, int orig_num_v)
- : Chunk (parent, "SHPPCINF"), change_list (pci), original_num_verts (orig_num_v)
+ : Chunk (parent, "SHPPCINF"), original_num_verts (orig_num_v), change_list (pci)
{}
int original_num_verts;
diff --git a/src/win95/sprchunk.cpp b/src/win95/sprchunk.cpp
index 4f718d2..2b78f40 100644
--- a/src/win95/sprchunk.cpp
+++ b/src/win95/sprchunk.cpp
@@ -204,7 +204,7 @@ Sprite_Header_Chunk::Sprite_Header_Chunk(const char * file_name, Chunk_With_Chil
return;
}
- file_size = GetFileSize (rif_file, NULL);
+ file_size = GetFileSize (rif_file, 0);
if (!ReadFile(rif_file, id_buffer, 8, &bytes_read, 0)) {
diff --git a/src/win95/zbuffer.c b/src/win95/zbuffer.c
deleted file mode 100644
index b33ea85..0000000
--- a/src/win95/zbuffer.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/***************************************************************************/
-/* Creation of Z-Buffer */
-/***************************************************************************/
-/*
- * D3DAppICreateZBuffer
- * Create a Z-Buffer of the appropriate depth and attach it to the back
- * buffer.
- */
-BOOL
-D3DAppICreateZBuffer(int w, int h, int driver)
-{
- DDSURFACEDESC ddsd;
- DWORD devDepth;
- /*
- * Release any Z-Buffer that might be around just in case.
- */
- RELEASE(d3dappi.lpZBuffer);
-
- /*
- * If this driver does not do z-buffering, don't create a z-buffer
- */
- if (!d3dappi.Driver[driver].bDoesZBuffer)
- return TRUE;
-
- memset(&ddsd, 0 ,sizeof(DDSURFACEDESC));
- ddsd.dwSize = sizeof( ddsd );
- ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS |
- DDSD_ZBUFFERBITDEPTH;
- ddsd.ddsCaps.dwCaps = DDSCAPS_ZBUFFER;
- ddsd.dwHeight = h;
- ddsd.dwWidth = w;
- /*
- * If this is a hardware D3D driver, the Z-Buffer MUST end up in video
- * memory. Otherwise, it MUST end up in system memory.
- */
- if (d3dappi.Driver[driver].bIsHardware)
- ddsd.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
- else
- ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
- /*
- * Get the Z buffer bit depth from this driver's D3D device description
- */
- devDepth = d3dappi.Driver[driver].Desc.dwDeviceZBufferBitDepth;
- if (devDepth & DDBD_32)
- ddsd.dwZBufferBitDepth = 32;
- else if (devDepth & DDBD_24)
- ddsd.dwZBufferBitDepth = 24;
- else if (devDepth & DDBD_16)
- ddsd.dwZBufferBitDepth = 16;
- else if (devDepth & DDBD_8)
- ddsd.dwZBufferBitDepth = 8;
- else {
- D3DAppISetErrorString("Unsupported Z-buffer depth requested by device.\n");
- return FALSE;
- }
- LastError = d3dappi.lpDD->lpVtbl->CreateSurface(d3dappi.lpDD, &ddsd,
- &d3dappi.lpZBuffer,
- NULL);
- if(LastError != DD_OK) {
- D3DAppISetErrorString("CreateSurface for Z-buffer failed.\n%s",
- D3DAppErrorToString(LastError));
- goto exit_with_error;
- }
- /*
- * Attach the Z-buffer to the back buffer so D3D will find it
- */
- LastError =
- d3dappi.lpBackBuffer->lpVtbl->AddAttachedSurface(d3dappi.lpBackBuffer,
- d3dappi.lpZBuffer);
- if(LastError != DD_OK) {
- D3DAppISetErrorString("AddAttachedBuffer failed for Z-Buffer.\n%s",
- D3DAppErrorToString(LastError));
- goto exit_with_error;
- }
- /*
- * Find out if it ended up in video memory (FYI).
- */
- LastError = D3DAppIGetSurfDesc(&ddsd, d3dappi.lpZBuffer);
- if (LastError != DD_OK) {
- D3DAppISetErrorString("Failed to get surface description of Z buffer.\n%s",
- D3DAppErrorToString(LastError));
- goto exit_with_error;
- }
- d3dappi.bZBufferInVideo =
- (ddsd.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) ? TRUE : FALSE;
- return TRUE;
-
-exit_with_error:
- RELEASE(d3dappi.lpZBuffer);
- return FALSE;
-}