Browse Source

Merge pull request #104 from dpogue/linux

Next round of Linux fixes
Adam Johnson 13 years ago
parent
commit
8e4e1eb905
  1. 7
      Sources/Plasma/Apps/plPythonPack/PythonInterface.cpp
  2. 9
      Sources/Plasma/Apps/plPythonPack/PythonInterface.h
  3. 20
      Sources/Plasma/Apps/plPythonPack/main.cpp
  4. 4
      Sources/Plasma/CoreLib/hsConfig.h
  5. 2
      Sources/Plasma/CoreLib/hsCritSect.cpp
  6. 4
      Sources/Plasma/CoreLib/hsFastMath.cpp
  7. 20
      Sources/Plasma/CoreLib/hsStringTokenizer.cpp
  8. 1
      Sources/Plasma/CoreLib/hsTemplates.h
  9. 2
      Sources/Plasma/CoreLib/hsTypes.h
  10. 1
      Sources/Plasma/CoreLib/hsUtils.h
  11. 10
      Sources/Plasma/CoreLib/hsWide.h
  12. 3
      Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp
  13. 12
      Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp
  14. 5
      Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.cpp
  15. 10
      Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp
  16. 12
      Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.cpp
  17. 4
      Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp
  18. 6
      Sources/Plasma/NucleusLib/pnDispatch/plDispatch.h
  19. 2
      Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp
  20. 4
      Sources/Plasma/NucleusLib/pnSceneObject/plCoordinateInterface.cpp
  21. 6
      Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.cpp
  22. 2
      Sources/Plasma/NucleusLib/pnTimer/hsTimer.cpp
  23. 6
      Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp
  24. 3
      Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp
  25. 2
      Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.h
  26. 12
      Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp
  27. 6
      Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h
  28. 2
      Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp
  29. 80
      Sources/Plasma/PubUtilLib/plAudio/plEAXStructures.h
  30. 18
      Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp
  31. 7
      Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp
  32. 14
      Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp
  33. 1
      Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h
  34. 21
      Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp
  35. 2
      Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h
  36. 2
      Sources/Plasma/PubUtilLib/plClientResMgr/plClientResMgr.cpp
  37. 2
      Sources/Plasma/PubUtilLib/plClientResMgr/plClientResMgr.h
  38. 24
      Sources/Plasma/PubUtilLib/plContainer/plConfigInfo.cpp
  39. 6
      Sources/Plasma/PubUtilLib/plContainer/plKeysAndValues.cpp
  40. 22
      Sources/Plasma/PubUtilLib/plFile/plFileUtils.cpp
  41. 18
      Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp
  42. 12
      Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h
  43. 32
      Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp
  44. 2
      Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.h
  45. 19
      Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.cpp
  46. 2
      Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.cpp
  47. 2
      Sources/Plasma/PubUtilLib/plGImage/plFont.cpp
  48. 8
      Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp
  49. 10
      Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp
  50. 15
      Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp
  51. 6
      Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.cpp
  52. 9
      Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp
  53. 8
      Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.cpp
  54. 2
      Sources/Plasma/PubUtilLib/plInterp/plController.cpp
  55. 2
      Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.cpp
  56. 16
      Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.cpp
  57. 2
      Sources/Plasma/PubUtilLib/plPhysical/plPickingDetector.h
  58. 3
      Sources/Plasma/PubUtilLib/plPipeline/hsGDDrawDllLoad.h
  59. 4
      Sources/Plasma/PubUtilLib/plResMgr/plBSDiffBuffer.cpp
  60. 2
      Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp
  61. 2
      Sources/Plasma/PubUtilLib/plSDL/plSDL.h
  62. 9
      Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp
  63. 4
      Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp
  64. 4
      Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp
  65. 4
      Sources/Plasma/PubUtilLib/plTransform/mat_decomp.cpp

7
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 )
{

9
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 <Python.h>
#include "hsTypes.h"
#include <string>
@ -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);
}

20
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 <vector>
#include <string>
#include <algorithm>
@ -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);
}
}

4
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

2
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;
}
//===========================================================================

4
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;

20
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';
}

1
Sources/Plasma/CoreLib/hsTemplates.h

@ -524,6 +524,7 @@ public:
UInt16 GetNumAlloc() const { return fTotalCount; }
};
template <class T> void hsTArray_CopyForward(const T src[], T dst[], int count);
template <class T> class hsTArray : public hsTArrayBase
{

2
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 */

1
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

10
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

3
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);

12
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);

5
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 );
}
}

10
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());

12
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;
}

4
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);

6
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() {}
};

2
Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp

@ -274,7 +274,7 @@ plUoid& plUoid::operator=(const plUoid& rhs)
// THIS SHOULD BE FOR DEBUGGING ONLY <hint hint>
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,

4
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);

6
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);
}
}

2
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)

6
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);
}
}

3
Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp

@ -43,7 +43,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <al.h>
#include <alc.h>
#include <efx.h>
#include <MMREG.H>
#ifdef EAX_SDK_AVAILABLE
#include <eax.h>
#endif
@ -1296,4 +1295,4 @@ void plgAudioSys::SetListenerOrientation(const hsVector3 view, const hsVector3 u
{
fSys->SetListenerOrientation(view, up);
}
}
}

