[General] Fix compiler warnings

This commit is contained in:
momo5502 2017-03-30 14:05:37 +02:00
parent 82cb8aa0a5
commit deaf269808
6 changed files with 9 additions and 11 deletions

View File

@ -4,6 +4,7 @@ namespace Components
{ {
bool Loader::Pregame = true; bool Loader::Pregame = true;
bool Loader::Postgame = false; bool Loader::Postgame = false;
bool Loader::ComInitialized = false;
std::vector<Component*> Loader::Components; std::vector<Component*> Loader::Components;
Utils::Memory::Allocator Loader::MemAllocator; Utils::Memory::Allocator Loader::MemAllocator;
@ -23,7 +24,7 @@ namespace Components
Loader::Postgame = false; Loader::Postgame = false;
Loader::MemAllocator.clear(); Loader::MemAllocator.clear();
if(!Loader::PerformingUnitTests()) CoInitialize(nullptr); if (!Loader::PerformingUnitTests()) Loader::ComInitialized = (CoInitialize(nullptr) == S_OK);
Loader::Register(new Flags()); Loader::Register(new Flags());
Loader::Register(new Singleton()); Loader::Register(new Singleton());
@ -113,7 +114,7 @@ namespace Components
Loader::Components.clear(); Loader::Components.clear();
Loader::MemAllocator.clear(); Loader::MemAllocator.clear();
if (!Loader::PerformingUnitTests()) CoUninitialize(); if (!Loader::PerformingUnitTests() && Loader::ComInitialized) CoUninitialize();
} }
void Loader::PreDestroy() void Loader::PreDestroy()

View File

@ -38,6 +38,7 @@ namespace Components
private: private:
static bool Pregame; static bool Pregame;
static bool Postgame; static bool Postgame;
static bool ComInitialized;
static std::vector<Component*> Components; static std::vector<Component*> Components;
static Utils::Memory::Allocator MemAllocator; static Utils::Memory::Allocator MemAllocator;
}; };

View File

@ -156,7 +156,6 @@ namespace Components
} }
} }
if (type == Game::XAssetType::ASSET_TYPE_MATERIAL && (name == "wc/codo_ui_viewer_black_decal3" || name == "wc/codo_ui_viewer_black_decal2" || name == "wc/hint_arrows01" || name == "wc/hint_arrows02")) if (type == Game::XAssetType::ASSET_TYPE_MATERIAL && (name == "wc/codo_ui_viewer_black_decal3" || name == "wc/codo_ui_viewer_black_decal2" || name == "wc/hint_arrows01" || name == "wc/hint_arrows02"))
{ {
asset.material->sortKey = 0xE; asset.material->sortKey = 0xE;

View File

@ -1,7 +1,5 @@
#include "STDInclude.hpp" #include "STDInclude.hpp"
#include <glm/glm.hpp> #include <glm/glm.hpp>
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/vector_angle.hpp>
namespace Components namespace Components
{ {
@ -585,12 +583,10 @@ namespace Components
glm::mat2x2 invMatrix = glm::inverse(matrix); glm::mat2x2 invMatrix = glm::inverse(matrix);
glm::vec2 solve = modelOrigin - selfOrigin; glm::vec2 solve = modelOrigin - selfOrigin;
glm::vec2 result = invMatrix * solve; glm::vec2 result = invMatrix * solve;
glm::vec2 path = modelOrigin - (selfOrigin + (result[0] * right));
glm::vec2 point = selfOrigin + (result[0] * right); // Compare signs and skip to the next model if they don't equal
glm::vec2 path = glm::normalize(modelOrigin - point); if ((path[0] < 0) == (forward[0] >= 0) && (path[1] < 0) == (forward[1] >= 0)) continue;
// If the angle is bigger than 1, skip (can either be 0° (0) or 180° (PI))
if(glm::angle(path, forward) > 1) continue;
} }
gameWorld->dpvs.smodelVisData[0][i] = 1; gameWorld->dpvs.smodelVisData[0][i] = 1;

View File

@ -1,5 +1,6 @@
#include "STDInclude.hpp" #include "STDInclude.hpp"
#undef getch #undef getch
#undef ungetch
#include <conio.h> #include <conio.h>
namespace Components namespace Components

View File

@ -3047,7 +3047,7 @@ namespace Game
char lightmapIndex; char lightmapIndex;
char reflectionProbeIndex; char reflectionProbeIndex;
char primaryLightIndex; char primaryLightIndex;
char castsSunShadow; char flag;
}; };
struct GfxSurfaceBounds struct GfxSurfaceBounds