From 0bb10287c58ba6011538ce7ab6e008bc286bfa3f Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sat, 29 Oct 2011 20:45:32 -0700 Subject: [PATCH 01/13] Fixes for plAudio errors. --- .../PubUtilLib/plAudio/plAudioSystem.cpp | 3 +-- .../Plasma/PubUtilLib/plAudio/plAudioSystem.h | 2 +- .../Plasma/PubUtilLib/plAudio/plEAXEffects.cpp | 10 ++++++---- .../Plasma/PubUtilLib/plAudio/plVoiceChat.cpp | 18 +++++++++--------- .../Plasma/PubUtilLib/plAudio/plWin32Sound.cpp | 6 +++++- .../plAudio/plWin32StreamingSound.cpp | 13 +++++++++---- .../PubUtilLib/plAudio/plWin32StreamingSound.h | 1 - .../PubUtilLib/plAudio/plWinMicLevel.cpp | 3 +++ .../Plasma/PubUtilLib/plAudio/plWinMicLevel.h | 4 +++- 9 files changed, 37 insertions(+), 23 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp b/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp index 6866d09a..dd4aa736 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp @@ -43,7 +43,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include #include -#include #ifdef EAX_SDK_AVAILABLE #include #endif @@ -1296,4 +1295,4 @@ void plgAudioSys::SetListenerOrientation(const hsVector3 view, const hsVector3 u { fSys->SetListenerOrientation(view, up); } -} \ No newline at end of file +} diff --git a/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.h b/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.h index 6055726e..332ae85c 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.h @@ -134,7 +134,7 @@ protected: hsPoint3 fCurrListenerPos;//, fCommittedListenerPos; hsBool fActive, fUsingEAX, fRestartOnDestruct, fWaitingForShutdown; - __int64 fStartTime; + Int64 fStartTime; hsTArray fMyRefs; hsTArray fEAXRegions; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp b/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp index e8768e37..754135a2 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp @@ -60,10 +60,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAudioSystem.h" #include -#ifdef DX_OLD_SDK - #include -#else - #include +#if HS_BUILD_FOR_WIN32 +# ifdef DX_OLD_SDK +# include +# else +# include +# endif #endif #ifdef EAX_SDK_AVAILABLE diff --git a/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp b/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp index 1898d749..5321bcec 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp @@ -361,8 +361,8 @@ void plVoicePlayer::PlaybackVoiceMessage(void* data, unsigned size, int numFrame return; } - BYTE* newBuff; - newBuff = (BYTE*)nBuff; // Convert to byte data + UInt8* newBuff; + newBuff = (UInt8*)nBuff; // Convert to byte data PlaybackUncompressedVoiceMessage(newBuff, numBytes); // playback uncompressed data delete[] nBuff; } @@ -411,7 +411,7 @@ plVoiceSound::plVoiceSound() fLastUpdate = 0; char keyName[32]; - StrPrintf(keyName, arrsize(keyName), "VoiceSound_%d", fCount); + snprintf(keyName, arrsize(keyName), "VoiceSound_%d", fCount); fCount++; hsgResMgr::ResMgr()->NewKey(keyName, this, plLocation::kGlobalFixedLoc); } @@ -431,7 +431,7 @@ hsBool plVoiceSound::LoadSound( hsBool is3D ) return false; // Don't set the failed flag, just return plWAVHeader header; - header.fFormatTag = WAVE_FORMAT_PCM; + header.fFormatTag = 0x1; // WAVE_FORMAT_PCM header.fBitsPerSample = 16; header.fNumChannels = 1; header.fNumSamplesPerSec = FREQUENCY; @@ -605,8 +605,8 @@ hsBool plSpeex::Encode(short *data, int numFrames, int *packedLength, hsRAMStrea short *pData = data; // pointer to input data float *input = TRACKED_NEW float[fFrameSize]; // input to speex - used as am intermediate array since speex requires float data - BYTE frameLength; // number of bytes speex compressed frame to - BYTE *frameData = TRACKED_NEW BYTE[fFrameSize]; // holds one frame of encoded data + UInt8 frameLength; // number of bytes speex compressed frame to + UInt8 *frameData = TRACKED_NEW UInt8[fFrameSize]; // holds one frame of encoded data // encode data for( int i = 0; i < numFrames; i++ ) @@ -647,8 +647,8 @@ hsBool plSpeex::Decode(UInt8 *data, int size, int numFrames, int *numOutputBytes short *pOut = out; // pointer to output short buffer // create buffer for input data - BYTE *frameData = TRACKED_NEW BYTE[fFrameSize]; // holds the current frames data to be decoded - BYTE frameLen; // holds the length of the current frame being decoded. + UInt8 *frameData = TRACKED_NEW UInt8[fFrameSize]; // holds the current frames data to be decoded + UInt8 frameLen; // holds the length of the current frame being decoded. // Decode data @@ -711,4 +711,4 @@ void plSpeex::SetComplexity(UInt8 c) { fComplexity = c; speex_encoder_ctl(fEncoderState, SPEEX_SET_COMPLEXITY, &fComplexity); -} \ No newline at end of file +} diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp index 153ac384..baa0589b 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp @@ -39,7 +39,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include +#if HS_BUILD_FOR_WIN32 +# include +#else +# include +#endif #include "HeadSpin.h" #include "hsGeometry3.h" #include "hsTimer.h" diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp index 6c73cda3..3d1fe3e6 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp @@ -39,12 +39,17 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include +#if HS_BUILD_FOR_WIN32 +# include +#else +# include +#endif #include "HeadSpin.h" #include "hsTimer.h" #include "hsGeometry3.h" #include "plgDispatch.h" #include "plProfile.h" +#include "plFile/hsFiles.h" #include "plWin32Sound.h" #include "plWin32StreamingSound.h" @@ -179,9 +184,9 @@ plSoundBuffer::ELoadReturnVal plWin32StreamingSound::IPreLoadBuffer( hsBool play bool streamCompressed = (buffer->HasFlag(plSoundBuffer::kStreamCompressed) != 0); /// Open da file - CHAR strPath[ MAX_PATH ]; + char strPath[ kFolderIterator_MaxPath ]; - _getcwd(strPath, MAX_PATH); + getcwd(strPath, kFolderIterator_MaxPath); if(sfxPath) strcat( strPath, "\\sfx\\" ); else @@ -506,4 +511,4 @@ void plWin32StreamingSound::IAddCallback( plEventCallbackMsg *pCBMsg ) return; } plWin32Sound::IAddCallback( pCBMsg ); -} \ No newline at end of file +} diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h index c900d178..47715de5 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h @@ -43,7 +43,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define plWin32StreamingSound_h #include "plWin32Sound.h" -#include "pnUtils/pnUtils.h" class plDSoundBuffer; class DSoundCallbackHandle; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp index 7c5fa6fc..04471048 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp @@ -51,6 +51,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// +#if HS_BUILD_FOR_WIN32 + #include "hsTypes.h" #include "plWinMicLevel.h" #include "hsWindows.h" @@ -375,3 +377,4 @@ MIXERLINE *IGetMixerSubLineByType( MIXERCONTROL *mux, DWORD type ) return nil; } +#endif diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h b/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h index 65be8601..043cf04a 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h @@ -42,6 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plWinMicLevel_h #define _plWinMicLevel_h +#if HS_BUILD_FOR_WIN32 ////////////////////////////////////////////////////////////////////////////// // // // plWinMicLevel - Annoying class to deal with the annoying problem of // @@ -76,5 +77,6 @@ protected: static plWinMicLevel &IGetInstance( void ); void IShutdown( void ); }; +#endif // HS_BUILD_FOR_WIN32 -#endif // _plWinMicLevel_h \ No newline at end of file +#endif // _plWinMicLevel_h From a5ecd8d0c795fe166a61cb0301eebf3779deaba5 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sat, 29 Oct 2011 20:42:53 -0700 Subject: [PATCH 02/13] Fix syntax error in plPickingDetector.h --- Sources/Plasma/PubUtilLib/plPhysical/plPickingDetector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPickingDetector.h b/Sources/Plasma/PubUtilLib/plPhysical/plPickingDetector.h index c80fa228..660043d2 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPickingDetector.h +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPickingDetector.h @@ -79,4 +79,4 @@ public: */ -#endif plPickingDetector_inc +#endif //plPickingDetector_inc From b667e8348e239e54432673e0f1bcd7c2c16295f7 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 30 Oct 2011 00:14:34 -0700 Subject: [PATCH 03/13] Fixes for plAudible. --- Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp b/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp index e11945ea..72ec8bcc 100644 --- a/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp +++ b/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp @@ -739,14 +739,14 @@ void pl2WayWinAudible::Read(hsStream* s, hsResMgr* mgr) plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), GetKey()); } -void pl2WayWinAudible::PlayNetworkedSpeech(const char* addr, Int32 size, int numFrames, BYTE flags) +void pl2WayWinAudible::PlayNetworkedSpeech(const char* addr, Int32 size, int numFrames, unsigned char flags) { if (fVoicePlayer) { if (!(flags & VOICE_ENCODED)) - fVoicePlayer->PlaybackUncompressedVoiceMessage((BYTE*)addr, size); + fVoicePlayer->PlaybackUncompressedVoiceMessage((UInt8*)addr, size); else - fVoicePlayer->PlaybackVoiceMessage((BYTE*)addr, size, numFrames); + fVoicePlayer->PlaybackVoiceMessage((UInt8*)addr, size, numFrames); } } From 085b12e6eb87690e606a720ca9edc0d044beb197 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 30 Oct 2011 00:49:25 -0700 Subject: [PATCH 04/13] ifdef out all the Win32 specific code in plGImage. --- Sources/Plasma/CoreLib/hsUtils.h | 1 + .../PubUtilLib/plGImage/hsDXTDirectXCodec.cpp | 3 +++ .../PubUtilLib/plGImage/hsDXTDirectXCodec.h | 3 +++ .../PubUtilLib/plGImage/plAVIWriter.cpp | 3 +++ .../Plasma/PubUtilLib/plGImage/plAVIWriter.h | 5 ++++- .../plGImage/plDynSurfaceWriter.cpp | 19 ++++++++++++++++--- Sources/Plasma/PubUtilLib/plGImage/plFont.cpp | 2 +- 7 files changed, 31 insertions(+), 5 deletions(-) diff --git a/Sources/Plasma/CoreLib/hsUtils.h b/Sources/Plasma/CoreLib/hsUtils.h index 3ffc107c..f25e885b 100644 --- a/Sources/Plasma/CoreLib/hsUtils.h +++ b/Sources/Plasma/CoreLib/hsUtils.h @@ -72,6 +72,7 @@ char * hsFormatStrV(const char * fmt, va_list args); // You are responsible f # define strnicmp strncasecmp # define wcsicmp wcscasecmp # define wcsnicmp wcsncasecmp +# define strlwr hsStrLower #endif diff --git a/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp b/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp index 1b29f368..35742818 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp @@ -51,6 +51,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// +#if HS_BUILD_FOR_WIN32 + #include "hsConfig.h" #include "hsWindows.h" @@ -1240,3 +1242,4 @@ hsBool hsDXTDirectXCodec::ColorizeCompMipmap( plMipmap *bMap, const UInt8 *color return false; } +#endif diff --git a/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h b/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h index 6f158a16..1094bc7b 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h +++ b/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h @@ -54,6 +54,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsDXTDirectXCodec_inc #define hsDXTDirectXCodec_inc +#if HS_BUILD_FOR_WIN32 + #include "hsWindows.h" #include "hsCodec.h" @@ -103,5 +105,6 @@ private: static hsBool Register(); static hsBool fRegistered; }; +#endif #endif // hsDXTDirectXCodec_inc diff --git a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp index d52b32d2..110ac5b4 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp @@ -39,6 +39,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ +#if HS_BUILD_FOR_WIN32 + #include "plAVIWriter.h" #include "hsTypes.h" @@ -308,3 +310,4 @@ bool plAVIWriterImp::ICaptureFrame(plPipeline* pipeline) return (err == AVIERR_OK); } +#endif diff --git a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.h b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.h index 7989611e..c11c740b 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.h @@ -42,6 +42,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plAVIWriter_h_inc #define plAVIWriter_h_inc +#if HS_BUILD_FOR_WIN32 + #include "pnKeyedObject/hsKeyedObject.h" class plPipeline; @@ -67,5 +69,6 @@ public: virtual bool Open(const char* fileName, plPipeline* pipeline)=0; virtual void Close()=0; }; +#endif -#endif // plAVIWriter_h_inc \ No newline at end of file +#endif // plAVIWriter_h_inc diff --git a/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.cpp b/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.cpp index 343a4ee6..d00ba302 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.cpp @@ -394,8 +394,10 @@ void plDynSurfaceWriter::IInit( void ) void plDynSurfaceWriter::Reset( void ) { +#if HS_BUILD_FOR_WIN32 fRGBSurface.Release(); fAlphaSurface.Release(); +#endif fCurrTarget = nil; fFlushed = true; @@ -484,6 +486,7 @@ void plDynSurfaceWriter::SwitchTarget( plDynamicTextMap *target ) // Make sure our surfaces fit bool hadToAllocate = false; +#if HS_BUILD_FOR_WIN32 if( target != nil ) { if( !fRGBSurface.WillFit( (UInt16)(target->GetWidth()), (UInt16)(target->GetHeight()) ) ) @@ -507,6 +510,7 @@ void plDynSurfaceWriter::SwitchTarget( plDynamicTextMap *target ) fAlphaSurface.Release(); hadToAllocate = true; } +#endif if( hadToAllocate ) { @@ -533,6 +537,7 @@ void plDynSurfaceWriter::IEnsureSurfaceUpdated( void ) { UInt32 *srcBits = (UInt32 *)fCurrTarget->GetImage(); +#if HS_BUILD_FOR_WIN32 // Are we merging in the alpha bits? if( fFlags & kSupportAlpha ) { @@ -568,12 +573,14 @@ void plDynSurfaceWriter::IEnsureSurfaceUpdated( void ) destBits += fRGBSurface.fWidth; } } +#endif // ALSO, we need to re-update our settings, since different targets // can have different fonts or justifications ISetFont( fCurrTarget->GetFontFace(), fCurrTarget->GetFontSize(), 0/*fCurrTarget->GetWriterFontFlags()*/, fCurrTarget->GetFontAARGB() ); SetJustify( (Justify)fCurrTarget->GetFontJustify() ); - ISetTextColor( fCurrTarget->GetFontColor(), fCurrTarget->GetFontBlockRGB() ); + hsColorRGBA col = fCurrTarget->GetFontColor(); + ISetTextColor( col, fCurrTarget->GetFontBlockRGB() ); fFlushed = false; } @@ -584,11 +591,13 @@ hsBool plDynSurfaceWriter::IsValid( void ) const if( fCurrTarget == nil ) return false; +#if HS_BUILD_FOR_WIN32 if( fRGBSurface.fDC == nil || fRGBSurface.fBitmap == nil ) return false; if( ( fFlags & kSupportAlpha ) && ( fAlphaSurface.fDC == nil || fAlphaSurface.fBitmap == nil ) ) return false; +#endif return true; } @@ -696,6 +705,7 @@ void plDynSurfaceWriter::ISetFont( const char *face, UInt16 size, UInt8 fontF { fFlags = ( fFlags & ~kFontShadowed ) | ( fontFlags & kFontShadowed ); +#if HS_BUILD_FOR_WIN32 if( !fRGBSurface.FontMatches( face, size, fontFlags, antiAliasRGB ) ) fRGBSurface.SetFont( face, size, fontFlags, antiAliasRGB ); @@ -704,6 +714,7 @@ void plDynSurfaceWriter::ISetFont( const char *face, UInt16 size, UInt8 fontF if( !fAlphaSurface.FontMatches( face, size, fontFlags, !antiAliasRGB ) ) fAlphaSurface.SetFont( face, size, fontFlags, !antiAliasRGB ); } +#endif } //// SetTextColor ///////////////////////////////////////////////////////////// @@ -770,7 +781,8 @@ void plDynSurfaceWriter::IRefreshOSJustify( void ) if( !IsValid() ) return; - UINT justMode; +#if HS_BUILD_FOR_WIN32 + UInt32 justMode; switch( fJustify ) { case kLeftJustify: justMode = TA_LEFT; break; @@ -780,6 +792,7 @@ void plDynSurfaceWriter::IRefreshOSJustify( void ) ::SetTextAlign( fRGBSurface.fDC, justMode ); if( fFlags & kSupportAlpha ) ::SetTextAlign( fAlphaSurface.fDC, justMode ); +#endif } //// DrawString /////////////////////////////////////////////////////////////// @@ -1122,4 +1135,4 @@ void plDynSurfaceWriter::DrawClippedImage( UInt16 x, UInt16 y, plMipmap *imag ::DeleteObject( brush ); } } -*/ \ No newline at end of file +*/ diff --git a/Sources/Plasma/PubUtilLib/plGImage/plFont.cpp b/Sources/Plasma/PubUtilLib/plGImage/plFont.cpp index e77763cd..ff18c047 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plFont.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plFont.cpp @@ -1024,7 +1024,7 @@ void plFont::CalcStringExtents( const wchar_t *string, UInt16 &width, UInt16 // firstClippedChar is an index into the given string that points to the start of the part of the string // that got clipped (i.e. not rendered). - firstClippedChar = (UInt32)fRenderInfo.fVolatileStringPtr - (UInt32)string; + firstClippedChar = (unsigned_ptr)fRenderInfo.fVolatileStringPtr - (unsigned_ptr)string; firstClippedChar /= 2; // divide by 2 because a wchar_t is two bytes wide, instead of one (like a char) } From 4420e210c14baa2d19f1184dfd04401b5f9cc7c8 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 30 Oct 2011 00:55:38 -0700 Subject: [PATCH 05/13] ifdef out pretty much all of plLayerAVI. --- Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.cpp b/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.cpp index b08d0416..860b6e08 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.cpp +++ b/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.cpp @@ -71,8 +71,10 @@ struct plAVIFileInfo }; #endif // HS_BUILD_FOR_WIN32 +#if HS_BUILD_FOR_WIN32 static hsBool ICopySourceToTexture24(BITMAPINFO* bmi, plMipmap* t); static hsBool ICopySourceToTexture16(BITMAPINFO* bmi, plMipmap* t); +#endif plLayerAVI::plLayerAVI() @@ -123,12 +125,17 @@ hsBool plLayerAVI::IInit() Int32 plLayerAVI::ISecsToFrame(hsScalar secs) { +#if HS_BUILD_FOR_WIN32 float timeScale = float(fAVIInfo->fAVIStreamInfo.dwRate) / float(fAVIInfo->fAVIStreamInfo.dwScale); +#else + float timeScale = 1.0f; +#endif return Int32(secs * timeScale + 0.5f); } hsBool plLayerAVI::IGetCurrentFrame() { +#if HS_BUILD_FOR_WIN32 if( !fAVIInfo->fAVIStream ) IInit(); @@ -149,9 +156,11 @@ hsBool plLayerAVI::IGetCurrentFrame() default: return ISetFault("Unknown AVI color depth"); } +#endif return true; } +#if HS_BUILD_FOR_WIN32 static hsBool ICopySourceToTexture16(BITMAPINFO* bmi, plMipmap* b) { hsAssert( b != nil, "nil mipmap passed to ICopySourceToTexture16()" ); @@ -224,9 +233,11 @@ static hsBool ICopySourceToTexture24(BITMAPINFO* bmi, plMipmap* b) return false; } +#endif hsBool plLayerAVI::ICloseMovie() { +#if HS_BUILD_FOR_WIN32 if( fAVIInfo->fGetFrame ) AVIStreamGetFrameClose(fAVIInfo->fGetFrame); fAVIInfo->fGetFrame = 0; @@ -235,6 +246,7 @@ hsBool plLayerAVI::ICloseMovie() AVIStreamRelease(fAVIInfo->fAVIStream); fAVIInfo->fAVIStream = nil; +#endif return false; } From 923b875de9f1b55a4b41c9cc2707e46402d3f73b Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 30 Oct 2011 13:16:24 -0700 Subject: [PATCH 06/13] Fix a bunch of warnings in EXTERNAL_RELEASE mode. --- Sources/Plasma/CoreLib/hsConfig.h | 4 +++- Sources/Plasma/CoreLib/hsTypes.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/Plasma/CoreLib/hsConfig.h b/Sources/Plasma/CoreLib/hsConfig.h index c552b34a..10878ae5 100644 --- a/Sources/Plasma/CoreLib/hsConfig.h +++ b/Sources/Plasma/CoreLib/hsConfig.h @@ -102,7 +102,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifdef HS_BUILD_FOR_WIN32 -# define CDECL __cdecl +# ifndef CDECL +# define CDECL __cdecl +# endif #else # define CDECL #endif diff --git a/Sources/Plasma/CoreLib/hsTypes.h b/Sources/Plasma/CoreLib/hsTypes.h index 8dc0a9b5..d0f920ca 100644 --- a/Sources/Plasma/CoreLib/hsTypes.h +++ b/Sources/Plasma/CoreLib/hsTypes.h @@ -582,7 +582,7 @@ void DebugMsgV (const char fmt[], va_list args); #ifdef PLASMA_EXTERNAL_RELEASE #define hsStatusMessage(x) NULL_STMT - #define hsStatusMessageF(x,y) NULL_STMT + #define hsStatusMessageF(x, ...) NULL_STMT #else /* Not external release */ From 2916a04d3fb985189f5762c52fbcd8fe212f464d Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 30 Oct 2011 13:17:36 -0700 Subject: [PATCH 07/13] Fixes for HS_BUILD_FOR_WIN32 in plAudio. --- .../PubUtilLib/plAudio/plWin32Sound.cpp | 11 +++++----- .../plAudio/plWin32StreamingSound.cpp | 11 +++++----- .../PubUtilLib/plAudio/plWinMicLevel.cpp | 20 +++++++++++++++++-- .../Plasma/PubUtilLib/plAudio/plWinMicLevel.h | 2 -- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp index baa0589b..cd61403f 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp @@ -39,11 +39,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#if HS_BUILD_FOR_WIN32 -# include -#else -# include -#endif #include "HeadSpin.h" #include "hsGeometry3.h" #include "hsTimer.h" @@ -64,6 +59,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plPipeline/plPlates.h" #include "plStatusLog/plStatusLog.h" +#if HS_BUILD_FOR_WIN32 +# include +#else +# include +#endif + plProfile_CreateMemCounter("Sounds", "Memory", MemSounds); plProfile_Extern(SoundPlaying); diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp index 3d1fe3e6..3e01bb80 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp @@ -39,11 +39,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#if HS_BUILD_FOR_WIN32 -# include -#else -# include -#endif #include "HeadSpin.h" #include "hsTimer.h" #include "hsGeometry3.h" @@ -63,6 +58,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnMessage/plEventCallbackMsg.h" #include "plStatusLog/plStatusLog.h" +#if HS_BUILD_FOR_WIN32 +# include +#else +# include +#endif + #define STREAMING_UPDATE_MS 200 plProfile_Extern(MemSounds); diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp index 04471048..9eaabeb2 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp @@ -51,11 +51,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#if HS_BUILD_FOR_WIN32 #include "hsTypes.h" #include "plWinMicLevel.h" #include "hsWindows.h" + +#if HS_BUILD_FOR_WIN32 #include @@ -81,7 +82,7 @@ MIXERLINE *IGetLineByType( DWORD type ); MIXERLINE *IGetLineByID( DWORD id ); MIXERCONTROL *IGetControlByType( MIXERLINE *line, DWORD type ); MIXERLINE *IGetMixerSubLineByType( MIXERCONTROL *mux, DWORD type ); - +#endif //// The Publics ///////////////////////////////////////////////////////////// @@ -90,11 +91,15 @@ hsScalar plWinMicLevel::GetLevel( void ) if( !CanSetLevel() ) return -1; +#if HS_BUILD_FOR_WIN32 DWORD rawValue; if( !IGetControlValue( rawValue ) ) return -1; return (hsScalar)( rawValue - sMinValue ) / (hsScalar)( sMaxValue - sMinValue ); +#else + return -1; +#endif } void plWinMicLevel::SetLevel( hsScalar level ) @@ -102,9 +107,11 @@ void plWinMicLevel::SetLevel( hsScalar level ) if( !CanSetLevel() ) return; +#if HS_BUILD_FOR_WIN32 DWORD rawValue = (DWORD)(( level * ( sMaxValue - sMinValue ) ) + sMinValue); ISetControlValue( rawValue ); +#endif } hsBool plWinMicLevel::CanSetLevel( void ) @@ -112,7 +119,11 @@ hsBool plWinMicLevel::CanSetLevel( void ) // Just to init plWinMicLevel &instance = IGetInstance(); +#if HS_BUILD_FOR_WIN32 return ( sMixerHandle != nil ) ? true : false; +#else + return false; +#endif } @@ -126,6 +137,7 @@ plWinMicLevel &plWinMicLevel::IGetInstance( void ) plWinMicLevel::plWinMicLevel() { +#if HS_BUILD_FOR_WIN32 sMixerHandle = nil; memset( &sMixerCaps, 0, sizeof( sMixerCaps ) ); @@ -159,6 +171,7 @@ plWinMicLevel::plWinMicLevel() return; } } +#endif } plWinMicLevel::~plWinMicLevel() @@ -168,12 +181,15 @@ plWinMicLevel::~plWinMicLevel() void plWinMicLevel::IShutdown( void ) { +#if HS_BUILD_FOR_WIN32 if( sMixerHandle != nil ) ::mixerClose( sMixerHandle ); sMixerHandle = nil; +#endif } +#if HS_BUILD_FOR_WIN32 //// IGetMuxMicVolumeControl ///////////////////////////////////////////////// // Tries to get the volume control of the microphone subline of the MUX or // mixer control of the WaveIn destination line of the audio system (whew!) diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h b/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h index 043cf04a..bd7baec9 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h @@ -42,7 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plWinMicLevel_h #define _plWinMicLevel_h -#if HS_BUILD_FOR_WIN32 ////////////////////////////////////////////////////////////////////////////// // // // plWinMicLevel - Annoying class to deal with the annoying problem of // @@ -77,6 +76,5 @@ protected: static plWinMicLevel &IGetInstance( void ); void IShutdown( void ); }; -#endif // HS_BUILD_FOR_WIN32 #endif // _plWinMicLevel_h From 526bed2f43aa584e1ffdb8549468e73630325b16 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 30 Oct 2011 13:18:54 -0700 Subject: [PATCH 08/13] Fixes for plGImage HS_BUILD_FOR_WIN32. --- .../PubUtilLib/plGImage/hsDXTDirectXCodec.cpp | 19 +++++++++--- .../PubUtilLib/plGImage/hsDXTDirectXCodec.h | 13 ++++++-- .../PubUtilLib/plGImage/plAVIWriter.cpp | 31 +++++++++++++++++-- .../Plasma/PubUtilLib/plGImage/plAVIWriter.h | 3 -- 4 files changed, 55 insertions(+), 11 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp b/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp index 35742818..3f68ba44 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp @@ -51,13 +51,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#if HS_BUILD_FOR_WIN32 #include "hsConfig.h" #include "hsWindows.h" +#if HS_BUILD_FOR_WIN32 #include #include +#endif #include "hsTypes.h" #include "hsDXTDirectXCodec.h" @@ -65,6 +66,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsCodecManager.h" #include "plPipeline/hsGDDrawDllLoad.h" +#if HS_BUILD_FOR_WIN32 namespace { typedef HRESULT(WINAPI * DIRECTDRAWCREATEEX)( GUID*, VOID**, REFIID, IUnknown* ); } @@ -75,6 +77,7 @@ enum D3DTEXTURE_FMT_FOURCC_DXT1 = 0x00002000, // No.14: DXTn FourCC (DXT1), format. D3DTEXTURE_FMT_FOURCC_DXT5 = 0x00020000, // No.18: DXTn FourCC (DXT5), format. }; +#endif hsBool hsDXTDirectXCodec::fRegistered = false; @@ -93,6 +96,7 @@ hsDXTDirectXCodec::hsDXTDirectXCodec() : fDirectDraw( nil ), fDDLibraryInstance( hsDXTDirectXCodec::~hsDXTDirectXCodec() { +#if HS_BUILD_FOR_WIN32 if ((fFlags & kExternalInit) == 0) { if (fDirectDraw) @@ -108,6 +112,7 @@ hsDXTDirectXCodec::~hsDXTDirectXCodec() fDirectDraw = nil; fDDLibraryInstance = nil; +#endif } hsBool hsDXTDirectXCodec::Register() @@ -115,6 +120,7 @@ hsBool hsDXTDirectXCodec::Register() return hsCodecManager::Instance().Register( &(Instance()), plMipmap::kDirectXCompression, 500 ); } +#if HS_BUILD_FOR_WIN32 //// Initialize /////////////////////////////////////////////////////////////// void hsDXTDirectXCodec::Initialize( IDirect3DDevice8 *directDraw ) @@ -161,6 +167,7 @@ hsBool hsDXTDirectXCodec::IInitialize() return true; } +#endif //// CreateCompressedMipmap /////////////////////////////////////////////////// // Updated 8.15.2000 mcn to generate uncompressed mipmaps down to 1x1 (the @@ -169,6 +176,7 @@ hsBool hsDXTDirectXCodec::IInitialize() plMipmap *hsDXTDirectXCodec::CreateCompressedMipmap( plMipmap *uncompressed ) { +#if HS_BUILD_FOR_WIN32 const plMipmap *b = uncompressed; plMipmap *compressed = nil; @@ -273,6 +281,9 @@ plMipmap *hsDXTDirectXCodec::CreateCompressedMipmap( plMipmap *uncompressed ) /// All done! return compressed; +#else + return nil; +#endif } //// CreateUncompressedMipmap ///////////////////////////////////////////////// @@ -418,6 +429,7 @@ plMipmap *hsDXTDirectXCodec::CreateUncompressedMipmap( plMipmap *compressed, */ } +#if HS_BUILD_FOR_WIN32 UInt32 hsDXTDirectXCodec::ICompressedFormat(const plMipmap *uncompressed) { if( uncompressed->GetFlags() & plMipmap::kAlphaChannelFlag ) @@ -1236,10 +1248,9 @@ void hsDXTDirectXCodec::CheckErrorCode(HRESULT res) break; } } +#endif hsBool hsDXTDirectXCodec::ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask ) { return false; -} - -#endif +} \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h b/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h index 1094bc7b..5157e8fc 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h +++ b/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h @@ -54,15 +54,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsDXTDirectXCodec_inc #define hsDXTDirectXCodec_inc -#if HS_BUILD_FOR_WIN32 #include "hsWindows.h" #include "hsCodec.h" class plMipmap; +#if HS_BUILD_FOR_WIN32 struct IDirect3DDevice8; struct IDirectDrawSurface7; struct IDirectDraw7; +#endif class hsDXTDirectXCodec : public hsCodec { @@ -80,9 +81,12 @@ public: // Colorize a compressed mipmap hsBool ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask ); +#if HS_BUILD_FOR_WIN32 void Initialize( IDirect3DDevice8 *directDraw ); +#endif hsBool Initialized() { return (fFlags & kInitialized) != 0; } +#if HS_BUILD_FOR_WIN32 private: UInt32 ICompressedFormat(const plMipmap *uncompressed); IDirectDrawSurface7 *IMakeDirect3DSurface( UInt32 formatType, UInt32 mipMapLevels, UInt32 width, UInt32 height ); @@ -91,9 +95,15 @@ private: void ICopySurface( IDirectDrawSurface7 *dest, IDirectDrawSurface7 *src, Int32 mipMapLevels ); void CheckErrorCode(HRESULT res); hsBool IInitialize(); +#endif +#if HS_BUILD_FOR_WIN32 IDirectDraw7 *fDirectDraw; HINSTANCE fDDLibraryInstance; +#else + void* fDirectDraw; + void* fDDLibraryInstance; +#endif UInt32 fFlags; enum @@ -105,6 +115,5 @@ private: static hsBool Register(); static hsBool fRegistered; }; -#endif #endif // hsDXTDirectXCodec_inc diff --git a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp index 110ac5b4..7452642e 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp @@ -39,14 +39,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#if HS_BUILD_FOR_WIN32 #include "plAVIWriter.h" #include "hsTypes.h" #include "hsWindows.h" +#if HS_BUILD_FOR_WIN32 #include +#endif #include "hsTimer.h" #include "plMipmap.h" @@ -57,6 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com bool plAVIWriter::fInitialized = false; +#if HS_BUILD_FOR_WIN32 class plAVIWriterImp : public plAVIWriter { protected: @@ -86,6 +88,21 @@ public: virtual bool Open(const char* fileName, plPipeline* pipeline); virtual void Close(); }; +#else +class plAVIWriterImp : public plAVIWriter +{ +public: + plAVIWriterImp(); + virtual ~plAVIWriterImp(); + + virtual hsBool MsgReceive(plMessage* msg); + + virtual void Shutdown(); + + virtual bool Open(const char* fileName, plPipeline* pipeline); + virtual void Close(); +} +#endif plAVIWriter::~plAVIWriter() { @@ -106,6 +123,7 @@ plAVIWriter& plAVIWriter::Instance() //////////////////////////////////////////////////////////////////////////////// +#if HS_BUILD_FOR_WIN32 plAVIWriterImp::plAVIWriterImp() : fStartTime(0), fOldRealTime(false), @@ -115,6 +133,9 @@ plAVIWriterImp::plAVIWriterImp() : { AVIFileInit(); } +#else +plAVIWriterImp::plAVIWriterImp() { } +#endif plAVIWriterImp::~plAVIWriterImp() { @@ -134,7 +155,7 @@ plProfile_CreateTimer("AviCapture", "RenderSetup", AviCapture); hsBool plAVIWriterImp::MsgReceive(plMessage* msg) { - +#if HS_BUILD_FOR_WIN32 plRenderMsg* renderMsg = plRenderMsg::ConvertNoRef(msg); if (renderMsg) { @@ -144,12 +165,14 @@ hsBool plAVIWriterImp::MsgReceive(plMessage* msg) plProfile_EndTiming(AviCapture); } +#endif return hsKeyedObject::MsgReceive(msg); } static const int kFramesPerSec = 30; +#if HS_BUILD_FOR_WIN32 bool plAVIWriterImp::Open(const char* fileName, plPipeline* pipeline) { // Already writing, fail @@ -232,11 +255,13 @@ bool plAVIWriterImp::Open(const char* fileName, plPipeline* pipeline) return true; } +#endif void plAVIWriterImp::Close() { plgDispatch::Dispatch()->UnRegisterForExactType(plRenderMsg::Index(), GetKey()); +#if HS_BUILD_FOR_WIN32 hsTimer::SetRealTime(fOldRealTime); if (fStreamHandle) @@ -258,8 +283,10 @@ void plAVIWriterImp::Close() } AVIFileExit(); +#endif } +#if HS_BUILD_FOR_WIN32 void plAVIWriterImp::IFillStreamInfo(AVISTREAMINFO* inf, plPipeline* pipeline) { memset(inf, 0, sizeof(AVISTREAMINFO)); diff --git a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.h b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.h index c11c740b..1b050359 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.h @@ -42,8 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plAVIWriter_h_inc #define plAVIWriter_h_inc -#if HS_BUILD_FOR_WIN32 - #include "pnKeyedObject/hsKeyedObject.h" class plPipeline; @@ -69,6 +67,5 @@ public: virtual bool Open(const char* fileName, plPipeline* pipeline)=0; virtual void Close()=0; }; -#endif #endif // plAVIWriter_h_inc From a743da47fb28a912b98ece9e98c72ea91ecff60c Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 30 Oct 2011 13:36:31 -0700 Subject: [PATCH 09/13] Some fixes from mingw. --- .../FeatureLib/pfAnimation/plLineFollowMod.cpp | 3 ++- Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp | 12 +++++++----- .../Plasma/FeatureLib/pfCamera/plCameraModifier.cpp | 5 +++-- .../Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp | 10 ++++++++-- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp index 28d02ca5..dd0c8f23 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp @@ -572,7 +572,8 @@ void plLineFollowMod::ISetTargetTransform(int iTarg, const hsMatrix44& unclTgtXf xlate.Reset(); xlate.SetTranslate(&oldPos); w2l = w2l * xlate; - xlate.SetTranslate(&-pos); + hsPoint3 neg = -pos; + xlate.SetTranslate(&neg); w2l = w2l * xlate; ci->SetTransform(l2w, w2l); diff --git a/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp b/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp index 9699d9d6..50cf05f4 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp +++ b/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp @@ -132,7 +132,8 @@ fOffsetPct(1.0f) fPOAGoal.Set(0,0,0); fGoal.Set(1,1,1); fPOAOffset.Set(0,0,0); - fTargetMatrix.Make(&fGoal, &fPOAGoal, &hsVector3(0,0,1)); + hsVector3 up(0, 0, 1); + fTargetMatrix.Make(&fGoal, &fPOAGoal, &up); fFlags.Clear(); } @@ -758,8 +759,8 @@ void plCameraBrain1_Drive::Pop() // void plCameraBrain1_Drive::Update(hsBool forced) { - - fTargetMatrix.Make(&fGoal, &fPOAGoal, &(-1*fUp)); + hsVector3 neg_up = -1 * fUp; + fTargetMatrix.Make(&fGoal, &fPOAGoal, &neg_up); // update our desired position: double time = hsTimer::GetSeconds(); @@ -1628,14 +1629,15 @@ void plCameraBrain1_Circle::Update(hsBool forced) fPOAGoal += fPOAOffset; + hsPoint3 goalpos = fCamera->GetTargetPos(); if (HasFlag(kCutPosOnce)) { - fGoal = MoveTowardsFromGoal(&fCamera->GetTargetPos(), secs, true); + fGoal = MoveTowardsFromGoal(&goalpos, secs, true); fFlags.ClearBit(kCutPos); } else { - fGoal = MoveTowardsFromGoal(&fCamera->GetTargetPos(), secs); + fGoal = MoveTowardsFromGoal(&goalpos, secs); fFlags.SetBit(kCutPos); } AdjustForInput(secs); diff --git a/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.cpp b/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.cpp index 8084c0d5..62563795 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.cpp +++ b/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.cpp @@ -274,7 +274,8 @@ void plCameraModifier1::Update() // have to ask the avatar controller for the subworld key. if (!worldKey) { - plArmatureMod* armMod = plAvatarMgr::FindAvatar(plKey(GetBrain()->GetSubject()->GetKey())); + plKey subject = plKey(GetBrain()->GetSubject()->GetKey()); + plArmatureMod* armMod = plAvatarMgr::FindAvatar(subject); if (armMod && armMod->GetController() ) worldKey = armMod->GetController()->GetSubworld(); } @@ -491,4 +492,4 @@ void plCameraModifier1::SetTransform(hsPoint3 at) l2w.Make(&fFrom, &at, &up); l2w.GetInverse(&w2l); IGetTargetCoordinateInterface(0)->SetTransform( l2w, w2l ); -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp b/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp index f67a698a..4028d296 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp +++ b/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp @@ -1980,9 +1980,15 @@ void plVirtualCam1::StartTransition(CamTrans* transition) hsVector3 dist; // figure out transition time if (transition->fCutPos) - dist.Set(&(fTransitionCamera->GetTargetPOA() - pCam->GetTargetPOA())); + { + hsPoint3 poadist = fTransitionCamera->GetTargetPOA() - pCam->GetTargetPOA(); + dist.Set(&poadist); + } else - dist.Set(&(fTransitionCamera->GetTargetPos() - pCam->GetTargetPos())); + { + hsPoint3 posdist = fTransitionCamera->GetTargetPos() - pCam->GetTargetPos(); + dist.Set(&posdist); + } time = (double)(dist.Magnitude() / pBrain->GetVelocity()); From 5e6eb006b94a387300650302bfce14190e51dafa Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 30 Oct 2011 16:07:26 -0700 Subject: [PATCH 10/13] Fix some Linux issues in plGImage. --- Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp | 6 +++--- Sources/Plasma/PubUtilLib/plPipeline/hsGDDrawDllLoad.h | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp index 7452642e..299535b3 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp @@ -101,7 +101,7 @@ public: virtual bool Open(const char* fileName, plPipeline* pipeline); virtual void Close(); -} +}; #endif plAVIWriter::~plAVIWriter() @@ -172,9 +172,9 @@ hsBool plAVIWriterImp::MsgReceive(plMessage* msg) static const int kFramesPerSec = 30; -#if HS_BUILD_FOR_WIN32 bool plAVIWriterImp::Open(const char* fileName, plPipeline* pipeline) { +#if HS_BUILD_FOR_WIN32 // Already writing, fail if (fStreamHandle) return false; @@ -250,12 +250,12 @@ bool plAVIWriterImp::Open(const char* fileName, plPipeline* pipeline) Close(); return false; } +#endif plgDispatch::Dispatch()->RegisterForExactType(plRenderMsg::Index(), GetKey()); return true; } -#endif void plAVIWriterImp::Close() { diff --git a/Sources/Plasma/PubUtilLib/plPipeline/hsGDDrawDllLoad.h b/Sources/Plasma/PubUtilLib/plPipeline/hsGDDrawDllLoad.h index 522b7277..27cba099 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/hsGDDrawDllLoad.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/hsGDDrawDllLoad.h @@ -43,7 +43,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsGDDrawDllLoad_inc #define hsGDDrawDllLoad_inc +#include "hsConfig.h" +#if HS_BUILD_FOR_WIN32 class hsGDDrawDllLoad { private: @@ -55,5 +57,6 @@ public: static HMODULE GetD3DDll(); }; +#endif #endif // hsGDDrawDllLoad_inc From dc2d80499373bc1f8fc5b4d7d59b6df69c674392 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sat, 29 Oct 2011 20:37:39 -0700 Subject: [PATCH 11/13] Get rid of EFX-Util.h include. --- .../PubUtilLib/plAudio/plEAXEffects.cpp | 2 +- .../Plasma/PubUtilLib/plAudio/plEAXEffects.h | 6 +- .../PubUtilLib/plAudio/plEAXListenerMod.cpp | 2 +- .../PubUtilLib/plAudio/plEAXStructures.h | 80 +++++++++++++++++++ 4 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 Sources/Plasma/PubUtilLib/plAudio/plEAXStructures.h diff --git a/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp b/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp index 754135a2..c1578ca3 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsTypes.h" #include "hsThread.h" #ifndef EAX_SDK_AVAILABLE -#include +#include "plEAXStructures.h" #endif #include "plEAXEffects.h" #include "plAudioCore/plAudioCore.h" diff --git a/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h b/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h index efe804bc..97a67531 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h @@ -62,7 +62,11 @@ class plEAXListenerMod; #ifdef EAX_SDK_AVAILABLE typedef struct _EAXREVERBPROPERTIES EAXREVERBPROPERTIES; #else -#include +#include "plEAXStructures.h" +#endif + +#if !HS_BUILD_FOR_WIN32 +#define GUID char* #endif class plEAXListener diff --git a/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp b/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp index 98731f22..5b6e2af2 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ////////////////////////////////////////////////////////////////////////////// #ifndef EAX_SDK_AVAILABLE -#include +#include "plEAXStructures.h" #endif #include "hsTypes.h" #include "plEAXListenerMod.h" diff --git a/Sources/Plasma/PubUtilLib/plAudio/plEAXStructures.h b/Sources/Plasma/PubUtilLib/plAudio/plEAXStructures.h new file mode 100644 index 00000000..7cdf7e29 --- /dev/null +++ b/Sources/Plasma/PubUtilLib/plAudio/plEAXStructures.h @@ -0,0 +1,80 @@ +/*==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Additional permissions under GNU GPL version 3 section 7 + +If you modify this Program, or any covered work, by linking or +combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, +NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent +JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK +(or a modified version of those libraries), +containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, +PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG +JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the +licensors of this Program grant you additional +permission to convey the resulting work. Corresponding Source for a +non-source form of such a combination shall include the source code for +the parts of OpenSSL and IJG JPEG Library used as well as that of the covered +work. + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + +*==LICENSE==*/ + +#ifndef plEAXStructures_h_inc +#define plEAXStructures_h_inc + +typedef struct _EAXVECTOR { + float x; + float y; + float z; +} EAXVECTOR; + +typedef struct _EAXREVERBPROPERTIES +{ + unsigned long ulEnvironment; + float flEnvironmentSize; + float flEnvironmentDiffusion; + long lRoom; + long lRoomHF; + long lRoomLF; + float flDecayTime; + float flDecayHFRatio; + float flDecayLFRatio; + long lReflections; + float flReflectionsDelay; + EAXVECTOR vReflectionsPan; + long lReverb; + float flReverbDelay; + EAXVECTOR vReverbPan; + float flEchoTime; + float flEchoDepth; + float flModulationTime; + float flModulationDepth; + float flAirAbsorptionHF; + float flHFReference; + float flLFReference; + float flRoomRolloffFactor; + unsigned long ulFlags; +} EAXREVERBPROPERTIES, *LPEAXREVERBPROPERTIES; + +#endif //plEAXStructures_h_inc From 3398938d31b2c119cf2eb2169148ad88682251bc Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 27 Nov 2011 19:12:18 -0800 Subject: [PATCH 12/13] Fix a bunch of warnings from clang. --- .../Apps/plPythonPack/PythonInterface.cpp | 7 +++--- .../Apps/plPythonPack/PythonInterface.h | 9 +++---- Sources/Plasma/Apps/plPythonPack/main.cpp | 20 +++++++--------- Sources/Plasma/CoreLib/hsCritSect.cpp | 2 +- Sources/Plasma/CoreLib/hsFastMath.cpp | 4 ++-- Sources/Plasma/CoreLib/hsStringTokenizer.cpp | 20 ++++++++-------- Sources/Plasma/CoreLib/hsTemplates.h | 1 + Sources/Plasma/CoreLib/hsWide.h | 10 ++++---- .../NucleusLib/pnDispatch/plDispatch.cpp | 4 ++-- .../Plasma/NucleusLib/pnDispatch/plDispatch.h | 6 ++--- .../NucleusLib/pnKeyedObject/plUoid.cpp | 2 +- .../pnSceneObject/plCoordinateInterface.cpp | 4 ++-- .../pnSceneObject/plSceneObject.cpp | 6 ++--- Sources/Plasma/NucleusLib/pnTimer/hsTimer.cpp | 2 ++ .../plClientResMgr/plClientResMgr.cpp | 2 +- .../plClientResMgr/plClientResMgr.h | 2 +- .../PubUtilLib/plContainer/plConfigInfo.cpp | 24 +++++++++---------- .../plContainer/plKeysAndValues.cpp | 6 +++-- .../Plasma/PubUtilLib/plFile/plFileUtils.cpp | 22 +++++++++-------- .../PubUtilLib/plGImage/plDynamicTextMap.cpp | 2 +- .../Plasma/PubUtilLib/plGImage/plMipmap.cpp | 8 +++---- .../PubUtilLib/plInterp/plAnimTimeConvert.cpp | 8 +++---- .../PubUtilLib/plInterp/plController.cpp | 2 +- .../plParticleSystem/plParticleEffect.cpp | 2 +- .../plParticleSystem/plParticleSystem.cpp | 16 ++++++------- .../PubUtilLib/plResMgr/plBSDiffBuffer.cpp | 4 ++-- .../PubUtilLib/plResMgr/plKeyFinder.cpp | 2 +- Sources/Plasma/PubUtilLib/plSDL/plSDL.h | 2 +- .../PubUtilLib/plSDL/plStateVariable.cpp | 9 ++++--- .../PubUtilLib/plStatusLog/plStatusLog.cpp | 4 ++-- .../PubUtilLib/plSurface/plLayerAnimation.cpp | 4 ++-- .../PubUtilLib/plTransform/mat_decomp.cpp | 4 ++-- 32 files changed, 114 insertions(+), 106 deletions(-) diff --git a/Sources/Plasma/Apps/plPythonPack/PythonInterface.cpp b/Sources/Plasma/Apps/plPythonPack/PythonInterface.cpp index 5bfbd5c7..d6db9154 100644 --- a/Sources/Plasma/Apps/plPythonPack/PythonInterface.cpp +++ b/Sources/Plasma/Apps/plPythonPack/PythonInterface.cpp @@ -39,7 +39,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" #include "PythonInterface.h" #include "compile.h" @@ -139,7 +138,7 @@ void PythonInterface::finiPython() // // PURPOSE : run a python string in a specific module name // -PyObject* PythonInterface::CompileString(char *command, char* filename) +PyObject* PythonInterface::CompileString(const char *command, const char* filename) { PyObject* pycode = Py_CompileString(command, filename, Py_file_input); return pycode; @@ -220,7 +219,7 @@ int PythonInterface::getOutputAndReset(char** line) // // PURPOSE : create a new module with built-ins // -PyObject* PythonInterface::CreateModule(char* module) +PyObject* PythonInterface::CreateModule(const char* module) { PyObject *m, *d; // first we must get rid of any old modules of the same name, we'll replace it @@ -291,7 +290,7 @@ hsBool PythonInterface::RunPYC(PyObject* code, PyObject* module) // // PURPOSE : get an item (probably a function) from a specific module // -PyObject* PythonInterface::GetModuleItem(char* item, PyObject* module) +PyObject* PythonInterface::GetModuleItem(const char* item, PyObject* module) { if ( module ) { diff --git a/Sources/Plasma/Apps/plPythonPack/PythonInterface.h b/Sources/Plasma/Apps/plPythonPack/PythonInterface.h index 80db724a..8956a330 100644 --- a/Sources/Plasma/Apps/plPythonPack/PythonInterface.h +++ b/Sources/Plasma/Apps/plPythonPack/PythonInterface.h @@ -39,7 +39,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "Python.h" +#include +#include "hsTypes.h" #include @@ -50,10 +51,10 @@ namespace PythonInterface // So the Python packer can add extra paths void addPythonPath(std::string dir); - PyObject* CompileString(char *command, char* filename); + PyObject* CompileString(const char *command, const char* filename); hsBool DumpObject(PyObject* pyobj, char** pickle, Int32* size); int getOutputAndReset(char** line=nil); - PyObject* CreateModule(char* module); + PyObject* CreateModule(const char* module); hsBool RunPYC(PyObject* code, PyObject* module); - PyObject* GetModuleItem(char* item, PyObject* module); + PyObject* GetModuleItem(const char* item, PyObject* module); } diff --git a/Sources/Plasma/Apps/plPythonPack/main.cpp b/Sources/Plasma/Apps/plPythonPack/main.cpp index 2fc5af5e..56940d57 100644 --- a/Sources/Plasma/Apps/plPythonPack/main.cpp +++ b/Sources/Plasma/Apps/plPythonPack/main.cpp @@ -39,11 +39,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ +#include "PythonInterface.h" + #include "hsStream.h" #include "plFile/hsFiles.h" -#include "PythonInterface.h" - #include #include #include @@ -123,14 +123,14 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s) } // import the module first, to make packages work correctly - PyImport_ImportModule((char*)fileName.c_str()); - PyObject* pythonCode = PythonInterface::CompileString(code, (char*)fileName.c_str()); + PyImport_ImportModule(fileName.c_str()); + PyObject* pythonCode = PythonInterface::CompileString(code, fileName.c_str()); if (pythonCode) { // we need to find out if this is PythonFile module // create a module name... with the '.' as an X // and create a python file name that is without the ".py" - PyObject* fModule = PythonInterface::CreateModule((char*)fileName.c_str()); + PyObject* fModule = PythonInterface::CreateModule(fileName.c_str()); // run the code if (PythonInterface::RunPYC(pythonCode, fModule) ) { @@ -166,7 +166,7 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s) // else // skip the CRs } - pythonCode = PythonInterface::CompileString(code, (char*)fileName.c_str()); + pythonCode = PythonInterface::CompileString(code, fileName.c_str()); hsAssert(pythonCode,"Not sure why this didn't compile the second time???"); printf("an import file "); } @@ -181,8 +181,7 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s) int chars_read = PythonInterface::getOutputAndReset(&errmsg); if (chars_read > 0) { - printf(errmsg); - printf("\n"); + printf("%s\n", errmsg); } } } @@ -200,8 +199,7 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s) int chars_read = PythonInterface::getOutputAndReset(&errmsg); if (chars_read > 0) { - printf(errmsg); - printf("\n"); + printf("%s\n", errmsg); } s->WriteLE32(size); s->Write(size, pycode); @@ -218,7 +216,7 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s) int chars_read = PythonInterface::getOutputAndReset(&errmsg); if (chars_read > 0) { - printf(errmsg); + printf("%s\n", errmsg); } } diff --git a/Sources/Plasma/CoreLib/hsCritSect.cpp b/Sources/Plasma/CoreLib/hsCritSect.cpp index 93e299b5..fc02123f 100644 --- a/Sources/Plasma/CoreLib/hsCritSect.cpp +++ b/Sources/Plasma/CoreLib/hsCritSect.cpp @@ -83,7 +83,7 @@ void CCritSect::Leave () { #elif HS_BUILD_FOR_UNIX //=========================================================================== CCritSect::CCritSect () { - m_handle = PTHREAD_MUTEX_INITIALIZER; + m_handle = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER; } //=========================================================================== diff --git a/Sources/Plasma/CoreLib/hsFastMath.cpp b/Sources/Plasma/CoreLib/hsFastMath.cpp index b3737f89..d6e679b4 100644 --- a/Sources/Plasma/CoreLib/hsFastMath.cpp +++ b/Sources/Plasma/CoreLib/hsFastMath.cpp @@ -606,8 +606,8 @@ hsScalar hsFastMath::IATan2OverTwoPi(hsScalar y, hsScalar x) return 0; hsBool xNeg, yNeg; - if( yNeg = (y < 0) )y = -y; - if( xNeg = (x < 0) )x = -x; + if((yNeg = (y < 0)))y = -y; + if((xNeg = (x < 0)))x = -x; hsBool yBigger = y >= x; hsScalar div = yBigger ? x / y : y / x; diff --git a/Sources/Plasma/CoreLib/hsStringTokenizer.cpp b/Sources/Plasma/CoreLib/hsStringTokenizer.cpp index 8ba12996..b219d542 100644 --- a/Sources/Plasma/CoreLib/hsStringTokenizer.cpp +++ b/Sources/Plasma/CoreLib/hsStringTokenizer.cpp @@ -57,8 +57,8 @@ fLastTerminator(nil) hsStringTokenizer::~hsStringTokenizer() { - delete [] fString; - delete [] fSeps; + delete[] fString; + delete[] fSeps; } hsBool hsStringTokenizer::HasMoreTokens() @@ -134,11 +134,11 @@ void hsStringTokenizer::RestoreLastTerminator( void ) void hsStringTokenizer::Reset(const char *string, const char *seps) { if (fString) - delete [] fString; + delete[] fString; fString = string ? hsStrcpy(string) : nil; if (fSeps) - delete [] fSeps; + delete[] fSeps; fSeps = seps ? hsStrcpy(seps) : nil; fNumSeps = fSeps ? strlen(fSeps) : 0; fCheckAlphaNum = false; @@ -181,8 +181,8 @@ hsWStringTokenizer::hsWStringTokenizer(const wchar *string, const wchar *seps) : hsWStringTokenizer::~hsWStringTokenizer() { - delete [] fString; - delete [] fSeps; + delete[] fString; + delete[] fSeps; } hsBool hsWStringTokenizer::HasMoreTokens() @@ -259,11 +259,11 @@ void hsWStringTokenizer::RestoreLastTerminator( void ) void hsWStringTokenizer::Reset(const wchar *string, const wchar *seps) { if (fString) - delete [] fString; + delete[] fString; if (string) { int count = wcslen(string); - fString = TRACKED_NEW(wchar[count + 1]); + fString = new wchar[count + 1]; wcscpy(fString, string); fString[count] = L'\0'; } @@ -271,11 +271,11 @@ void hsWStringTokenizer::Reset(const wchar *string, const wchar *seps) fString = nil; if (fSeps) - delete [] fSeps; + delete[] fSeps; if (seps) { int count = wcslen(seps); - fSeps = TRACKED_NEW(wchar[count + 1]); + fSeps = new wchar[count + 1]; wcscpy(fSeps, seps); fSeps[count] = L'\0'; } diff --git a/Sources/Plasma/CoreLib/hsTemplates.h b/Sources/Plasma/CoreLib/hsTemplates.h index f36bea0d..f3fb29b3 100644 --- a/Sources/Plasma/CoreLib/hsTemplates.h +++ b/Sources/Plasma/CoreLib/hsTemplates.h @@ -524,6 +524,7 @@ public: UInt16 GetNumAlloc() const { return fTotalCount; } }; +template void hsTArray_CopyForward(const T src[], T dst[], int count); template class hsTArray : public hsTArrayBase { diff --git a/Sources/Plasma/CoreLib/hsWide.h b/Sources/Plasma/CoreLib/hsWide.h index 132c87ed..cfd3ca88 100644 --- a/Sources/Plasma/CoreLib/hsWide.h +++ b/Sources/Plasma/CoreLib/hsWide.h @@ -58,8 +58,8 @@ struct hsWide { hsBool operator==(const hsWide& b) const { return fHi == b.fHi && fLo == b.fLo; } - hsBool operator<(const hsWide& b) const { return fHi < b.fHi || fHi == b.fHi && fLo < b.fLo; } - hsBool operator>( const hsWide& b) const { return fHi > b.fHi || fHi == b.fHi && fLo > b.fLo; } + hsBool operator<(const hsWide& b) const { return fHi < b.fHi || (fHi == b.fHi && fLo < b.fLo); } + hsBool operator>( const hsWide& b) const { return fHi > b.fHi || (fHi == b.fHi && fLo > b.fLo); } hsBool operator!=( const hsWide& b) const { return !( *this == b); } hsBool operator<=(const hsWide& b) const { return !(*this > b); } hsBool operator>=(const hsWide& b) const { return !(*this < b); } @@ -187,11 +187,11 @@ inline hsWide* hsWide::RoundRight(unsigned shift) inline Int32 hsWide::AsLong() const { #if HS_PIN_MATH_OVERFLOW - if (fHi > 0 || fHi == 0 && (Int32)fLo < 0) + if (fHi > 0 || (fHi == 0 && (Int32)fLo < 0)) { hsSignalMathOverflow(); return kPosInfinity32; } - if (fHi < -1L || fHi == -1L && (Int32)fLo >= 0) + if (fHi < -1L || (fHi == -1L && (Int32)fLo >= 0)) { hsSignalMathOverflow(); return kNegInfinity32; } @@ -201,7 +201,7 @@ inline Int32 hsWide::AsLong() const inline hsBool hsWide::IsWide() const { - return (fHi > 0 || fHi == 0 && (Int32)fLo < 0) || (fHi < -1L || fHi == -1L && (Int32)fLo >= 0); + return (fHi > 0 || (fHi == 0 && (Int32)fLo < 0)) || (fHi < -1L || (fHi == -1L && (Int32)fLo >= 0)); } inline hsFixed hsWide::AsFixed() const diff --git a/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp b/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp index 2d53c76c..78814c0d 100644 --- a/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp +++ b/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp @@ -286,7 +286,7 @@ void plDispatch::IMsgDispatch() fMsgCurrentMutex.Lock(); plMsgWrap* origTail = fMsgTail; - while( fMsgCurrent = fMsgHead ) + while((fMsgCurrent = fMsgHead)) { IDequeue(&fMsgHead, &fMsgTail); fMsgCurrentMutex.Unlock(); @@ -460,7 +460,7 @@ hsBool plDispatch::MsgSend(plMessage* msg, hsBool async) plTimeMsg* timeMsg; if( msg->GetTimeStamp() > hsTimer::GetSysSeconds() ) return ISortToDeferred(msg); - else if( timeMsg = plTimeMsg::ConvertNoRef(msg) ) + else if((timeMsg = plTimeMsg::ConvertNoRef(msg))) ICheckDeferred(timeMsg->DSeconds()); plMsgWrap* msgWrap = TRACKED_NEW plMsgWrap(msg); diff --git a/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.h b/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.h index 43fb794f..ac55e69e 100644 --- a/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.h +++ b/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.h @@ -145,9 +145,9 @@ public: virtual void UnRegisterForType(UInt16 hClass, const plKey& receiver) {} - virtual hsBool MsgSend(plMessage* msg) {} - virtual void MsgQueue(plMessage* msg){} - virtual void MsgQueueProcess(){} + virtual hsBool MsgSend(plMessage* msg) { return true; } + virtual void MsgQueue(plMessage* msg) {} + virtual void MsgQueueProcess() {} }; diff --git a/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp b/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp index d8494838..d870b6f7 100644 --- a/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp +++ b/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp @@ -274,7 +274,7 @@ plUoid& plUoid::operator=(const plUoid& rhs) // THIS SHOULD BE FOR DEBUGGING ONLY char* plUoid::StringIze(char* str) const // Format to displayable string { - sprintf(str, "(0x%x:0x%x:%s:C:[%lu,%lu])", + sprintf(str, "(0x%x:0x%x:%s:C:[%u,%u])", fLocation.GetSequenceNumber(), int(fLocation.GetFlags()), fObjectName, diff --git a/Sources/Plasma/NucleusLib/pnSceneObject/plCoordinateInterface.cpp b/Sources/Plasma/NucleusLib/pnSceneObject/plCoordinateInterface.cpp index 42c8ac56..9adddaf5 100644 --- a/Sources/Plasma/NucleusLib/pnSceneObject/plCoordinateInterface.cpp +++ b/Sources/Plasma/NucleusLib/pnSceneObject/plCoordinateInterface.cpp @@ -602,7 +602,7 @@ hsBool plCoordinateInterface::MsgReceive(plMessage* msg) ITransformChanged(false, kReasonUnknown, false); return true; } - else if( intRefMsg = plIntRefMsg::ConvertNoRef(msg) ) + else if((intRefMsg = plIntRefMsg::ConvertNoRef(msg))) { switch( intRefMsg->fType ) { @@ -641,7 +641,7 @@ hsBool plCoordinateInterface::MsgReceive(plMessage* msg) break; } } - else if( corrMsg = plCorrectionMsg::ConvertNoRef(msg) ) + else if((corrMsg = plCorrectionMsg::ConvertNoRef(msg))) { SetTransformPhysical(corrMsg->fLocalToWorld, corrMsg->fWorldToLocal); diff --git a/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.cpp b/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.cpp index 282155f4..fe6091e5 100644 --- a/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.cpp +++ b/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.cpp @@ -488,7 +488,7 @@ hsBool plSceneObject::MsgReceive(plMessage* msg) return true; } else - if( trans = plTransformMsg::ConvertNoRef(msg) ) // also catches the derived plDelayedTransformMsg + if((trans = plTransformMsg::ConvertNoRef(msg))) // also catches the derived plDelayedTransformMsg { if( fCoordinateInterface ) { @@ -498,7 +498,7 @@ hsBool plSceneObject::MsgReceive(plMessage* msg) return true; } else - if( att = plAttachMsg::ConvertNoRef(msg) ) + if((att = plAttachMsg::ConvertNoRef(msg))) { if( fCoordinateInterface ) { @@ -883,4 +883,4 @@ void plSceneObject::AddModifier(plModifier* mo) void plSceneObject::RemoveModifier(plModifier* mo) { IRemoveModifier(mo); -} \ No newline at end of file +} diff --git a/Sources/Plasma/NucleusLib/pnTimer/hsTimer.cpp b/Sources/Plasma/NucleusLib/pnTimer/hsTimer.cpp index f3026adf..ead7aad1 100644 --- a/Sources/Plasma/NucleusLib/pnTimer/hsTimer.cpp +++ b/Sources/Plasma/NucleusLib/pnTimer/hsTimer.cpp @@ -308,6 +308,8 @@ UInt32 hsTimer::GetPrecTickCount() return GetTickCount(); return ti.LowPart; +#else + return 1; #endif } UInt32 hsTimer::PrecSecsToTicks(hsScalar secs) diff --git a/Sources/Plasma/PubUtilLib/plClientResMgr/plClientResMgr.cpp b/Sources/Plasma/PubUtilLib/plClientResMgr/plClientResMgr.cpp index f79b5ded..adc8cff0 100644 --- a/Sources/Plasma/PubUtilLib/plClientResMgr/plClientResMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plClientResMgr/plClientResMgr.cpp @@ -1,4 +1,4 @@ -/*==LICENSE==* +/*==LICENSE==* CyanWorlds.com Engine - MMOG client, server and tools Copyright (C) 2011 Cyan Worlds, Inc. diff --git a/Sources/Plasma/PubUtilLib/plClientResMgr/plClientResMgr.h b/Sources/Plasma/PubUtilLib/plClientResMgr/plClientResMgr.h index 842d855d..f3c16b73 100644 --- a/Sources/Plasma/PubUtilLib/plClientResMgr/plClientResMgr.h +++ b/Sources/Plasma/PubUtilLib/plClientResMgr/plClientResMgr.h @@ -1,4 +1,4 @@ -/*==LICENSE==* +/*==LICENSE==* CyanWorlds.com Engine - MMOG client, server and tools Copyright (C) 2011 Cyan Worlds, Inc. diff --git a/Sources/Plasma/PubUtilLib/plContainer/plConfigInfo.cpp b/Sources/Plasma/PubUtilLib/plContainer/plConfigInfo.cpp index f2aee940..01901b0a 100644 --- a/Sources/Plasma/PubUtilLib/plContainer/plConfigInfo.cpp +++ b/Sources/Plasma/PubUtilLib/plContainer/plConfigInfo.cpp @@ -670,14 +670,14 @@ bool plIniConfigSource::WriteOutOf(plConfigInfo & configInfo) plConfigInfo::Values::const_iterator vi, ve; fConfigInfo->GetSectionIterators(si,se); - for (si; si!=se; ++si) + for (; si!=se; ++si) { file << std::endl << "[" << si->first.c_str() << "]"<< std::endl; if (fConfigInfo->GetKeyIterators(si->first, ki, ke)) - for (ki; ki!=ke; ++ki) + for (; ki!=ke; ++ki) { if (fConfigInfo->GetValueIterators(si->first, ki->first, vi, ve)) - for (vi; vi!=ve; ++vi) + for (; vi!=ve; ++vi) { file << ki->first.c_str() << "=" << vi->c_str() << std::endl; } @@ -738,14 +738,14 @@ bool plIniStreamConfigSource::WriteOutOf(plConfigInfo & configInfo) plConfigInfo::Values::const_iterator vi, ve; fConfigInfo->GetSectionIterators(si,se); - for (si; si!=se; ++si) + for (; si!=se; ++si) { ss << std::endl << "[" << si->first.c_str() << "]"<< std::endl; if (fConfigInfo->GetKeyIterators(si->first, ki, ke)) - for (ki; ki!=ke; ++ki) + for (; ki!=ke; ++ki) { if (fConfigInfo->GetValueIterators(si->first, ki->first, vi, ve)) - for (vi; vi!=ve; ++vi) + for (; vi!=ve; ++vi) { ss << ki->first.c_str() << "=" << vi->c_str() << std::endl; } @@ -887,13 +887,13 @@ bool plIniNoSectionsConfigSource::WriteOutOf(plConfigInfo & configInfo) plConfigInfo::Values::const_iterator vi, ve; fConfigInfo->GetSectionIterators(si,se); - for (si; si!=se; ++si) + for (; si!=se; ++si) { if (fConfigInfo->GetKeyIterators(si->first, ki, ke)) - for (ki; ki!=ke; ++ki) + for (; ki!=ke; ++ki) { if (fConfigInfo->GetValueIterators(si->first, ki->first, vi, ve)) - for (vi; vi!=ve; ++vi) + for (; vi!=ve; ++vi) { file << ki->first.c_str() << "=" << vi->c_str() << std::endl; } @@ -919,15 +919,15 @@ bool plDebugConfigSource::WriteOutOf(plConfigInfo & configInfo) char buf[1024]; fConfigInfo->GetSectionIterators(si,se); - for (si; si!=se; ++si) + for (; si!=se; ++si) { sprintf(buf,"\n[%s]\n",si->first.c_str()); hsStatusMessage(buf); if (fConfigInfo->GetKeyIterators(si->first, ki, ke)) - for (ki; ki!=ke; ++ki) + for (; ki!=ke; ++ki) { if (fConfigInfo->GetValueIterators(si->first, ki->first, vi, ve)) - for (vi; vi!=ve; ++vi) + for (; vi!=ve; ++vi) { sprintf(buf,"%s=%s\n",ki->first.c_str(),vi->c_str()); hsStatusMessage(buf); diff --git a/Sources/Plasma/PubUtilLib/plContainer/plKeysAndValues.cpp b/Sources/Plasma/PubUtilLib/plContainer/plKeysAndValues.cpp index 51848422..6be46c26 100644 --- a/Sources/Plasma/PubUtilLib/plContainer/plKeysAndValues.cpp +++ b/Sources/Plasma/PubUtilLib/plContainer/plKeysAndValues.cpp @@ -111,6 +111,8 @@ bool plKeysAndValues::AddValue(const std::string & key, const std::string & valu if (HasKey(key)) RemoveKey(key); break; + default: + break; } fKeys[key.c_str()].push_front(value.c_str()); return true; @@ -259,7 +261,7 @@ void plKeysAndValues::Write(hsStream * s) // iterate through keys Keys::const_iterator ki,ke; GetKeyIterators(ki,ke); - for (ki;ki!=ke;++ki) + for (;ki!=ke;++ki) { // write key string s->WriteLE((UInt16)ki->first.size()); @@ -269,7 +271,7 @@ void plKeysAndValues::Write(hsStream * s) // iterate through values for this key Values::const_iterator vi,ve; GetValueIterators(ki->first,vi,ve); - for (vi;vi!=ve;++vi) + for (;vi!=ve;++vi) { // write value string s->WriteLE((UInt16)vi->size()); diff --git a/Sources/Plasma/PubUtilLib/plFile/plFileUtils.cpp b/Sources/Plasma/PubUtilLib/plFile/plFileUtils.cpp index d54035db..9140f8c7 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plFileUtils.cpp +++ b/Sources/Plasma/PubUtilLib/plFile/plFileUtils.cpp @@ -104,8 +104,10 @@ hsBool plFileUtils::CreateDir( const wchar *path ) return ( _wmkdir( path ) == 0 ) ? true : ( errno==EEXIST ); #elif HS_BUILD_FOR_UNIX const char* cpath = hsWStringToString(path); - CreateDir(cpath); + bool ret = CreateDir(cpath); delete[] cpath; /* Free the string */ + + return ret; #endif } @@ -156,8 +158,10 @@ bool plFileUtils::RemoveFile(const wchar* filename, bool delReadOnly) return (_wunlink(filename) == 0); #elif HS_BUILD_FOR_UNIX const char* cfilename = hsWStringToString(filename); - RemoveFile(cfilename, delReadOnly); + bool ret = RemoveFile(cfilename, delReadOnly); delete[] cfilename; /* Free the string */ + + return ret; #endif } @@ -542,13 +546,11 @@ bool plFileUtils::GetSecureEncryptionKey(const wchar* filename, UInt32* key, uns return true; } - else - { - // file doesn't exist, use default key - unsigned memSize = min(length, arrsize(plSecureStream::kDefaultKey)); - memSize *= sizeof(UInt32); - memcpy(key, plSecureStream::kDefaultKey, memSize); - return false; - } + // file doesn't exist, use default key + unsigned memSize = min(length, arrsize(plSecureStream::kDefaultKey)); + memSize *= sizeof(UInt32); + memcpy(key, plSecureStream::kDefaultKey, memSize); + + return false; } diff --git a/Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.cpp b/Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.cpp index 780f407e..3e97bcf6 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.cpp @@ -251,7 +251,7 @@ void plDynamicTextMap::IDestroyOSSurface( void ) IRemoveFromMemRecord( (UInt8 *)fImage ); #endif - delete [] fImage; + delete[] (UInt32*)fImage; fImage = nil; plProfile_Dec(DynaTexts); diff --git a/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp b/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp index 9320d70d..d365dcfc 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp @@ -180,7 +180,7 @@ void plMipmap::Reset() IRemoveFromMemRecord( (UInt8 *)fImage ); #endif - delete [] fImage; + delete[] (UInt8*)fImage; plProfile_DelMem(MemMipmaps, fTotalSize); } fImage = nil; @@ -758,7 +758,7 @@ void plMipmap::ClipToMaxSize( UInt32 maxDimension ) #ifdef MEMORY_LEAK_TRACER IRemoveFromMemRecord( (UInt8 *)fImage ); #endif - delete [] fImage; + delete[] (UInt8*)fImage; plProfile_DelMem(MemMipmaps, fTotalSize); fImage = destData; @@ -789,7 +789,7 @@ void plMipmap::RemoveMipping() #ifdef MEMORY_LEAK_TRACER IRemoveFromMemRecord( (UInt8 *)fImage ); #endif - delete [] fImage; + delete[] (UInt8*)fImage; plProfile_DelMem(MemMipmaps, fTotalSize); fImage = destData; @@ -1556,7 +1556,7 @@ void plMipmap::CopyFrom( const plMipmap *source ) #ifdef MEMORY_LEAK_TRACER IRemoveFromMemRecord( (UInt8 *)fImage ); #endif - delete [] fImage; + delete[] (UInt8*)fImage; fWidth = source->fWidth; fHeight = source->fHeight; diff --git a/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.cpp b/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.cpp index 1a913720..9c0281ee 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.cpp +++ b/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.cpp @@ -397,7 +397,7 @@ void plAnimTimeConvert::IFlushOldStates() plATCStateList::const_iterator i = fStates.begin(); UInt32 count = 0; - for (i; i != fStates.end(); i++) + for (; i != fStates.end(); i++) { count++; state = *i; @@ -426,7 +426,7 @@ plATCState *plAnimTimeConvert::IGetState(double wSecs) const plATCState *state; plATCStateList::const_iterator i = fStates.begin(); - for (i; i != fStates.end(); i++) + for (; i != fStates.end(); i++) { state = *i; if (wSecs >= state->fStartWorldTime) @@ -589,7 +589,7 @@ hsScalar plAnimTimeConvert::WorldToAnimTime(double wSecs) // 2. Same as #1, but in the backwards case. // 3. We started before the wrap point, now we're after it. Stop. // 4. Same as #3, backwards. - if ((wrapped && (forewards && secs >= fWrapTime) || + if (((wrapped && (forewards && secs >= fWrapTime)) || (!forewards && secs <= fWrapTime)) || (forewards && fCurrentAnimTime < fWrapTime && secs >= fWrapTime) || (!forewards && fCurrentAnimTime > fWrapTime && secs <= fWrapTime)) @@ -700,7 +700,7 @@ hsScalar plAnimTimeConvert::IWorldToAnimTimeNoUpdate(double wSecs, plATCState *s if (state->fFlags & kWrap) { - if ((wrapped && (forewards && secs >= state->fWrapTime) || + if (((wrapped && (forewards && secs >= state->fWrapTime)) || (!forewards && secs <= state->fWrapTime)) || (forewards && state->fStartAnimTime < state->fWrapTime && secs >= state->fWrapTime) || (!forewards && state->fStartAnimTime > state->fWrapTime && secs <= state->fWrapTime)) diff --git a/Sources/Plasma/PubUtilLib/plInterp/plController.cpp b/Sources/Plasma/PubUtilLib/plInterp/plController.cpp index 298e3708..2e9400cd 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plController.cpp +++ b/Sources/Plasma/PubUtilLib/plInterp/plController.cpp @@ -76,7 +76,7 @@ void plControllerCacheInfo::SetATC(plAnimTimeConvert *atc) plLeafController::~plLeafController() { - delete [] fKeys; + delete[] fKeys; } void plLeafController::Interp(hsScalar time, hsScalar* result, plControllerCacheInfo *cache) const diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.cpp b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.cpp index 838a4574..b84c8df5 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.cpp +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.cpp @@ -81,7 +81,7 @@ hsBool plParticleCollisionEffect::MsgReceive(plMessage* msg) plSceneObject *so; if (refMsg) { - if (so = plSceneObject::ConvertNoRef(refMsg->GetRef())) + if ((so = plSceneObject::ConvertNoRef(refMsg->GetRef()))) { if( refMsg->GetContext() & (plRefMsg::kOnCreate|plRefMsg::kOnRequest|plRefMsg::kOnReplace) ) fSceneObj = so; diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.cpp b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.cpp index 243dc6e3..c07c9492 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.cpp +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.cpp @@ -484,16 +484,16 @@ hsBool plParticleSystem::MsgReceive(plMessage* msg) plRenderMsg *rend; plAgeLoadedMsg* ageLoaded; - if (rend = plRenderMsg::ConvertNoRef(msg)) + if ((rend = plRenderMsg::ConvertNoRef(msg))) { plProfile_BeginLap(ParticleSys, this->GetKey()->GetUoid().GetObjectName()); IHandleRenderMsg(rend->Pipeline()); plProfile_EndLap(ParticleSys, this->GetKey()->GetUoid().GetObjectName()); return true; } - else if (refMsg = plGenRefMsg::ConvertNoRef(msg)) + else if ((refMsg = plGenRefMsg::ConvertNoRef(msg))) { - if (scene = plSceneObject::ConvertNoRef(refMsg->GetRef())) + if ((scene = plSceneObject::ConvertNoRef(refMsg->GetRef()))) { if (refMsg->GetContext() & (plRefMsg::kOnCreate|plRefMsg::kOnRequest|plRefMsg::kOnReplace)) AddTarget(scene); @@ -501,7 +501,7 @@ hsBool plParticleSystem::MsgReceive(plMessage* msg) RemoveTarget(scene); return true; } - if (mat = hsGMaterial::ConvertNoRef(refMsg->GetRef())) + if ((mat = hsGMaterial::ConvertNoRef(refMsg->GetRef()))) { if (refMsg->GetContext() & (plRefMsg::kOnCreate|plRefMsg::kOnRequest|plRefMsg::kOnReplace)) fTexture = mat; @@ -509,7 +509,7 @@ hsBool plParticleSystem::MsgReceive(plMessage* msg) fTexture = nil; return true; } - if (effect = plParticleEffect::ConvertNoRef(refMsg->GetRef())) + if ((effect = plParticleEffect::ConvertNoRef(refMsg->GetRef()))) { if (refMsg->GetContext() & (plRefMsg::kOnCreate|plRefMsg::kOnRequest|plRefMsg::kOnReplace)) IAddEffect(effect, refMsg->fType); @@ -518,12 +518,12 @@ hsBool plParticleSystem::MsgReceive(plMessage* msg) return true; } } - else if (partMsg = plParticleUpdateMsg::ConvertNoRef(msg)) + else if ((partMsg = plParticleUpdateMsg::ConvertNoRef(msg))) { UpdateGenerator(partMsg->GetParamID(), partMsg->GetParamValue()); return true; } - else if (killMsg = plParticleKillMsg::ConvertNoRef(msg)) + else if ((killMsg = plParticleKillMsg::ConvertNoRef(msg))) { KillParticles(killMsg->fNumToKill, killMsg->fTimeLeft, killMsg->fFlags); return true; @@ -714,4 +714,4 @@ void plParticleSystem::SetAttachedToAvatar(bool attached) void plParticleSystem::AddLight(plKey liKey) { fPermaLights.Append(liKey); -} \ No newline at end of file +} diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plBSDiffBuffer.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plBSDiffBuffer.cpp index 6eeec14b..a3c89553 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plBSDiffBuffer.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plBSDiffBuffer.cpp @@ -297,7 +297,7 @@ void plBSDiffBuffer::GetBuffer( UInt32 &length, void *&bufferPtr ) if (fPatchBuffer && fPatchLength) { length = fPatchLength; - if (bufferPtr = (void *)TRACKED_NEW unsigned char[ length ]) + if ((bufferPtr = (void *)new unsigned char[ length ])) memcpy(bufferPtr, fPatchBuffer, length); } else @@ -432,7 +432,7 @@ UInt32 plBSDiffBuffer::Patch( UInt32 oldLength, void *oldBuffer, UInt32 &newLeng if(newpos != newend) { - delete[] newBuffer; + delete[] (unsigned char*)newBuffer; newLength = 0; } diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp index 7f7919ee..45476472 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp @@ -376,7 +376,7 @@ class plPageFinder : public plRegistryPageIterator } // Try for full location - sprintf( str, "%s_%s_%s", info.GetAge(), info.GetPage() ); + sprintf( str, "%s_%s", info.GetAge(), info.GetPage() ); if( stricmp( str, fFindString ) == 0 ) { *fPagePtr = node; diff --git a/Sources/Plasma/PubUtilLib/plSDL/plSDL.h b/Sources/Plasma/PubUtilLib/plSDL/plSDL.h index d93bc17f..4daeba0e 100644 --- a/Sources/Plasma/PubUtilLib/plSDL/plSDL.h +++ b/Sources/Plasma/PubUtilLib/plSDL/plSDL.h @@ -446,7 +446,7 @@ public: plSimpleStateVariable* FindVar(const char* name) const { return (plSimpleStateVariable*)IFindVar(fVarsList, name); } plSDStateVariable* FindSDVar(const char* name) const { return (plSDStateVariable*)IFindVar(fSDVarsList, name); } - plStateDataRecord& operator=(const plStateDataRecord& other) { CopyFrom(other); } + plStateDataRecord& operator=(const plStateDataRecord& other) { CopyFrom(other); return *this; } void CopyFrom(const plStateDataRecord& other, UInt32 writeOptions=0); void UpdateFrom(const plStateDataRecord& other, UInt32 writeOptions=0); void SetFromDefaults(bool timeStampNow); diff --git a/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp b/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp index 2440534f..89b4485a 100644 --- a/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp +++ b/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp @@ -92,12 +92,12 @@ public: int fDataLen; plSDLCreatableStub(UInt16 classIndex, int len) : fClassIndex(classIndex),fData(nil),fDataLen(len) {} - ~plSDLCreatableStub() { delete [] fData; } + ~plSDLCreatableStub() { delete[] (char*)fData; } const char* ClassName() const { return "SDLCreatable"; } UInt16 ClassIndex() const { return fClassIndex; } - void Read(hsStream* s, hsResMgr* mgr) { delete [] fData; fData = TRACKED_NEW char[fDataLen]; s->Read(fDataLen, fData); } + void Read(hsStream* s, hsResMgr* mgr) { delete[] (char*)fData; fData = new char[fDataLen]; s->Read(fDataLen, fData); } void Write(hsStream* s, hsResMgr* mgr) { s->Write(fDataLen, fData); } }; @@ -112,7 +112,7 @@ void plStateVarNotificationInfo::Read(hsStream* s, UInt32 readOptions) if (hint && !(readOptions & plSDL::kSkipNotificationInfo)) fHintString = (const char*)hint; // we're done with it... - delete [] hint; + delete[] hint; } void plStateVarNotificationInfo::Write(hsStream* s, UInt32 writeOptions) const @@ -1874,6 +1874,8 @@ bool plSimpleStateVariable::IWriteData(hsStream* s, float timeConvert, int idx, } } break; + default: + break; } return true; } @@ -2162,6 +2164,7 @@ void plSimpleStateVariable::NotifyStateChange(const plSimpleStateVariable* other NOTIFY_CHECK(plVarDescriptor::kByte, fBy) NOTIFY_CHECK(plVarDescriptor::kFloat, fF) NOTIFY_CHECK(plVarDescriptor::kDouble, fD) + default: break; } } if (notify) diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp index 7740cabd..147777d1 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp @@ -826,12 +826,12 @@ bool plStatusLog::IPrintLineToFile( const char *line, UInt32 count ) } if (fFlags & kRawTimeStamp) { - snprintf(work, arrsize(work), "[t=%10u] ", hsTimer::GetSeconds()); + snprintf(work, arrsize(work), "[t=%10f] ", hsTimer::GetSeconds()); strncat(buf, work, arrsize(work)); } if (fFlags & kThreadID) { - snprintf(work, arrsize(work), "[t=%u] ", hsThread::GetMyThreadId()); + snprintf(work, arrsize(work), "[t=%lu] ", hsThread::GetMyThreadId()); strncat(buf, work, arrsize(work)); } diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp b/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp index a56a132d..6882e336 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp @@ -583,7 +583,7 @@ hsBool plLayerLinkAnimation::MsgReceive( plMessage* pMsg ) if (msg->HasLinkFlag(plLinkEffectBCMsg::kSendCallback)) { plLinkEffectsMgr *mgr; - if (mgr = plLinkEffectsMgr::ConvertNoRef(msg->GetSender()->ObjectIsLoaded())) + if ((mgr = plLinkEffectsMgr::ConvertNoRef(msg->GetSender()->ObjectIsLoaded()))) mgr->WaitForEffect(msg->fLinkKey, fTimeConvert.GetEnd() - fTimeConvert.GetBegin()); } } @@ -603,7 +603,7 @@ hsBool plLayerLinkAnimation::MsgReceive( plMessage* pMsg ) // add a callback for when it's done if it's in forward plLinkEffectsMgr *mgr; - if (mgr = plLinkEffectsMgr::ConvertNoRef(pMsg->GetSender()->ObjectIsLoaded())) + if ((mgr = plLinkEffectsMgr::ConvertNoRef(pMsg->GetSender()->ObjectIsLoaded()))) if (pSeudoMsg->fForward) mgr->WaitForPseudoEffect(fLinkKey, fTimeConvert.GetEnd() - fTimeConvert.GetBegin()); diff --git a/Sources/Plasma/PubUtilLib/plTransform/mat_decomp.cpp b/Sources/Plasma/PubUtilLib/plTransform/mat_decomp.cpp index ebdd9e5c..385eceab 100644 --- a/Sources/Plasma/PubUtilLib/plTransform/mat_decomp.cpp +++ b/Sources/Plasma/PubUtilLib/plTransform/mat_decomp.cpp @@ -437,7 +437,7 @@ gemQuat snuggle(gemQuat q, HVect *k) mag[0] = (double)q.z*q.z+(double)q.w*q.w-0.5; mag[1] = (double)q.x*q.z-(double)q.y*q.w; mag[2] = (double)q.y*q.z+(double)q.x*q.w; - for (i=0; i<3; i++) if (neg[i] = (mag[i]<0.0)) mag[i] = -mag[i]; + for (i=0; i<3; i++) if ((neg[i] = (mag[i]<0.0))) mag[i] = -mag[i]; if (mag[0]>mag[1]) {if (mag[0]>mag[2]) win = 0; else win = 2;} else {if (mag[1]>mag[2]) win = 1; else win = 2;} switch (win) { @@ -456,7 +456,7 @@ gemQuat snuggle(gemQuat q, HVect *k) qa[0] = q.x; qa[1] = q.y; qa[2] = q.z; qa[3] = q.w; for (i=0; i<4; i++) { pa[i] = 0.0; - if (neg[i] = (qa[i]<0.0)) qa[i] = -qa[i]; + if ((neg[i] = (qa[i]<0.0))) qa[i] = -qa[i]; par ^= neg[i]; } /* Find two largest components, indices in hi and lo */ From 79f1714730db5275c9ff0623a33911b943fe70f8 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Wed, 30 Nov 2011 21:42:04 -0800 Subject: [PATCH 13/13] Fixes for plGLight errors. --- .../Plasma/PubUtilLib/plGLight/plLightInfo.cpp | 10 +++++++--- .../PubUtilLib/plGLight/plPerspDirSlave.cpp | 15 ++++++++++----- .../Plasma/PubUtilLib/plGLight/plShadowMaster.cpp | 6 ++++-- .../Plasma/PubUtilLib/plGLight/plShadowSlave.cpp | 9 +++++++-- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp b/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp index 737549d9..e2a3b8ff 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp @@ -763,7 +763,8 @@ void plOmniLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& str // Volume - Want to base this on the closest point on the bounds, instead of just the center. const hsPoint3& pos = bnd.GetCenter(); - hsScalar dist = hsVector3(&pos, &GetWorldPosition()).MagnitudeSquared(); + hsPoint3 wpos = GetWorldPosition(); + hsScalar dist = hsVector3(&pos, &wpos).MagnitudeSquared(); dist = 1.f / hsFastMath::InvSqrtAppr(dist); if( fAttenQuadratic > 0 ) { @@ -833,7 +834,9 @@ void plOmniLightInfo::IRefresh() hsVector3 plOmniLightInfo::GetNegativeWorldDirection(const hsPoint3& pos) const { - return hsFastMath::NormalizeAppr(hsVector3(&GetWorldPosition(), &pos)); + hsPoint3 wpos = GetWorldPosition(); + hsVector3 tmp(&wpos, &pos); + return hsFastMath::NormalizeAppr(tmp); } void plOmniLightInfo::Read(hsStream* s, hsResMgr* mgr) @@ -903,7 +906,8 @@ void plSpotLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& str const hsPoint3& pos = bnd.GetCenter(); hsVector3 del; - del.Set(&pos, &GetWorldPosition()); + hsPoint3 wpos = GetWorldPosition(); + del.Set(&pos, &wpos); hsScalar invDist = del.MagnitudeSquared(); invDist = hsFastMath::InvSqrtAppr(invDist); diff --git a/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp b/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp index a3a26fc2..97e2e318 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp @@ -48,6 +48,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plPerspDirSlave.h" #include +#include + +#ifndef isnan +#define isnan _isnan +#endif void plPerspDirSlave::Init() { @@ -183,9 +188,9 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) // 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)) + if (isnan(bnd.GetMins().fX) || isnan(bnd.GetMins().fY)) return false; - if (_isnan(bnd.GetMaxs().fX) || _isnan(bnd.GetMaxs().fY)) + if (isnan(bnd.GetMaxs().fX) || isnan(bnd.GetMaxs().fY)) return false; // THIS IS EVEN MORE WRONG @@ -244,9 +249,9 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) // 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)) + if (isnan(bnd.GetMins().fX) || isnan(bnd.GetMins().fY)) return false; - if (_isnan(bnd.GetMaxs().fX) || _isnan(bnd.GetMaxs().fY)) + if (isnan(bnd.GetMaxs().fX) || isnan(bnd.GetMaxs().fY)) return false; plConst(hsScalar) kMinMinZ(1.f); @@ -385,4 +390,4 @@ void plPerspDirSlave::IComputeCamNDCToLight(const hsPoint3& from, const hsPoint3 camNDC2Li = w2light; li2CamNDC = light2w; -} \ No newline at end of file +} diff --git a/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.cpp b/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.cpp index b535bc75..c6b68fa3 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.cpp @@ -402,10 +402,12 @@ plShadowSlave* plShadowMaster::ILastChanceToBail(plShadowCastMsg* castMsg, plSha wBnd.TestPlane(castMsg->Pipeline()->GetViewDirWorld(), depth); hsScalar eyeDist = castMsg->Pipeline()->GetViewDirWorld().InnerProduct(castMsg->Pipeline()->GetViewPositionWorld()); #else - hsVector3 dir(&wBnd.GetCenter(), &castMsg->Pipeline()->GetViewPositionWorld()); + hsPoint3 centre = wBnd.GetCenter(); + hsPoint3 vpos = castMsg->Pipeline()->GetViewPositionWorld(); + hsVector3 dir(¢re, &vpos); hsFastMath::NormalizeAppr(dir); wBnd.TestPlane(dir, depth); - hsScalar eyeDist = dir.InnerProduct(castMsg->Pipeline()->GetViewPositionWorld()); + hsScalar eyeDist = dir.InnerProduct(vpos); #endif hsScalar dist = depth.fX - eyeDist; diff --git a/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp b/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp index a059193e..a5755f31 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp @@ -46,6 +46,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plTweak.h" #include +#include + +#ifndef isnan +#define isnan _isnan +#endif static const hsScalar kMinMinZ = 1.f; // totally random arbitrary number (has to be > 0). @@ -132,9 +137,9 @@ bool plShadowSlave::ISetupPerspViewTransform() // 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)) + if (isnan(bnd.GetMins().fX) || isnan(bnd.GetMins().fY)) return false; - if (_isnan(bnd.GetMaxs().fX) || _isnan(bnd.GetMaxs().fY)) + if (isnan(bnd.GetMaxs().fX) || isnan(bnd.GetMaxs().fY)) return false; hsScalar cotX, cotY;