2
Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.h

@ -134,7 +134,7 @@ protected:
hsPoint3 fCurrListenerPos;//, fCommittedListenerPos;
hsBool fActive, fUsingEAX, fRestartOnDestruct, fWaitingForShutdown;
__int64 fStartTime;
Int64 fStartTime;
hsTArray<hsKeyedObject *> fMyRefs;
hsTArray<plEAXListenerMod *> fEAXRegions;

12
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 <EFX-Util.h>
#include "plEAXStructures.h"
#endif
#include "plEAXEffects.h"
#include "plAudioCore/plAudioCore.h"
@ -60,10 +60,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plAudioSystem.h"
#include <al.h>
#ifdef DX_OLD_SDK
#include <dxerr9.h>
#else
#include <dxerr.h>
#if HS_BUILD_FOR_WIN32
# ifdef DX_OLD_SDK
# include <dxerr9.h>
# else
# include <dxerr.h>
# endif
#endif
#ifdef EAX_SDK_AVAILABLE

6
Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h

@ -62,7 +62,11 @@ class plEAXListenerMod;
#ifdef EAX_SDK_AVAILABLE
typedef struct _EAXREVERBPROPERTIES EAXREVERBPROPERTIES;
#else
#include <EFX-Util.h>
#include "plEAXStructures.h"
#endif
#if !HS_BUILD_FOR_WIN32
#define GUID char*
#endif
class plEAXListener

2
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 <EFX-Util.h>
#include "plEAXStructures.h"
#endif
#include "hsTypes.h"
#include "plEAXListenerMod.h"

80
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 <http://www.gnu.org/licenses/>.
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

18
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);
}
}

7
Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp

@ -39,7 +39,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
Mead, WA 99021
*==LICENSE==*/
#include <direct.h>
#include "HeadSpin.h"
#include "hsGeometry3.h"
#include "hsTimer.h"
@ -60,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 <direct.h>
#else
# include <unistd.h>
#endif
plProfile_CreateMemCounter("Sounds", "Memory", MemSounds);
plProfile_Extern(SoundPlaying);

14
Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp

@ -39,12 +39,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
Mead, WA 99021
*==LICENSE==*/
#include <direct.h>
#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"
@ -58,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 <direct.h>
#else
# include <unistd.h>
#endif
#define STREAMING_UPDATE_MS 200
plProfile_Extern(MemSounds);
@ -179,9 +185,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 +512,4 @@ void plWin32StreamingSound::IAddCallback( plEventCallbackMsg *pCBMsg )
return;
}
plWin32Sound::IAddCallback( pCBMsg );
}
}

1
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;

21
Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp

@ -51,9 +51,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "plWinMicLevel.h"
#include "hsWindows.h"
#if HS_BUILD_FOR_WIN32
#include <mmsystem.h>
@ -79,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 /////////////////////////////////////////////////////////////
@ -88,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 )
@ -100,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 )
@ -110,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
}
@ -124,6 +137,7 @@ plWinMicLevel &plWinMicLevel::IGetInstance( void )
plWinMicLevel::plWinMicLevel()
{
#if HS_BUILD_FOR_WIN32
sMixerHandle = nil;
memset( &sMixerCaps, 0, sizeof( sMixerCaps ) );
@ -157,6 +171,7 @@ plWinMicLevel::plWinMicLevel()
return;
}
}
#endif
}
plWinMicLevel::~plWinMicLevel()
@ -166,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!)
@ -375,3 +393,4 @@ MIXERLINE *IGetMixerSubLineByType( MIXERCONTROL *mux, DWORD type )
return nil;
}
#endif

2
Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h

@ -77,4 +77,4 @@ protected:
void IShutdown( void );
};
#endif // _plWinMicLevel_h
#endif // _plWinMicLevel_h

2
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.

2
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.

24
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);

6
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());

22
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;
}

18
Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp

