From 43db338a5ae1687510059ee58da2d35a2a44fab7 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Tue, 27 Dec 2016 15:33:47 +0100 Subject: [PATCH] [General] Fix compiler warnings --- .../Modules/AssetInterfaces/IFxEffectDef.cpp | 59 +++++++++---------- .../Modules/AssetInterfaces/IGameWorldSp.cpp | 1 + .../Modules/AssetInterfaces/IGfxWorld.cpp | 1 - src/Components/Modules/Materials.cpp | 2 + src/Components/Modules/ModelSurfs.cpp | 3 +- 5 files changed, 34 insertions(+), 32 deletions(-) diff --git a/src/Components/Modules/AssetInterfaces/IFxEffectDef.cpp b/src/Components/Modules/AssetInterfaces/IFxEffectDef.cpp index c894dede..8470546b 100644 --- a/src/Components/Modules/AssetInterfaces/IFxEffectDef.cpp +++ b/src/Components/Modules/AssetInterfaces/IFxEffectDef.cpp @@ -4,41 +4,40 @@ namespace Assets { void IFxEffectDef::load(Game::XAssetHeader* /*header*/, std::string name, Components::ZoneBuilder::Zone* /*builder*/) { - if (0) +#if 0 + Components::FileSystem::File rawFx(fmt::sprintf("fx/%s.efx", name.data())); + if (rawFx.exists()) { - Components::FileSystem::File rawFx(fmt::sprintf("fx/%s.efx", name.data())); - if (rawFx.exists()) + const char* session = rawFx.getBuffer().data(); + Game::Com_BeginParseSession("fx"); + Game::Com_SetSpaceDelimited(0); + Game::Com_SetParseNegativeNumbers(1); + + const char* format = Game::Com_Parse(&session); + if (format != "iwfx"s) { - const char* session = rawFx.getBuffer().data(); - Game::Com_BeginParseSession("fx"); - Game::Com_SetSpaceDelimited(0); - Game::Com_SetParseNegativeNumbers(1); - - const char* format = Game::Com_Parse(&session); - if (format != "iwfx"s) - { - Game::Com_EndParseSession(); - Components::Logger::Error("Effect needs to be updated from the legacy format.\n"); - } - - int version = atoi(Game::Com_Parse(&session)); - if (version > 2) - { - Game::Com_EndParseSession(); - Components::Logger::Error("Version %i is too high. I can only handle up to %i.\n", version, 2); - } - - Game::FxEditorEffectDef efx; - ZeroMemory(&efx, sizeof(efx)); - -// for (int i = 0; i < FX_ELEM_FIELD_COUNT; ++i) -// { -// Game::s_elemFields[i].handler(&session, efx.elems); -// } - Game::Com_EndParseSession(); + Components::Logger::Error("Effect needs to be updated from the legacy format.\n"); } + + int version = atoi(Game::Com_Parse(&session)); + if (version > 2) + { + Game::Com_EndParseSession(); + Components::Logger::Error("Version %i is too high. I can only handle up to %i.\n", version, 2); + } + + Game::FxEditorEffectDef efx; + ZeroMemory(&efx, sizeof(efx)); + +// for (int i = 0; i < FX_ELEM_FIELD_COUNT; ++i) +// { +// Game::s_elemFields[i].handler(&session, efx.elems); +// } + + Game::Com_EndParseSession(); } +#endif } void IFxEffectDef::markFxElemVisuals(Game::FxElemVisuals* visuals, char elemType, Components::ZoneBuilder::Zone* builder) diff --git a/src/Components/Modules/AssetInterfaces/IGameWorldSp.cpp b/src/Components/Modules/AssetInterfaces/IGameWorldSp.cpp index 944163be..1afb09cd 100644 --- a/src/Components/Modules/AssetInterfaces/IGameWorldSp.cpp +++ b/src/Components/Modules/AssetInterfaces/IGameWorldSp.cpp @@ -68,6 +68,7 @@ namespace Assets void IGameWorldSp::saveVehicleTrackSegment_ptrArray(Game::VehicleTrackSegment** trackSegmentPtrs, int count, Components::ZoneBuilder::Zone* builder) { Utils::Stream* buffer = builder->getBuffer(); + if (!trackSegmentPtrs) return; Game::VehicleTrackSegment** destTrackSegmentPtrs = buffer->dest(); buffer->saveArray(trackSegmentPtrs, count); diff --git a/src/Components/Modules/AssetInterfaces/IGfxWorld.cpp b/src/Components/Modules/AssetInterfaces/IGfxWorld.cpp index b0f6777d..75963d60 100644 --- a/src/Components/Modules/AssetInterfaces/IGfxWorld.cpp +++ b/src/Components/Modules/AssetInterfaces/IGfxWorld.cpp @@ -108,7 +108,6 @@ namespace Assets map->draw.vd.vertices[i].texCoord[0] = originalVerts[i % 3].texCoord[0]; map->draw.vd.vertices[i].texCoord[1] = originalVerts[i % 3].texCoord[1]; - map->draw.vd.vertices[i].texCoord[2] = originalVerts[i % 3].texCoord[2]; } for (int i = 0; i < 8; ++i) diff --git a/src/Components/Modules/Materials.cpp b/src/Components/Modules/Materials.cpp index d8cf988e..1b60ca5c 100644 --- a/src/Components/Modules/Materials.cpp +++ b/src/Components/Modules/Materials.cpp @@ -95,6 +95,7 @@ namespace Components int Materials::FormatImagePath(char* buffer, size_t size, int, int, const char* image) { +#if 0 if (Utils::String::StartsWith(image, "preview_")) { std::string newImage = image; @@ -105,6 +106,7 @@ namespace Components image = Utils::String::VA("%s", newImage.data()); } } +#endif return _snprintf_s(buffer, size, size, "images/%s.iwi", image); } diff --git a/src/Components/Modules/ModelSurfs.cpp b/src/Components/Modules/ModelSurfs.cpp index 1167576b..12c2b9b1 100644 --- a/src/Components/Modules/ModelSurfs.cpp +++ b/src/Components/Modules/ModelSurfs.cpp @@ -164,7 +164,8 @@ namespace Components surfs->numSurfaces = newSurfs->numSurfaces; model->lods[i].surfs = newSurfs->surfaces; - std::memcpy(&model->lods[i].partBits, newSurfs->partBits, 24); + std::memcpy(&model->lods[i].partBits, &newSurfs->partBits, 16); + std::memcpy(&model->lods[i].pad3, &newSurfs->pad, 8); short numSurfs = static_cast(newSurfs->numSurfaces); model->lods[i].numSurfs = numSurfs;