From c26386c11222729f3f691314b505b050fab7f21e Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Sat, 2 Jan 2021 21:54:40 +0100 Subject: [PATCH] Fix some warnings on gcc/clang --- src/base.cpp | 2 +- src/bmp.cpp | 2 +- src/d3d/d3d.cpp | 4 +-- src/d3d/xbox.cpp | 4 +-- src/engine.cpp | 3 +- src/geometry.cpp | 2 +- src/hanim.cpp | 2 +- src/image.cpp | 2 +- src/matfx.cpp | 2 +- src/png.cpp | 2 +- src/ps2/ps2.cpp | 14 ++++---- src/ps2/ps2raster.cpp | 78 +++++++++++++++++++++---------------------- src/raster.cpp | 14 ++++---- src/rwbase.h | 2 +- src/skin.cpp | 2 +- src/tristrip.cpp | 6 ++-- 16 files changed, 72 insertions(+), 69 deletions(-) diff --git a/src/base.cpp b/src/base.cpp index 6bc391a..fae47da 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -665,7 +665,7 @@ correctPathCase(char *filename) sofar[2] = '\0'; arg++; } - while(dir = strtok(arg, PSEP_S)){ + while((dir = strtok(arg, PSEP_S))){ arg = nil; if(direct = opendir(sofar), dir == nil) return; diff --git a/src/bmp.cpp b/src/bmp.cpp index 6f9f8c7..f69e58d 100644 --- a/src/bmp.cpp +++ b/src/bmp.cpp @@ -247,7 +247,7 @@ writeBMP(Image *image, const char *filename) for(int x = 0; x < image->width; x++){ switch(image->depth){ case 4: - file.writeU8((p[0]&0xF)<<4 | p[1]&0xF); + file.writeU8((p[0]&0xF)<<4 | (p[1]&0xF)); p += 2; x++; break; diff --git a/src/d3d/d3d.cpp b/src/d3d/d3d.cpp index 73100d5..3063a9c 100644 --- a/src/d3d/d3d.cpp +++ b/src/d3d/d3d.cpp @@ -278,7 +278,7 @@ struct RasterFormatInfo // indexed directly by RW format static RasterFormatInfo formatInfoRW[16] = { - { 0, 0, 0}, + { 0, 0, 0, 0}, { D3DFMT_A1R5G5B5, 16, 1, Raster::C1555 }, { D3DFMT_R5G6B5, 16, 0, Raster::C565 }, { D3DFMT_A4R4G4B4, 16, 1, Raster::C4444 }, @@ -345,7 +345,7 @@ findFormatInfoD3D(uint32 d3dformat) { static RasterFormatInfo fake = { 0, 0, 0, 0 }; int i; - for(i = 0; i < nelem(formatInfoFull); i++) + for(i = 0; i < (int)nelem(formatInfoFull); i++) if(formatInfoFull[i].d3dformat == d3dformat) return &formatInfoFull[i]; return &fake; diff --git a/src/d3d/xbox.cpp b/src/d3d/xbox.cpp index 83327ba..c73319e 100644 --- a/src/d3d/xbox.cpp +++ b/src/d3d/xbox.cpp @@ -532,7 +532,7 @@ struct RasterFormatInfo // indexed directly by RW format static RasterFormatInfo formatInfoRW[16] = { - { 0, 0, 0}, + { 0, 0, 0, 0}, { D3DFMT_A1R5G5B5, 16, 1, Raster::C1555 }, { D3DFMT_R5G6B5, 16, 0, Raster::C565 }, { D3DFMT_A4R4G4B4, 16, 1, Raster::C4444 }, @@ -789,7 +789,7 @@ rasterToImage(Raster *raster) uint8 *pixels = raster->pixels; // NB: - assert(image->bpp == natras->bpp); + assert(image->bpp == (int)natras->bpp); assert(image->stride == raster->stride); unswizzle(imgpixels, pixels, image->width, image->height, image->bpp); // Fix RGB order diff --git a/src/engine.cpp b/src/engine.cpp index 58e3e1c..181a2e8 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -130,7 +130,7 @@ printleaks(void) { FORLIST(lnk, allocations){ MemoryBlock *mem = LLLinkGetData(lnk, MemoryBlock, inAllocList); - printf("sz %d hint %X\n %s\n", mem->sz, mem->hint, mem->codeline); + printf("sz %zu hint %X\n %s\n", mem->sz, mem->hint, mem->codeline); } } @@ -527,6 +527,7 @@ deviceSystem(DeviceReq req, void *arg0, int32 n) return 0; case DEVICEGETSUBSSYSTEMINFO: return 0; + default: break; } return 1; } diff --git a/src/geometry.cpp b/src/geometry.cpp index 2fd254e..5d31c34 100644 --- a/src/geometry.cpp +++ b/src/geometry.cpp @@ -472,7 +472,7 @@ Geometry::generateTriangles(int8 *adc) int32 matid = this->matList.findIndex(m->material); if(header->flags == MeshHeader::TRISTRIP) for(uint32 j = 0; j < m->numIndices-2; j++){ - if(adc && adcbits[j+2] || + if((adc && adcbits[j+2]) || isDegenerate(&m->indices[j])) continue; tri->v[0] = m->indices[j+0]; diff --git a/src/hanim.cpp b/src/hanim.cpp index 3f1ecb6..966c4be 100644 --- a/src/hanim.cpp +++ b/src/hanim.cpp @@ -307,7 +307,7 @@ getSizeHAnim(void *object, int32 offset, int32) { HAnimData *hanim = PLUGINOFFSET(HAnimData, object, offset); if(!hAnimDoStream || - version >= 0x35000 && hanim->id == -1 && hanim->hierarchy == nil) + (version >= 0x35000 && hanim->id == -1 && hanim->hierarchy == nil)) return 0; if(hanim->hierarchy) return 12 + 8 + hanim->hierarchy->numNodes*12; diff --git a/src/image.cpp b/src/image.cpp index 8132ddf..32fed94 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -1036,7 +1036,7 @@ bool32 Image::registerFileFormat(const char *ext, fileRead read, fileWrite write) { ImageGlobals *g = PLUGINOFFSET(ImageGlobals, engine, imageModuleOffset); - if(g->numFileFormats >= nelem(g->fileFormats)) + if(g->numFileFormats >= (int)nelem(g->fileFormats)) return 0; g->fileFormats[g->numFileFormats].extension = rwstrdup(ext); g->fileFormats[g->numFileFormats].read = read; diff --git a/src/matfx.cpp b/src/matfx.cpp index 3227d09..f86b9a7 100644 --- a/src/matfx.cpp +++ b/src/matfx.cpp @@ -69,7 +69,7 @@ getSizeAtomicMatFX(void *object, int32 offset, int32) // Material -MatFXGlobals matFXGlobals = { 0, 0, { nil } }; +MatFXGlobals matFXGlobals = { 0, 0, { nil }, nil }; // TODO: Frames and Matrices? static void diff --git a/src/png.cpp b/src/png.cpp index 5749a32..aad44b9 100644 --- a/src/png.cpp +++ b/src/png.cpp @@ -25,7 +25,7 @@ namespace rw { Image* readPNG(const char *filename) { - Image *image; + Image *image = nil; uint32 length; uint8 *data = getFileContents(filename, &length); assert(data != nil); diff --git a/src/ps2/ps2.cpp b/src/ps2/ps2.cpp index dbbcd0a..bd0f54b 100644 --- a/src/ps2/ps2.cpp +++ b/src/ps2/ps2.cpp @@ -588,13 +588,14 @@ getInstMeshInfo(MatPipeline *pipe, Geometry *g, Mesh *m) im.numBrokenAttribs = 0; im.vertexSize = 0; for(uint i = 0; i < nelem(pipe->attribs); i++) - if(a = pipe->attribs[i]) + if((a = pipe->attribs[i])) { if(a->attrib & AT_RW) im.numBrokenAttribs++; else{ im.vertexSize += attribSize(a->attrib); im.numAttribs++; } + } if(g->meshHeader->flags == MeshHeader::TRISTRIP){ im.numBatches = (m->numIndices-2) / (pipe->triStripCount-2); im.batchVertCount = pipe->triStripCount; @@ -758,13 +759,14 @@ MatPipeline::collectData(Geometry *g, InstanceData *inst, Mesh *m, uint8 *data[] uint8 *raw = rwNewT(uint8, im.vertexSize*m->numIndices, MEMDUR_EVENT | ID_GEOMETRY); uint8 *dp = raw; for(uint i = 0; i < nelem(this->attribs); i++) - if(a = this->attribs[i]) + if((a = this->attribs[i])) { if(a->attrib & AT_RW){ data[i] = inst->data + im.attribPos[i]*0x10; }else{ data[i] = dp; dp += m->numIndices*attribSize(a->attrib); } + } uint8 *datap[nelem(this->attribs)]; memcpy(datap, data, sizeof(datap)); @@ -965,8 +967,8 @@ void genericPreCB(MatPipeline *pipe, Geometry *geo) { PipeAttribute *a; - for(int32 i = 0; i < nelem(pipe->attribs); i++) - if(a = pipe->attribs[i]) + for(int32 i = 0; i < (int)nelem(pipe->attribs); i++) + if((a = pipe->attribs[i])) if(a == &attribXYZW){ allocateADC(geo); break; @@ -988,8 +990,8 @@ genericUninstanceCB(MatPipeline *pipe, Geometry *geo, uint32 flags[], Mesh *mesh skin = Skin::get(geo); PipeAttribute *a; - for(int32 i = 0; i < nelem(pipe->attribs); i++) - if(a = pipe->attribs[i]){ + for(int32 i = 0; i < (int)nelem(pipe->attribs); i++) + if((a = pipe->attribs[i])){ if(a == &attribXYZ) xyz = (float32*)data[i]; else if(a == &attribXYZW) xyzw = (float32*)data[i]; else if(a == &attribUV) uv = (float32*)data[i]; diff --git a/src/ps2/ps2raster.cpp b/src/ps2/ps2raster.cpp index 68e8165..5776fda 100644 --- a/src/ps2/ps2raster.cpp +++ b/src/ps2/ps2raster.cpp @@ -129,8 +129,8 @@ getRasterFormat(Raster *raster) } raster->depth = cameraZDepth; if(pixelformat){ - if(raster->depth == 16 && pixelformat != Raster::D16 || - raster->depth == 32 && pixelformat != Raster::D32){ + if((raster->depth == 16 && pixelformat != Raster::D16) || + (raster->depth == 32 && pixelformat != Raster::D32)){ RWERROR((ERR_INVRASTER)); return 0; } @@ -668,29 +668,29 @@ calcOffsets(int32 width_Px, int32 height_Px, int32 psm, uint64 *bufferBase_B, ui case PSMT4HL: case PSMT4HH: // ABCDE -> CADBE - bufferBase_B[n] = bufferBase_B[n]&~0x1F | (uint64)blockmap_PSMCT32[bufferBase_B[n]&0x1F]; + bufferBase_B[n] = (bufferBase_B[n]&~0x1F) | (uint64)blockmap_PSMCT32[bufferBase_B[n]&0x1F]; break; case PSMT4: case PSMCT16: // ABCDE -> ADBEC - bufferBase_B[n] = bufferBase_B[n]&~0x1F | (uint64)blockmap_PSMCT16[bufferBase_B[n]&0x1F]; + bufferBase_B[n] = (bufferBase_B[n]&~0x1F) | (uint64)blockmap_PSMCT16[bufferBase_B[n]&0x1F]; break; case PSMCT16S: // ABCDE -> DBAEC - bufferBase_B[n] = bufferBase_B[n]&~0x1F | (uint64)blockmap_PSMCT16S[bufferBase_B[n]&0x1F]; + bufferBase_B[n] = (bufferBase_B[n]&~0x1F) | (uint64)blockmap_PSMCT16S[bufferBase_B[n]&0x1F]; break; case PSMZ32: case PSMZ24: // ABCDE -> ~C~ADBE - bufferBase_B[n] = bufferBase_B[n]&~0x1F | (uint64)blockmap_PSMZ32[bufferBase_B[n]&0x1F]; + bufferBase_B[n] = (bufferBase_B[n]&~0x1F) | (uint64)blockmap_PSMZ32[bufferBase_B[n]&0x1F]; break; case PSMZ16: // ABCDE -> ~A~DBEC - bufferBase_B[n] = bufferBase_B[n]&~0x1F | (uint64)blockmap_PSMZ16[bufferBase_B[n]&0x1F]; + bufferBase_B[n] = (bufferBase_B[n]&~0x1F) | (uint64)blockmap_PSMZ16[bufferBase_B[n]&0x1F]; break; case PSMZ16S: // ABCDE -> ~D~BAEC - bufferBase_B[n] = bufferBase_B[n]&~0x1F | (uint64)blockmap_PSMZ16S[bufferBase_B[n]&0x1F]; + bufferBase_B[n] = (bufferBase_B[n]&~0x1F) | (uint64)blockmap_PSMZ16S[bufferBase_B[n]&0x1F]; break; default: break; } @@ -712,24 +712,24 @@ calcOffsets(int32 width_Px, int32 height_Px, int32 psm, uint64 *bufferBase_B, ui case PSMT8H: case PSMT4HL: case PSMT4HH: - paletteBase_B = paletteBase_B&~0x1F | (uint64)blockmap_PSMCT32[paletteBase_B&0x1F]; + paletteBase_B = (paletteBase_B&~0x1F) | (uint64)blockmap_PSMCT32[paletteBase_B&0x1F]; break; case PSMT4: case PSMCT16: - paletteBase_B = paletteBase_B&~0x1F | (uint64)blockmap_PSMCT16[paletteBase_B&0x1F]; + paletteBase_B = (paletteBase_B&~0x1F) | (uint64)blockmap_PSMCT16[paletteBase_B&0x1F]; break; case PSMCT16S: - paletteBase_B = paletteBase_B&~0x1F | (uint64)blockmap_PSMCT16S[paletteBase_B&0x1F]; + paletteBase_B = (paletteBase_B&~0x1F) | (uint64)blockmap_PSMCT16S[paletteBase_B&0x1F]; break; case PSMZ32: case PSMZ24: - paletteBase_B = paletteBase_B&~0x1F | (uint64)blockmap_PSMZ32[paletteBase_B&0x1F]; + paletteBase_B = (paletteBase_B&~0x1F) | (uint64)blockmap_PSMZ32[paletteBase_B&0x1F]; break; case PSMZ16: - paletteBase_B = paletteBase_B&~0x1F | (uint64)blockmap_PSMZ16[paletteBase_B&0x1F]; + paletteBase_B = (paletteBase_B&~0x1F) | (uint64)blockmap_PSMZ16[paletteBase_B&0x1F]; break; case PSMZ16S: - paletteBase_B = paletteBase_B&~0x1F | (uint64)blockmap_PSMZ16S[paletteBase_B&0x1F]; + paletteBase_B = (paletteBase_B&~0x1F) | (uint64)blockmap_PSMZ16S[paletteBase_B&0x1F]; break; default: break; } @@ -915,8 +915,8 @@ rasterCreateTexture(Raster *raster) // If buffer width changes, align next address to page if(bufferWidth[n] != lastBufferWidth){ - nPagW = ((width >> n-1) + pageWidth-1)/pageWidth; - nPagH = ((height >> n-1) + pageHeight-1)/pageHeight; + nPagW = ((width >> (n-1)) + pageWidth-1)/pageWidth; + nPagH = ((height >> (n-1)) + pageHeight-1)/pageHeight; nextaddress = (lastaddress + nPagW*nPagH*WD2PG) & ~(WD2PG-1); } lastBufferWidth = bufferWidth[n]; @@ -1052,8 +1052,8 @@ rasterCreateTexture(Raster *raster) ras->flags |= Ps2Raster::SWIZZLED8; if(cpsm == PSMCT32 && bufferWidth[numLevels-1] == 2){ // one page // unswizzle the starting block of the last buffer and palette - uint32 bufbase_B = bufferBase[numLevels-1]&~0x1F | (uint64)blockmaprev_PSMCT32[bufferBase[numLevels-1]&0x1F]; - uint32 palbase_B = ras->paletteBase&~0x1F | (uint64)blockmaprev_PSMCT32[ras->paletteBase&0x1F]; + uint32 bufbase_B = (bufferBase[numLevels-1]&~0x1F) | (uint64)blockmaprev_PSMCT32[bufferBase[numLevels-1]&0x1F]; + uint32 palbase_B = (ras->paletteBase&~0x1F) | (uint64)blockmaprev_PSMCT32[ras->paletteBase&0x1F]; // find start of page of last level (16,16 are PSMT8 block dimensions) uint32 page_B = bufbase_B - 8*(dsay/16) - dsax/16; // find palette DSAX/Y (in PSMCT32!) @@ -1072,8 +1072,8 @@ rasterCreateTexture(Raster *raster) // Looks like they wanted to swizzle palettes too... if(cpsm == PSMCT16){ // unswizzle the starting block of the last buffer and palette - uint32 bufbase_B = bufferBase[numLevels-1]&~0x1F | (uint64)blockmaprev_PSMCT16[bufferBase[numLevels-1]&0x1F]; - uint32 palbase_B = ras->paletteBase&~0x1F | (uint64)blockmaprev_PSMCT16[ras->paletteBase&0x1F]; + uint32 bufbase_B = (bufferBase[numLevels-1]&~0x1F) | (uint64)blockmaprev_PSMCT16[bufferBase[numLevels-1]&0x1F]; + uint32 palbase_B = (ras->paletteBase&~0x1F) | (uint64)blockmaprev_PSMCT16[ras->paletteBase&0x1F]; // find start of page of last level (32,16 are PSMT4 block dimensions) uint32 page_B = bufbase_B - 4*(dsay/32) - dsax/16; // find palette DSAX/Y (in PSMCT16!) @@ -1149,8 +1149,8 @@ rasterCreateTexture(Raster *raster) *p++ = 0; // TRXPOS - if(ras->flags & Ps2Raster::SWIZZLED8 && psm == PSMT8 || - ras->flags & Ps2Raster::SWIZZLED4 && psm == PSMT4){ + if((ras->flags & Ps2Raster::SWIZZLED8 && psm == PSMT8) || + (ras->flags & Ps2Raster::SWIZZLED4 && psm == PSMT4)){ *p++ = 0; // SSAX/Y is always 0 *p++ = (trxpos_hi[n] & ~0x10001)/2; // divide both DSAX/Y by 2 }else{ @@ -1161,8 +1161,8 @@ rasterCreateTexture(Raster *raster) *p++ = 0; // TRXREG - if(ras->flags & Ps2Raster::SWIZZLED8 && psm == PSMT8 || - ras->flags & Ps2Raster::SWIZZLED4 && psm == PSMT4){ + if((ras->flags & Ps2Raster::SWIZZLED8 && psm == PSMT8) || + (ras->flags & Ps2Raster::SWIZZLED4 && psm == PSMT4)){ *p++ = mipw/2; *p++ = miph/2; }else{ @@ -1361,10 +1361,10 @@ swizzle(uint32 x, uint32 y, uint32 logw) uint32 nx, ny, n; x ^= (Y(1)^Y(2))<<2; - nx = x&7 | (x>>1)&~7; - ny = y&1 | (y>>1)&~1; + nx = (x&7) | ((x>>1)&~7); + ny = (y&1) | ((y>>1)&~1); n = Y(1) | X(3)<<1; - return n | nx<<2 | ny<pixels; logw = 0; for(i = 1; i < w; i *= 2) logw++; - mask = (1<format & Raster::PAL4 && natras->flags & Ps2Raster::SWIZZLED4){ for(y = 0; y < h; y += 4){ - memcpy(tmpbuf, &px[y<>1] >> 4 : tmpbuf[s>>1] & 0xF; - px[a>>1] = a & 1 ? px[a>>1]&0xF | c<<4 : px[a>>1]&0xF0 | c; + px[a>>1] = a & 1 ? (px[a>>1]&0xF) | c<<4 : (px[a>>1]&0xF0) | c; } } }else if(raster->format & Raster::PAL8 && natras->flags & Ps2Raster::SWIZZLED8){ @@ -1406,7 +1406,7 @@ unswizzleRaster(Raster *raster) memcpy(tmpbuf, &px[y<pixels; logw = 0; for(i = 1; i < raster->width; i *= 2) logw++; - mask = (1<format & Raster::PAL4 && natras->flags & Ps2Raster::SWIZZLED4){ for(y = 0; y < h; y += 4){ for(i = 0; i < 4; i++) for(x = 0; x < w; x++){ - uint32 a = (y+i<>1] >> 4 : px[a>>1] & 0xF; - tmpbuf[s>>1] = s & 1 ? tmpbuf[s>>1]&0xF | c<<4 : tmpbuf[s>>1]&0xF0 | c; + tmpbuf[s>>1] = s & 1 ? (tmpbuf[s>>1]&0xF) | c<<4 : (tmpbuf[s>>1]&0xF0) | c; } - memcpy(&px[y<format & Raster::PAL8 && natras->flags & Ps2Raster::SWIZZLED8){ for(y = 0; y < h; y += 4){ for(i = 0; i < 4; i++) for(x = 0; x < w; x++){ - uint32 a = (y+i<>= 14; uint32 tbw = tex0 & 0x3F; tex0 >>= 6; uint32 psm = tex0 & 0x3F; tex0 >>= 6; @@ -1924,7 +1924,7 @@ printTEX0(uint64 tex0) void printTEX1(uint64 tex1) { - printf("%016llX ", tex1); + printf("%016lX ", tex1); uint32 lcm = tex1 & 0x1; tex1 >>= 2; uint32 mxl = tex1 & 0x7; tex1 >>= 3; uint32 mmag = tex1 & 0x1; tex1 >>= 1; diff --git a/src/raster.cpp b/src/raster.cpp index fbce2e4..e9007a0 100644 --- a/src/raster.cpp +++ b/src/raster.cpp @@ -37,7 +37,7 @@ rasterOpen(void *object, int32 offset, int32 size) int i; rasterModuleOffset = offset; RASTERGLOBAL(sp) = -1; - for(i = 0; i < nelem(RASTERGLOBAL(stack)); i++) + for(i = 0; i < (int)nelem(RASTERGLOBAL(stack)); i++) RASTERGLOBAL(stack)[i] = nil; return object; } @@ -295,7 +295,7 @@ conv_RGBA5551_from_ARGB1555(uint8 *out, uint8 *in) uint32 r, g, b, a; a = (in[1]>>7) & 1; r = (in[1]>>2) & 0x1F; - g = (in[1]&3)<<3 | (in[0]>>5)&7; + g = (in[1]&3)<<3 | ((in[0]>>5)&7); b = in[0] & 0x1F; out[0] = a | b<<1 | g<<6; out[1] = g>>2 | r<<3; @@ -307,7 +307,7 @@ conv_RGBA8888_from_ARGB1555(uint8 *out, uint8 *in) uint32 r, g, b, a; a = (in[1]>>7) & 1; r = (in[1]>>2) & 0x1F; - g = (in[1]&3)<<3 | (in[0]>>5)&7; + g = (in[1]&3)<<3 | ((in[0]>>5)&7); b = in[0] & 0x1F; out[0] = r*0xFF/0x1f; out[1] = g*0xFF/0x1f; @@ -321,8 +321,8 @@ conv_ABGR1555_from_ARGB1555(uint8 *out, uint8 *in) uint32 r, b; r = (in[1]>>2) & 0x1F; b = in[0] & 0x1F; - out[1] = in[1]&0x83 | b<<2; - out[0] = in[0]&0xE0 | r; + out[1] = (in[1]&0x83) | b<<2; + out[0] = (in[0]&0xE0) | r; } void @@ -496,8 +496,8 @@ Raster::convertTexToCurrentPlatform(rw::Raster *ras) if(ras->platform == rw::platform) return ras; // compatible platforms - if(ras->platform == PLATFORM_D3D8 && rw::platform == PLATFORM_D3D9 || - ras->platform == PLATFORM_D3D9 && rw::platform == PLATFORM_D3D8) + if((ras->platform == PLATFORM_D3D8 && rw::platform == PLATFORM_D3D9) || + (ras->platform == PLATFORM_D3D9 && rw::platform == PLATFORM_D3D8)) return ras; // special cased conversion for DXT diff --git a/src/rwbase.h b/src/rwbase.h index 573269c..a65e4f1 100644 --- a/src/rwbase.h +++ b/src/rwbase.h @@ -305,7 +305,7 @@ struct RawMatrix V3d at; float32 atw; V3d pos; - float32 posw;; + float32 posw; static void mult(RawMatrix *dst, RawMatrix *src1, RawMatrix *src2); static void transpose(RawMatrix *dst, RawMatrix *src); diff --git a/src/skin.cpp b/src/skin.cpp index d2865e8..abaa548 100644 --- a/src/skin.cpp +++ b/src/skin.cpp @@ -24,7 +24,7 @@ namespace rw { -SkinGlobals skinGlobals = { 0, 0, { nil } }; +SkinGlobals skinGlobals = { 0, 0, { nil }, nil }; static void* createSkin(void *object, int32 offset, int32) diff --git a/src/tristrip.cpp b/src/tristrip.cpp index e71b844..bd9123f 100644 --- a/src/tristrip.cpp +++ b/src/tristrip.cpp @@ -655,9 +655,9 @@ trace("%d %d %d\n", a, b, c); for(k = 0; k < geo->numTriangles; k++){ t = &geo->triangles[k]; if(seen[k] || t->matId != m) continue; - if(t->v[0] == a && t->v[1] == b && t->v[2] == c || - t->v[1] == a && t->v[2] == b && t->v[0] == c || - t->v[2] == a && t->v[0] == b && t->v[1] == c){ + if((t->v[0] == a && t->v[1] == b && t->v[2] == c) || + (t->v[1] == a && t->v[2] == b && t->v[0] == c) || + (t->v[2] == a && t->v[0] == b && t->v[1] == c)){ seen[k] = 1; goto found; }