@ -51,11 +51,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
///////////////////////////////////////////////////////////////////////////////
#include "hsConfig.h"
#include "hsWindows.h"
#if HS_BUILD_FOR_WIN32
#include <ddraw.h>
#include <d3d9.h>
#endif
#include "hsTypes.h"
#include "hsDXTDirectXCodec.h"
@ -63,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* );
}
@ -73,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;
@ -91,6 +96,7 @@ hsDXTDirectXCodec::hsDXTDirectXCodec() : fDirectDraw( nil ), fDDLibraryInstance(
hsDXTDirectXCodec::~hsDXTDirectXCodec()
{
#if HS_BUILD_FOR_WIN32
if ((fFlags & kExternalInit) == 0)
{
if (fDirectDraw)
@ -106,6 +112,7 @@ hsDXTDirectXCodec::~hsDXTDirectXCodec()
fDirectDraw = nil;
fDDLibraryInstance = nil;
#endif
}
hsBool hsDXTDirectXCodec::Register()
@ -113,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 )
@ -159,6 +167,7 @@ hsBool hsDXTDirectXCodec::IInitialize()
return true;
}
#endif
//// CreateCompressedMipmap ///////////////////////////////////////////////////
// Updated 8.15.2000 mcn to generate uncompressed mipmaps down to 1x1 (the
@ -167,6 +176,7 @@ hsBool hsDXTDirectXCodec::IInitialize()
plMipmap *hsDXTDirectXCodec::CreateCompressedMipmap( plMipmap *uncompressed )
{
#if HS_BUILD_FOR_WIN32
const plMipmap *b = uncompressed;
plMipmap *compressed = nil;
@ -271,6 +281,9 @@ plMipmap *hsDXTDirectXCodec::CreateCompressedMipmap( plMipmap *uncompressed )
/// All done!
return compressed;
#else
return nil;
#endif
}
//// CreateUncompressedMipmap /////////////////////////////////////////////////
@ -416,6 +429,7 @@ plMipmap *hsDXTDirectXCodec::CreateUncompressedMipmap( plMipmap *compressed,
*/
}
#if HS_BUILD_FOR_WIN32
UInt32 hsDXTDirectXCodec::ICompressedFormat(const plMipmap *uncompressed)
{
if( uncompressed->GetFlags() & plMipmap::kAlphaChannelFlag )
@ -1234,9 +1248,9 @@ void hsDXTDirectXCodec::CheckErrorCode(HRESULT res)
break;
}
}
#endif
hsBool hsDXTDirectXCodec::ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask )
{
return false;
}
}

12
Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h

@ -54,13 +54,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef hsDXTDirectXCodec_inc
#define hsDXTDirectXCodec_inc
#include "hsWindows.h"
#include "hsCodec.h"
class plMipmap;
#if HS_BUILD_FOR_WIN32
struct IDirect3DDevice8;
struct IDirectDrawSurface7;
struct IDirectDraw7;
#endif
class hsDXTDirectXCodec : public hsCodec
{
@ -78,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 );
@ -89,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

32
Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp

@ -39,12 +39,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
Mead, WA 99021
*==LICENSE==*/
#include "plAVIWriter.h"
#include "hsTypes.h"
#include "hsWindows.h"
#if HS_BUILD_FOR_WIN32
#include <vfw.h>
#endif
#include "hsTimer.h"
#include "plMipmap.h"
@ -55,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:
@ -84,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()
{
@ -104,6 +123,7 @@ plAVIWriter& plAVIWriter::Instance()
////////////////////////////////////////////////////////////////////////////////
#if HS_BUILD_FOR_WIN32
plAVIWriterImp::plAVIWriterImp() :
fStartTime(0),
fOldRealTime(false),
@ -113,6 +133,9 @@ plAVIWriterImp::plAVIWriterImp() :
{
AVIFileInit();
}
#else
plAVIWriterImp::plAVIWriterImp() { }
#endif
plAVIWriterImp::~plAVIWriterImp()
{
@ -132,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)
{
@ -142,6 +165,7 @@ hsBool plAVIWriterImp::MsgReceive(plMessage* msg)
plProfile_EndTiming(AviCapture);
}
#endif
return hsKeyedObject::MsgReceive(msg);
}
@ -150,6 +174,7 @@ static const int kFramesPerSec = 30;
bool plAVIWriterImp::Open(const char* fileName, plPipeline* pipeline)
{
#if HS_BUILD_FOR_WIN32
// Already writing, fail
if (fStreamHandle)
return false;
@ -225,6 +250,7 @@ bool plAVIWriterImp::Open(const char* fileName, plPipeline* pipeline)
Close();
return false;
}
#endif
plgDispatch::Dispatch()->RegisterForExactType(plRenderMsg::Index(), GetKey());
@ -235,6 +261,7 @@ void plAVIWriterImp::Close()
{
plgDispatch::Dispatch()->UnRegisterForExactType(plRenderMsg::Index(), GetKey());
#if HS_BUILD_FOR_WIN32
hsTimer::SetRealTime(fOldRealTime);
if (fStreamHandle)
@ -256,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));
@ -308,3 +337,4 @@ bool plAVIWriterImp::ICaptureFrame(plPipeline* pipeline)
return (err == AVIERR_OK);
}
#endif

2
Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.h

@ -68,4 +68,4 @@ public:
virtual void Close()=0;
};
#endif // plAVIWriter_h_inc
#endif // plAVIWriter_h_inc

19
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 );
}
}
*/
*/

2
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);

2
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)
}

8
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;

10
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);

15
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 <float.h>
#include <math.h>
#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;
}
}

6
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(&centre, &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;

9
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 <float.h>
#include <math.h>
#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;

8
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))

2
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

2
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;

16
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);
}
}

2
Sources/Plasma/PubUtilLib/plPhysical/plPickingDetector.h

@ -79,4 +79,4 @@ public:
*/
#endif plPickingDetector_inc
#endif //plPickingDetector_inc

3
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

4
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;
}

2
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;

2
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);

9
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)

4
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));
}

4
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());

4
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 */

Loading…
Cancel
Save