diff --git a/Sources/Plasma/CoreLib/HeadSpin.cpp b/Sources/Plasma/CoreLib/HeadSpin.cpp index 0b218d0c..a9919dea 100644 --- a/Sources/Plasma/CoreLib/HeadSpin.cpp +++ b/Sources/Plasma/CoreLib/HeadSpin.cpp @@ -93,15 +93,14 @@ void hsDebugMessage (const char* message, long val) gHSDebugProc(&s[1]); else #if HS_BUILD_FOR_WIN32 - { OutputDebugString(&s[1]); + { + OutputDebugString(&s[1]); OutputDebugString("\n"); } -#elif HS_BUILD_FOR_UNIX - { fprintf(stderr, "%s\n", &s[1]); -// hsThrow(&s[1]); - } #else - hsThrow(&s[1]); + { + fprintf(stderr, "%s\n", &s[1]); + } #endif } #endif @@ -119,7 +118,7 @@ void ErrorAssert(int line, const char* file, const char* fmt, ...) va_list args; va_start(args, fmt); vsnprintf(msg, arrsize(msg), fmt, args); -#ifdef HS_DEBUGGING +#if defined(HS_DEBUGGING) && defined(_MSC_VER) if (s_GuiAsserts) { if(_CrtDbgReport(_CRT_ASSERT, file, line, NULL, msg)) diff --git a/Sources/Plasma/CoreLib/HeadSpin.h b/Sources/Plasma/CoreLib/HeadSpin.h index 41985112..76a98e8d 100644 --- a/Sources/Plasma/CoreLib/HeadSpin.h +++ b/Sources/Plasma/CoreLib/HeadSpin.h @@ -45,9 +45,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // Ensure these get set consistently regardless of what module includes it #include "hsCompilerSpecific.h" -#if (defined(_DEBUG) || defined(UNIX_DEBUG)) +#if defined(_DEBUG) # define HS_DEBUGGING -#endif // defined(_DEBUG) || defined(UNIX_DENUG) +#endif //====================================== // Some standard includes diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtArray.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtArray.h index 6d7fea92..078c5c31 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtArray.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtArray.h @@ -829,8 +829,8 @@ template void TArray::Copy (unsigned destIndex, unsigned sourceIndex, unsigned count) { // Copy the data to the destination - ASSERT(destIndex + count <= m_count); - ASSERT(sourceIndex + count <= m_count); + ASSERT(destIndex + count <= this->m_count); + ASSERT(sourceIndex + count <= this->m_count); C::Assign(this->m_data + destIndex, this->m_data + sourceIndex, count); } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.cpp index e200d1c0..0b9bba90 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.cpp @@ -131,7 +131,7 @@ bool plMorphSequence::MsgReceive(plMessage* msg) // Can always add it in later if desired. if( fTgtWgts.GetCount() ) { - float delWgt = hsTimer::GetDelSysSeconds() / (kMorphTime > 0 ? kMorphTime : 1.e-3f); + float delWgt = hsTimer::GetDelSysSeconds() / (kMorphTime > 0 ? float(kMorphTime) : 1.e-3f); int i; for( i = 0; i < fTgtWgts.GetCount(); i++ ) { @@ -820,4 +820,4 @@ void plMorphSequence::ISetSingleSharedToGlobal(int idx) int i; for (i = 0; i < fSharedMeshes[fGlobalLayerRef].fArrayWeights[0].fDeltaWeights.GetCount(); i++) SetWeight(0, i, fSharedMeshes[fGlobalLayerRef].fArrayWeights[0].fDeltaWeights[i], fSharedMeshes[idx].fMesh->GetKey()); -} \ No newline at end of file +} diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequenceSDLMod.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequenceSDLMod.cpp index d3cc3c5e..4c381d27 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequenceSDLMod.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequenceSDLMod.cpp @@ -154,7 +154,7 @@ void plMorphSequenceSDLMod::ISetCurrentStateFrom(const plStateDataRecord* srcSta { plKey meshKey; morphSD->GetStateDataRecord(i)->FindVar(kStrMesh)->Get(&meshKey); - if (meshKey && !meshKey->GetUoid().GetClassType() == plSharedMesh::Index()) + if (meshKey && meshKey->GetUoid().GetClassType() != plSharedMesh::Index()) continue; // meshKey will be nil when dealing with non-sharedMesh data diff --git a/Sources/Plasma/PubUtilLib/plFile/plSecureStream.cpp b/Sources/Plasma/PubUtilLib/plFile/plSecureStream.cpp index 3aa975c4..25d47a8c 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plSecureStream.cpp +++ b/Sources/Plasma/PubUtilLib/plFile/plSecureStream.cpp @@ -48,6 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsSTLStream.h" #if !HS_BUILD_FOR_WIN32 +#include #define INVALID_HANDLE_VALUE 0 #endif @@ -325,7 +326,11 @@ uint32_t plSecureStream::IRead(uint32_t bytes, void* buffer) } else { +#if HS_BUILD_FOR_WIN32 hsDebugMessage("Error on Windows read", GetLastError()); +#else + hsDebugMessage("Error on POSIX read", errno); +#endif } } return numItems; diff --git a/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp b/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp index 8fff1ee6..04ee1257 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp @@ -50,10 +50,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include -#ifdef HS_BUILD_FOR_WIN32 -#define isnan _isnan -#endif - void plPerspDirSlave::Init() { plShadowSlave::Init(); @@ -187,10 +183,10 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) // This is my hack to get the Nexus age working. The real problem // is probably data-side. I take full responsibility for this // hack-around breaking the entire system, loosing data, causing - // unauthorized credit card transactions, etc. - if (isnan(bnd.GetMins().fX) || isnan(bnd.GetMins().fY)) + // unauthorized credit card transactions, etc. + if (std::isnan(bnd.GetMins().fX) || std::isnan(bnd.GetMins().fY)) return false; - if (isnan(bnd.GetMaxs().fX) || isnan(bnd.GetMaxs().fY)) + if (std::isnan(bnd.GetMaxs().fX) || std::isnan(bnd.GetMaxs().fY)) return false; // THIS IS EVEN MORE WRONG @@ -248,10 +244,10 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) // This is my hack to get the Nexus age working. The real problem // is probably data-side. I take full responsibility for this // hack-around breaking the entire system, loosing data, causing - // unauthorized credit card transactions, etc. - if (isnan(bnd.GetMins().fX) || isnan(bnd.GetMins().fY)) + // unauthorized credit card transactions, etc. + if (std::isnan(bnd.GetMins().fX) || std::isnan(bnd.GetMins().fY)) return false; - if (isnan(bnd.GetMaxs().fX) || isnan(bnd.GetMaxs().fY)) + if (std::isnan(bnd.GetMaxs().fX) || std::isnan(bnd.GetMaxs().fY)) return false; plConst(float) kMinMinZ(1.f); diff --git a/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp b/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp index bf95e40d..6e9123d9 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp @@ -48,10 +48,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include -#ifdef HS_BUILD_FOR_WIN32 -#define isnan _isnan -#endif - static const float kMinMinZ = 1.f; // totally random arbitrary number (has to be > 0). bool plShadowSlave::ISetupOrthoViewTransform() @@ -136,10 +132,10 @@ bool plShadowSlave::ISetupPerspViewTransform() // This is my hack to get the Nexus age working. The real problem // is probably data-side. I take full responsibility for this // hack-around breaking the entire system, loosing data, causing - // unauthorized credit card transactions, etc. - if (isnan(bnd.GetMins().fX) || isnan(bnd.GetMins().fY)) + // unauthorized credit card transactions, etc. + if (std::isnan(bnd.GetMins().fX) || std::isnan(bnd.GetMins().fY)) return false; - if (isnan(bnd.GetMaxs().fX) || isnan(bnd.GetMaxs().fY)) + if (std::isnan(bnd.GetMaxs().fX) || std::isnan(bnd.GetMaxs().fY)) return false; float cotX, cotY; diff --git a/cmake/CompilerChecks.cmake b/cmake/CompilerChecks.cmake index aa85866c..973b671c 100644 --- a/cmake/CompilerChecks.cmake +++ b/cmake/CompilerChecks.cmake @@ -11,6 +11,13 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) endif() endif() +# MSVC automatically defines -D_DEBUG when /MTd or /MDd is set, so we +# need to make sure it gets added for other compilers too +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") +endif() + # Compile-time type size checks include(CheckTypeSize)