Browse Source

Merge pull request #70 from dpogue/miscfixes

Misc fixes
Darryl Pogue 14 years ago
parent
commit
454db5c6a2
  1. 2
      Sources/Plasma/CoreLib/HeadSpin.cpp
  2. 87
      Sources/Plasma/CoreLib/hsBounds.cpp
  3. 98
      Sources/Plasma/CoreLib/hsBounds.h
  4. 65
      Sources/Plasma/CoreLib/hsConfig.h
  5. 6
      Sources/Plasma/CoreLib/hsGeometry3.cpp
  6. 107
      Sources/Plasma/CoreLib/hsGeometry3.h
  7. 2
      Sources/Plasma/CoreLib/hsMMIOStream.h
  8. 2
      Sources/Plasma/CoreLib/hsMatrix44.h
  9. 29
      Sources/Plasma/CoreLib/hsScalar.h
  10. 159
      Sources/Plasma/CoreLib/hsStream.cpp
  11. 6
      Sources/Plasma/CoreLib/hsStream.h
  12. 90
      Sources/Plasma/CoreLib/hsTypes.h
  13. 2
      Sources/Plasma/CoreLib/hsUtils.cpp
  14. 2
      Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.h
  15. 4
      Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp
  16. 8
      Sources/Plasma/NucleusLib/inc/plCreatableStrings.h
  17. 7
      Sources/Plasma/NucleusLib/pnTimer/plTimedValue.h
  18. 142
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h
  19. 30
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h
  20. 6
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.h
  21. 12
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPriQ.h
  22. 12
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSkipList.h
  23. 6
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.h
  24. 4
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.h
  25. 3
      Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp
  26. 1
      Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h
  27. 5
      Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp
  28. 1
      Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h
  29. 1
      Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h
  30. 1
      Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.h
  31. 1
      Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.h
  32. 2
      Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h

2
Sources/Plasma/CoreLib/HeadSpin.cpp

@ -96,7 +96,7 @@ void hsDebugMessage (const char message[], long val)
{ OutputDebugString(&s[1]); { OutputDebugString(&s[1]);
OutputDebugString("\n"); OutputDebugString("\n");
} }
#elif (HS_BUILD_FOR_BE || HS_BUILD_FOR_UNIX ) #elif HS_BUILD_FOR_UNIX
{ fprintf(stderr, "%s\n", &s[1]); { fprintf(stderr, "%s\n", &s[1]);
// hsThrow(&s[1]); // hsThrow(&s[1]);
} }

87
Sources/Plasma/CoreLib/hsBounds.cpp

@ -58,44 +58,6 @@ void hsBounds::Write(hsStream *s)
// //
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
#if 0 // MESH_GEN_DEFER
void hsBounds3::Draw(hsGView3* v, hsG3DDevice* d,
hsScalar r, hsScalar g, hsScalar b, hsScalar a,
hsBool spheric)
{
hsGViewClipState* clipState = v->SaveClipDisabled();
if( hsGClip3::kClipCulled & v->ClipTestBounds(this) )
{
v->RestoreClipDisabled(clipState);
return;
}
// Setup Material
hsGMaterial *mat = TRACKED_NEW hsGMaterial;
hsGLayer* lay = mat->MakeBaseLayer();
lay->SetAmbientColor(r,g,b,a);
lay->SetMiscFlags(hsGMatState::kMiscWireFrame | hsGMatState::kMiscTwoSided);
lay->SetShadeFlags(hsGMatState::kShadeNoShade);
mat->SetLayer(lay, 0);
// Setup tMesh
hsGTriMesh tMesh;
if( spheric )
MakeTriMeshSphere(&tMesh);
else
MakeTriMesh(&tMesh, hsTriangle3::kTwoSided);
tMesh.SetMaterial(mat);
hsRefCnt_SafeUnRef(mat);
tMesh.Render(v,d);
v->RestoreClipDisabled(clipState);
}
#endif // MESH_GEN_DEFER
void hsBounds3::Transform(const hsMatrix44 *mat) void hsBounds3::Transform(const hsMatrix44 *mat)
{ {
#if 0 // IDENT #if 0 // IDENT
@ -637,55 +599,6 @@ void hsBoundsOriented::Union(const hsBounds3 *b)
// //
// //
// //
void hsBoundsOriented::Reset(hsGTriMesh *tMesh)
{
#if 0 // MESH_GEN_DEFER
const float OBJCVT_ABOUT_ZERO = 1.0e-4f;
const float OBJCVT_ABOUT_ONE = 1.0f - OBJCVT_ABOUT_ZERO;
hsPlane3 *planes = TRACKED_NEW hsPlane3[tMesh->GetNumTriangles()];
UInt32 nPlanes = 0;
int i;
for( i = 0; i < tMesh->GetNumTriangles(); i++ )
{
hsTriangle3 *tri;
tri = tMesh->GetTriangle(i);
hsPlane3 pln;
tri->ComputePlane(&pln);
hsScalar norm = hsFastMath::InvSqrRoot(pln.fN.MagnitudeSquared());
pln.fN *= norm;
int j;
for( j = 0; j < nPlanes; j++ )
{
if( (pln.fN.InnerProduct(planes[j].fN)> OBJCVT_ABOUT_ONE)
&&((pln.fD/planes[j].fD) >= 1.0-OBJCVT_ABOUT_ZERO)
&&((pln.fD/planes[j].fD) <= 1.0+OBJCVT_ABOUT_ZERO) )
break;
}
if( j == nPlanes )
planes[nPlanes++] = pln;
}
SetNumberPlanes(nPlanes);
for( i = 0; i < nPlanes; i++ )
SetPlane(i, planes+i);
delete [] planes;
// Compute center
hsPoint3 centroid(0,0,0);
for(i=0; i<tMesh->GetNumPoints(); i++)
{
centroid = centroid + *tMesh->GetPoint(i);
}
centroid = centroid / (hsScalar)tMesh->GetNumPoints();
SetCenter(&centroid);
#endif // MESH_GEN_DEFER
}
void hsBoundsOriented::Write(hsStream *stream) void hsBoundsOriented::Write(hsStream *stream)
{ {

98
Sources/Plasma/CoreLib/hsBounds.h

@ -31,10 +31,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsPoint2.h" #include "hsPoint2.h"
#include "hsMatrix44.h" #include "hsMatrix44.h"
class hsTriangle3;
class hsGView3;
class hsG3DDevice;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// BOUNDS // BOUNDS
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -78,8 +74,6 @@ public:
// //
// //
// //
class hsGTriMesh;
struct hsMatrix44;
class hsBounds3 : public hsBounds class hsBounds3 : public hsBounds
{ {
public: public:
@ -117,14 +111,11 @@ public:
// //
// Only valid for kBounds Normal // Only valid for kBounds Normal
// //
void Draw(hsGView3* v, hsG3DDevice* d, hsScalar r, hsScalar g, hsScalar b, hsScalar a, hsBool spheric=false);
virtual void GetCorners(hsPoint3 *b) const; virtual void GetCorners(hsPoint3 *b) const;
const hsPoint3& GetMins() const; const hsPoint3& GetMins() const;
const hsPoint3& GetMaxs() const; const hsPoint3& GetMaxs() const;
hsScalar GetMaxDim() const; // Computes the answer hsScalar GetMaxDim() const; // Computes the answer
const hsPoint3& GetCenter() const; // Computes the answer if not already there const hsPoint3& GetCenter() const; // Computes the answer if not already there
// void MakeTriMesh(hsGTriMesh* tMesh, UInt32 triFlags, hsPoint3* cornersIn=nil) const;
// void MakeTriMeshSphere(hsGTriMesh* tMesh, hsPoint3* cornersIn=nil) const;
virtual hsBool IsInside(const hsPoint3* pos) const; // ok for full/empty virtual hsBool IsInside(const hsPoint3* pos) const; // ok for full/empty
virtual void TestPlane(const hsVector3 &n, hsPoint2 &depth) const; virtual void TestPlane(const hsVector3 &n, hsPoint2 &depth) const;
virtual void TestPlane(const hsPlane3 *p, hsPoint2 &depth) const; virtual void TestPlane(const hsPlane3 *p, hsPoint2 &depth) const;
@ -211,7 +202,6 @@ public:
// These set type to kBounds Normal // These set type to kBounds Normal
// //
virtual void Reset(const hsBounds3*); virtual void Reset(const hsBounds3*);
void Reset(hsGTriMesh *tMesh);
void SetPlane(UInt32 i, hsPlane3 *p); void SetPlane(UInt32 i, hsPlane3 *p);
// //
@ -224,7 +214,6 @@ public:
virtual void Read(hsStream *stream); virtual void Read(hsStream *stream);
}; };
//class hsBounds3Tri;
class hsHitInfoExt; class hsHitInfoExt;
class hsBounds3Ext : public hsBounds3 { class hsBounds3Ext : public hsBounds3 {
protected: protected:
@ -293,21 +282,9 @@ public:
virtual hsBool ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const; virtual hsBool ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const;
virtual hsBool ISectABB(const hsBounds3Ext &other, const hsVector3 &myVel) const; virtual hsBool ISectABB(const hsBounds3Ext &other, const hsVector3 &myVel) const;
virtual hsBool ISectBS(const hsBounds3Ext &other, const hsVector3 &myVel) const; virtual hsBool ISectBS(const hsBounds3Ext &other, const hsVector3 &myVel) const;
#if 0 // Commenting out this which will be made redundant and/or obsolete by Havok integration
virtual hsBool ISectTriABB(hsBounds3Tri &tri, const hsVector3 &myVel) const;
virtual hsBool ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel) const;
virtual hsBool ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel, hsHitInfoExt *hit) const;
virtual hsBool TriBSHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsHitInfoExt* hit) const;
virtual hsBool TriBBHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsHitInfoExt* hit) const;
#endif // Commenting out this which will be made redundant and/or obsolete by Havok integration
virtual Int32 IClosestISect(const hsBounds3Ext& other, const hsVector3& myVel, virtual Int32 IClosestISect(const hsBounds3Ext& other, const hsVector3& myVel,
hsScalar* tClose, hsScalar* tImpact) const; hsScalar* tClose, hsScalar* tImpact) const;
#if 0 // Commenting out this which will be made redundant and/or obsolete by Havok integration
virtual hsBool ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel) const;
virtual hsBool ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel, hsHitInfoExt *hit) const;
#endif // Commenting out this which will be made redundant and/or obsolete by Havok integration
virtual hsBool ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const; virtual hsBool ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const;
virtual hsBool ISectBSBox(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const; virtual hsBool ISectBSBox(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const;
virtual hsBool ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel) const; virtual hsBool ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel) const;
@ -328,96 +305,21 @@ inline hsScalar hsBounds3Ext::GetRadius() const
return fRadius; return fRadius;
} }
#if 0 // Commenting out this which will be made redundant and/or obsolete by Havok integration
class hsBounds3Tri {
protected:
enum {
kOnEdge0 = (1 << 0),
kOnEdge1 = (1 << 1),
kOnEdge2 = (1 << 2),
kOnTriPlane = (1 << 3)
};
public:
enum {
kAxesSet = 0x1,
kDoubleSide = 0x2
};
hsVector3 fNormal;
// hsVector3 fNormal;
hsScalar fDist;
hsPoint3 fVerts[3];
// hsVector3 fPerpAxes[3];
mutable UInt32 fTriFlags;
mutable hsVector3 fPerpAxes[3];
mutable hsPoint2 fPerpDists[3];
mutable UInt32 fOnIsMax;
hsTriangle3* fTriangle;
void TestPlane(const hsVector3 &n, hsPoint2 &depth) const;
hsBool PointOutsideTriPlane(const hsPoint3 *p) const { return fNormal.InnerProduct(p) > fDist; };
hsBool ClosestTriPoint(const hsPoint3 *p, hsPoint3 *out, const hsVector3 *ax=nil) const; // sets out, true if out = p + t*fNormal
hsBool ISectCone(const hsPoint3& from, const hsPoint3& to, hsScalar cosThetaSq, hsBool32 ignoreBackFacing, hsPoint3& at, hsBool32& backSide) const;
void SetAxes() const;
hsBounds3Tri* Transform(const hsMatrix44& x);
hsBounds3Tri* Translate(const hsVector3& v);
void Set(const hsPoint3& v0,
const hsPoint3& v1,
const hsPoint3& v2,
hsTriangle3* t,
const hsMatrix44& x);
hsBounds3Tri(const hsPoint3& v0,
const hsPoint3& v1,
const hsPoint3& v2,
hsTriangle3* t,
const hsMatrix44& x);
hsBounds3Tri(hsTriangle3* t,
const hsMatrix44& x);
void Set(hsPoint3 *v0,
hsPoint3 *v1,
hsPoint3 *v2,
hsVector3 *n,
UInt32 triFlags,
hsTriangle3 *t=nil);
hsBounds3Tri(hsPoint3 *v0,
hsPoint3 *v1,
hsPoint3 *v2,
hsVector3 *n,
UInt32 triFlags,
hsTriangle3 *t=nil);
hsBounds3Tri(hsTriangle3* t);
hsBounds3Tri() {}
~hsBounds3Tri();
friend class hsBounds3Ext;
} ATTRIBUTE_FOR_PS2; /* SUNSOFT */
#endif // Commenting out this which will be made redundant and/or obsolete by Havok integration
class hsHitInfoExt { class hsHitInfoExt {
public: public:
hsScalar fDepth; hsScalar fDepth;
hsVector3 fNormal; hsVector3 fNormal;
hsVector3 fDelPos; hsVector3 fDelPos;
#if 0 // Commenting out this which will be made redundant and/or obsolete by Havok integration
const hsBounds3Tri* fTriBnd;
#endif // Commenting out this which will be made redundant and/or obsolete by Havok integration
const hsBounds3Ext* fBoxBnd; const hsBounds3Ext* fBoxBnd;
const hsBounds3Ext* fOtherBoxBnd; const hsBounds3Ext* fOtherBoxBnd;
const hsPoint3* fRootCenter; const hsPoint3* fRootCenter;
hsHitInfoExt(const hsPoint3 *ctr, const hsVector3& offset) { fRootCenter=ctr; fDelPos=offset; }; hsHitInfoExt(const hsPoint3 *ctr, const hsVector3& offset) { fRootCenter=ctr; fDelPos=offset; };
#if 0 // Commenting out this which will be made redundant and/or obsolete by Havok integration
void Set(const hsBounds3Ext *m, const hsBounds3Tri *t, const hsVector3* n, hsScalar d)
{ fDepth = d; fTriBnd = t; fBoxBnd = m; fNormal = *n; fOtherBoxBnd = nil; }
void Set(const hsBounds3Ext *m, const hsBounds3Ext *o, const hsVector3 &norm, hsScalar d)
{ fDepth = d; fBoxBnd = m, fOtherBoxBnd = o; fNormal = norm; fTriBnd = nil; }
#else // Commenting out this which will be made redundant and/or obsolete by Havok integration
void Set(const hsBounds3Ext *m, const hsVector3* n, hsScalar d) void Set(const hsBounds3Ext *m, const hsVector3* n, hsScalar d)
{ fDepth = d; fBoxBnd = m; fNormal = *n; fOtherBoxBnd = nil; } { fDepth = d; fBoxBnd = m; fNormal = *n; fOtherBoxBnd = nil; }
void Set(const hsBounds3Ext *m, const hsBounds3Ext *o, const hsVector3 &norm, hsScalar d) void Set(const hsBounds3Ext *m, const hsBounds3Ext *o, const hsVector3 &norm, hsScalar d)
{ fDepth = d; fBoxBnd = m, fOtherBoxBnd = o; fNormal = norm; } { fDepth = d; fBoxBnd = m, fOtherBoxBnd = o; fNormal = norm; }
#endif // Commenting out this which will be made redundant and/or obsolete by Havok integration
}; };
#endif // hsBounds_inc #endif // hsBounds_inc

65
Sources/Plasma/CoreLib/hsConfig.h

@ -34,16 +34,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#endif #endif
#ifdef BUILDPS2
#define HS_BUILD_FOR_PS2 1
#define PLASMA_NO_NETWORK 1
#define PLASMA_NO_KEYBOARD 1
#define PLASMA_NO_GLIDE 1
#define PLASMA_NO_DDRAW 1
#define HS_BUILD_PLASMA 1
#define NEXUS_NO_2D 1
#endif
//////////////////// Change the 1s and 0s ////////////////////// //////////////////// Change the 1s and 0s //////////////////////
#define HS_CAN_USE_FLOAT 1 #define HS_CAN_USE_FLOAT 1
@ -54,51 +44,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
///////////////////////Impulse Defines////////////////////////////////////////////////
#define HS_IMPULSE_SUPPORT_GRAY4 0
///////////////////////Plasma Defines //////////////////////////////////////////////////
#ifdef HS_BUILD_PLASMA
#define HS_IGNORE_T2K 1
#define HS_SUPPORT_NFNT_FONTS 1
#endif // HS_BUILD_PLASMA
//////////////////// Specific Compiler Stuff This Section is computed //////////// //////////////////// Specific Compiler Stuff This Section is computed ////////////
#if defined(macintosh) && defined(__POWERPC__) #if defined(macintosh) && defined(__POWERPC__)
#define HS_BUILD_FOR_MACPPC 1 #define HS_BUILD_FOR_MACPPC 1
#define HS_CPU_BENDIAN 1
#elif defined(macintosh) #elif defined(macintosh)
#define HS_BUILD_FOR_MAC68K 1 #define HS_BUILD_FOR_MAC68K 1
#elif defined(_M_IX86) && defined(_WIN32) #elif defined(_WIN32)
#define HS_BUILD_FOR_WIN32 1 #define HS_BUILD_FOR_WIN32 1
#define HS_CPU_LENDIAN 1
#elif defined(__unix__) #elif defined(__unix__)
#define HS_BUILD_FOR_UNIX 1 #define HS_BUILD_FOR_UNIX 1
#if defined(__intel__) || defined(__i386__)
#define HS_CPU_LENDIAN 1
#elif defined(__mips__)
#define HS_CPU_BENDIAN 1
#endif
#elif !HS_BUILD_FOR_PS2
#define HS_BUILD_FOR_REFERENCE 1
#endif
#if defined(HS_BUILD_FOR_MAC68K) || defined(HS_BUILD_FOR_MACPPC)
#define HS_BUILD_FOR_MAC 1
#endif
#if defined(__INTEL__) && defined(HS_BUILD_FOR_MAC)
#error "Can't have HS_BUILD_FOR_MAC defined"
#endif
#if (defined(GENERATING68K) || defined(GENERATINGPOWERPC)) && defined(HS_BUILD_FOR_WIN32)
#define "Can't define HS_BUILD_FOR_WIN32"
#endif #endif
#define HS_SCALAR_IS_FIXED !(HS_SCALAR_IS_FLOAT) #define HS_SCALAR_IS_FIXED !(HS_SCALAR_IS_FLOAT)
@ -143,24 +98,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#endif #endif
#if HS_BUILD_FOR_PS2
#define ATTRIBUTE_FOR_PS2 __attribute__((aligned (16))) /* SUNSOFT */
#else
#define ATTRIBUTE_FOR_PS2
#endif
/////////////////////Myst3D Defines /////////////////////////////////////
#ifdef M3DRELEASE
#define PLASMA_NO_NETWORK 1
#define NEXUS_NO_2D 1
#define NO_LOAD_MSG 1
#define PLASMA_NO_CONSOLE 1
#define NEXUS_NO_DEBUG 1
#endif
///////////////////// Required facilities /////////////////////////////// ///////////////////// Required facilities ///////////////////////////////
#ifndef HeadSpinHDefined #ifndef HeadSpinHDefined
#include "HeadSpin.h" #include "HeadSpin.h"

6
Sources/Plasma/CoreLib/hsGeometry3.cpp

@ -73,12 +73,6 @@ void hsScalarTriple::Read(hsStream *stream)
// DANGER for speed read directly into these variables...ASSUMES fX,fY, and fZ are in contiguous order (PBG) // DANGER for speed read directly into these variables...ASSUMES fX,fY, and fZ are in contiguous order (PBG)
stream->Read12Bytes(&fX); stream->Read12Bytes(&fX);
#if HS_BUILD_FOR_MAC
fX = hsSwapEndianFloat(fX);
fY = hsSwapEndianFloat(fY);
fZ = hsSwapEndianFloat(fZ);
#endif
} }
void hsScalarTriple::Write(hsStream *stream) const void hsScalarTriple::Write(hsStream *stream) const

107
Sources/Plasma/CoreLib/hsGeometry3.h

@ -32,84 +32,6 @@ struct hsPoint3;
struct hsScalarTriple; struct hsScalarTriple;
class hsStream; class hsStream;
#if HS_BUILD_FOR_PS2
#include <eekernel.h>
#include <stdlib.h>
#include <stdio.h>
#include <eeregs.h>
#include <libgraph.h>
#include <libdma.h>
#include <libpkt.h>
#include <sifdev.h>
#include <libdev.h>
/**** vu0 inline ****/
#if 1
#define inline_asm inline /* inline */
#else
#define inline_asm /* not inline */
#endif
/******* HeadSpin *******/
typedef float hsScalar;
/* -------------------------------------------------------------------------------- */
/* return(sqrt(x)) */
inline_asm hsScalar SqrtVU0(hsScalar x)
{
register hsScalar ret;
asm volatile(" \
mfc1 $8,%1 \
qmtc2 $8,vf4 \
vsqrt Q,vf4x \
vwaitq \
cfc2 $2,$vi22 \
mtc1 $2,%0 \
" :"=f" (ret) : "f" (x), "0" (ret) : "$2", "$8", "memory");
return ret;
}
/* -------------------------------------------------------------------------------- */
/* return(1 / a) */
inline_asm hsScalar ScalarInvertVU0(hsScalar a)
{
register hsScalar ret;
asm volatile(" \
mfc1 $8,%1 \
qmtc2 $8,vf2 \
vdiv Q,vf0w,vf2x \
vwaitq \
cfc2 $2,$vi22 \
mtc1 $2,%0 \
" :"=f" (ret) : "f" (a), "0" (ret) : "$2", "$8", "memory");
return ret;
}
/* -------------------------------------------------------------------------------- */
/* return(a * b) */
inline_asm hsScalar ScalarMulVU0(hsScalar a, hsScalar b)
{
register hsScalar ret;
asm volatile(" \
mfc1 $8,%1 \
qmtc2 $8,vf2 \
mfc1 $9,%2 \
qmtc2 $9,vf3 \
vmul.x vf3,vf2,vf3 \
qmfc2 $2 ,vf3 \
mtc1 $2,%0 \
" :"=f" (ret) : "f" (a), "f" (b), "0" (ret) : "$2", "$8", "$9", "memory");
return ret;
}
#endif // PS2
/* /*
If value is already close to hsScalar1, then this is a good approx. of 1/sqrt(value) If value is already close to hsScalar1, then this is a good approx. of 1/sqrt(value)
*/ */
@ -166,12 +88,7 @@ public:
hsScalar Magnitude() const; hsScalar Magnitude() const;
hsScalar MagnitudeSquared() const; hsScalar MagnitudeSquared() const;
#else #else
#if HS_BUILD_FOR_PS2
hsScalar Magnitude() const;
#else
hsScalar Magnitude() const { return hsSquareRoot(MagnitudeSquared()); } hsScalar Magnitude() const { return hsSquareRoot(MagnitudeSquared()); }
#endif
hsScalar MagnitudeSquared() const { return (fX * fX + fY * fY + fZ * fZ); } hsScalar MagnitudeSquared() const { return (fX * fX + fY * fY + fZ * fZ); }
#endif #endif
@ -183,19 +100,7 @@ public:
void Read(hsStream *stream); void Read(hsStream *stream);
void Write(hsStream *stream) const; void Write(hsStream *stream) const;
} ATTRIBUTE_FOR_PS2; /* SUNSOFT */ };
#if HS_BUILD_FOR_PS2
inline hsScalar hsScalarTriple::Magnitude() const
{
MATRIX4 m;
m[0] = fX;
m[1] = fY;
m[2] = fZ;
return MagnitudeVU0(m);
}
#endif
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -256,7 +161,7 @@ struct hsPoint3 : public hsScalarTriple {
hsBool operator!=(const hsPoint3& ss) const { return !(*this == ss); } hsBool operator!=(const hsPoint3& ss) const { return !(*this == ss); }
hsPoint3 &operator+=(const hsScalarTriple &s) { fX += s.fX; fY += s.fY; fZ += s.fZ; return *this; } hsPoint3 &operator+=(const hsScalarTriple &s) { fX += s.fX; fY += s.fY; fZ += s.fZ; return *this; }
hsPoint3 &operator*=(const hsScalar s) { fX *= s; fY *= s; fZ *= s; return *this; } hsPoint3 &operator*=(const hsScalar s) { fX *= s; fY *= s; fZ *= s; return *this; }
} ATTRIBUTE_FOR_PS2; /* SUNSOFT */ };
///////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
@ -332,7 +237,7 @@ struct hsVector3 : public hsScalarTriple {
hsVector3 &operator-=(const hsScalarTriple &s) { fX -= s.fX; fY -= s.fY; fZ -= s.fZ; return *this; } hsVector3 &operator-=(const hsScalarTriple &s) { fX -= s.fX; fY -= s.fY; fZ -= s.fZ; return *this; }
hsVector3 &operator*=(const hsScalar s) { fX *= s; fY *= s; fZ *= s; return *this; } hsVector3 &operator*=(const hsScalar s) { fX *= s; fY *= s; fZ *= s; return *this; }
hsVector3 &operator/=(const hsScalar s) { fX /= s; fY /= s; fZ /= s; return *this; } hsVector3 &operator/=(const hsScalar s) { fX /= s; fY /= s; fZ /= s; return *this; }
} ATTRIBUTE_FOR_PS2; /* SUNSOFT */ };
struct hsPoint4 { struct hsPoint4 {
hsScalar fX, fY, fZ, fW; hsScalar fX, fY, fZ, fW;
@ -345,7 +250,7 @@ struct hsPoint4 {
hsPoint4* Set(hsScalar x, hsScalar y, hsScalar z, hsScalar w) hsPoint4* Set(hsScalar x, hsScalar y, hsScalar z, hsScalar w)
{ fX = x; fY = y; fZ = z; fW = w; return this; } { fX = x; fY = y; fZ = z; fW = w; return this; }
} ATTRIBUTE_FOR_PS2; /* SUNSOFT */ };
inline hsVector3 operator+(const hsVector3& s, const hsVector3& t) inline hsVector3 operator+(const hsVector3& s, const hsVector3& t)
@ -471,7 +376,7 @@ struct hsPointNorm {
void Read(hsStream* s) { fPos.Read(s); fNorm.Read(s); } void Read(hsStream* s) { fPos.Read(s); fNorm.Read(s); }
void Write(hsStream* s) const { fPos.Write(s); fNorm.Write(s); } void Write(hsStream* s) const { fPos.Write(s); fNorm.Write(s); }
} ATTRIBUTE_FOR_PS2; /* SUNSOFT */ };
struct hsPlane3 { struct hsPlane3 {
@ -491,6 +396,6 @@ struct hsPlane3 {
void Read(hsStream *stream); void Read(hsStream *stream);
void Write(hsStream *stream) const; void Write(hsStream *stream) const;
} ATTRIBUTE_FOR_PS2; };
#endif #endif

2
Sources/Plasma/CoreLib/hsMMIOStream.h

@ -31,7 +31,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#if HS_BUILD_FOR_WIN32 #if HS_BUILD_FOR_WIN32
#include <mmsystem.h> #include <mmsystem.h>
#endif
class hsMMIOStream: public hsStream class hsMMIOStream: public hsStream
{ {
@ -52,5 +51,6 @@ public:
HMMIO GetHandle() { return fHmfr; } HMMIO GetHandle() { return fHmfr; }
void SetHandle(HMMIO handle) { fHmfr = handle; } void SetHandle(HMMIO handle) { fHmfr = handle; }
}; };
#endif
#endif // hsMMIOStream_inc #endif // hsMMIOStream_inc

2
Sources/Plasma/CoreLib/hsMatrix44.h

@ -157,7 +157,7 @@ struct hsMatrix44 {
void Read(hsStream *stream); void Read(hsStream *stream);
void Write(hsStream *stream); void Write(hsStream *stream);
} ATTRIBUTE_FOR_PS2; /* SUNSOFT */ };
#if 0 // Havok reeks #if 0 // Havok reeks
inline int operator!=(const hsMatrix44& s, const hsMatrix44& t) inline int operator!=(const hsMatrix44& s, const hsMatrix44& t)

29
Sources/Plasma/CoreLib/hsScalar.h

@ -153,35 +153,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
inline float hsScalarAverage(float a, float b) { return (a + b) * float(0.5); } inline float hsScalarAverage(float a, float b) { return (a + b) * float(0.5); }
inline float hsScalarAverage(float a, float b, float t) { return a + t * (b - a); } inline float hsScalarAverage(float a, float b, float t) { return a + t * (b - a); }
#if (HS_BUILD_FOR_BE || (HS_BUILD_FOR_UNIX && !HS_BUILD_FOR_GCC322))
#define acosf(x) (float)acos(x)
#define asinf(x) (float)asin(x)
#define atanf(x) (float)atan(x)
#define atan2f(x, y) (float)atan2(x, y)
#define ceilf(x) (float)ceil(x)
#define cosf(x) (float)cos(x)
#define coshf(x) (float)cosh(x)
#define expf(x) (float)exp(x)
#define fabsf(x) (float)fabs(x)
#define floorf(x) (float)floor(x)
#define fmodf(x, y) (float)fmod(x, y)
#define logf(x) (float)log(x)
#define log10f(x) (float)log10(x)
#define powf(x, y) (float)pow(x, y)
#define sinf(x) (float)sin(x)
#define sinhf(x) (float)sinh(x)
#define sqrtf(x) (float)sqrt(x)
#define tanf(x) (float)tan(x)
#define tanhf(x) (float)tanh(x)
inline float modff(float x, float* y)
{
double _Di, _Df = modf(x, &_Di);
*y = (float)_Di;
return ((float)_Df);
}
#endif
inline hsScalar hsSquareRoot(hsScalar scalar) { return sqrtf(scalar); } inline hsScalar hsSquareRoot(hsScalar scalar) { return sqrtf(scalar); }
inline hsScalar hsSine(hsScalar angle) { return sinf(angle); } inline hsScalar hsSine(hsScalar angle) { return sinf(angle); }
inline hsScalar hsCosine(hsScalar angle) { return cosf(angle); } inline hsScalar hsCosine(hsScalar angle) { return cosf(angle); }

159
Sources/Plasma/CoreLib/hsStream.cpp

@ -54,86 +54,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////
#if HS_CPU_BENDIAN
static void swapIt(Int32 *swap)
{
Byte* c = (Byte*)swap;
Byte t = c[0];
c[0] = c[3];
c[3] = t;
t = c[1];
c[1] = c[2];
c[2] = t;
}
static void swapIt(int *swap)
{
swapIt((Int32*)swap);
}
static void swapIt(float *swap)
{
swapIt((Int32*)swap);
}
static void swapIt(double *swap)
{
float* a = (float*)&swap;
float* b = (float*)(((Byte*)&swap)+4);
swapIt(a);
swapIt(b);
}
static void swapIt(Int16 *swap)
{
Byte *c = (Byte*)swap;
Byte t;
t = c[0];
c[0] = c[1];
c[1] = t;
}
#define unswapIt(value)
#else
#define swapIt(value)
static void unswapIt(Int32 *swap)
{
Byte* c = (Byte*)swap;
Byte t = c[0];
c[0] = c[3];
c[3] = t;
t = c[1];
c[1] = c[2];
c[2] = t;
}
static void unswapIt(int *swap)
{
unswapIt((Int32*)swap);
}
static void unswapIt(float *swap)
{
unswapIt((Int32*)swap);
}
static void unswapIt(double *swap)
{
float* a = (float*)&swap;
float* b = (float*)(((Byte*)&swap)+4);
swapIt(a);
swapIt(b);
}
static void unswapIt(Int16 *swap)
{
Byte *c = (Byte*)swap;
Byte t;
t = c[0];
c[0] = c[1];
c[1] = t;
}
#endif
//////////////////////////////////////////////////////////////////////////////////
void hsStream::FastFwd() void hsStream::FastFwd()
{ {
hsThrow("FastFwd unimplemented by subclass of stream"); hsThrow("FastFwd unimplemented by subclass of stream");
@ -567,87 +487,77 @@ UInt16 hsStream::ReadSwap16()
{ {
UInt16 value; UInt16 value;
this->Read(sizeof(UInt16), &value); this->Read(sizeof(UInt16), &value);
swapIt((Int16*)&value); value = hsSWAP16(value);
return value; return value;
} }
void hsStream::ReadSwap16(int count, UInt16 values[]) void hsStream::ReadSwap16(int count, UInt16 values[])
{ {
this->Read(count * sizeof(UInt16), values); this->Read(count * sizeof(UInt16), values);
#if HS_CPU_BENDIAN
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
swapIt((Int16*)&values[i]); values[i] = hsSWAP16(values[i]);
#endif
} }
UInt32 hsStream::ReadSwap32() UInt32 hsStream::ReadSwap32()
{ {
UInt32 value; UInt32 value;
Read4Bytes(&value); Read4Bytes(&value);
swapIt((Int32*)&value); value = hsSWAP32(value);
return value; return value;
} }
void hsStream::ReadSwap32(int count, UInt32 values[]) void hsStream::ReadSwap32(int count, UInt32 values[])
{ {
this->Read(count * sizeof(UInt32), values); this->Read(count * sizeof(UInt32), values);
#if HS_CPU_BENDIAN
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
swapIt((Int32*)&values[i]); values[i] = hsSWAP32(values[i]);
#endif
} }
UInt32 hsStream::ReadUnswap32() UInt32 hsStream::ReadUnswap32()
{ {
UInt32 value; UInt32 value;
Read4Bytes(&value); Read4Bytes(&value);
unswapIt((Int32*)&value); value = hsUNSWAP32(value);
return value; return value;
} }
#if HS_CAN_USE_FLOAT #if HS_CAN_USE_FLOAT
double hsStream::ReadSwapDouble() double hsStream::ReadSwapDouble()
{ {
double ival; double value;
Read8Bytes(&ival); Read8Bytes(&value);
double *pval = (double *)&ival; // all in the name of speed, value = hsSWAPDouble(value);
swapIt(pval); return value;
return *pval;
} }
void hsStream::ReadSwapDouble(int count, double values[]) void hsStream::ReadSwapDouble(int count, double values[])
{ {
this->Read(count * sizeof(double), values); this->Read(count * sizeof(double), values);
#if HS_CPU_BENDIAN for (int i = 0; i < count; i++)
for (int i = 0; i < count; i++) values[i] = hsSWAPDouble(values[i]);
swapIt(&values[i]); }
#endif
}
float hsStream::ReadSwapFloat() float hsStream::ReadSwapFloat()
{ {
UInt32 ival; float value;
Read4Bytes(&ival); Read4Bytes(&value);
float *pval = (float *)&ival; // all in the name of speed, value = hsSWAPFloat(value);
swapIt(pval); return value;
return *pval;
} }
void hsStream::ReadSwapFloat(int count, float values[]) void hsStream::ReadSwapFloat(int count, float values[])
{ {
this->Read(count * sizeof(float), values); this->Read(count * sizeof(float), values);
#if HS_CPU_BENDIAN
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
swapIt(&values[i]); values[i] = hsSWAPFloat(values[i]);
#endif
} }
float hsStream::ReadUnswapFloat() float hsStream::ReadUnswapFloat()
{ {
float value; float value;
this->Read(sizeof(float), &value); this->Read(sizeof(float), &value);
unswapIt(&value); value = hsUNSWAPFloat(value);
return value; return value;
} }
#endif #endif
@ -688,7 +598,7 @@ void hsStream::WriteByte(UInt8 value)
void hsStream::WriteSwap16(UInt16 value) void hsStream::WriteSwap16(UInt16 value)
{ {
swapIt((Int16*)&value); value = hsSWAP16(value);
this->Write(sizeof(Int16), &value); this->Write(sizeof(Int16), &value);
} }
@ -700,7 +610,7 @@ void hsStream::WriteSwap16(int count, const UInt16 values[])
void hsStream::WriteSwap32(UInt32 value) void hsStream::WriteSwap32(UInt32 value)
{ {
swapIt((Int32*)&value); value = hsSWAP32(value);
this->Write(sizeof(Int32), &value); this->Write(sizeof(Int32), &value);
} }
@ -712,14 +622,14 @@ void hsStream::WriteSwap32(int count, const UInt32 values[])
void hsStream::WriteUnswap32(UInt32 value) void hsStream::WriteUnswap32(UInt32 value)
{ {
unswapIt((Int32*)&value); value = hsUNSWAP32(value);
this->Write(sizeof(Int32), &value); this->Write(sizeof(Int32), &value);
} }
#if HS_CAN_USE_FLOAT #if HS_CAN_USE_FLOAT
void hsStream::WriteSwapDouble(double value) void hsStream::WriteSwapDouble(double value)
{ {
swapIt(&value); value = hsSWAPDouble(value);
this->Write(sizeof(double), &value); this->Write(sizeof(double), &value);
} }
@ -731,7 +641,7 @@ void hsStream::WriteUnswap32(UInt32 value)
void hsStream::WriteSwapFloat(float value) void hsStream::WriteSwapFloat(float value)
{ {
swapIt(&value); value = hsSWAPFloat(value);
this->Write(sizeof(float), &value); this->Write(sizeof(float), &value);
} }
@ -743,7 +653,7 @@ void hsStream::WriteUnswap32(UInt32 value)
void hsStream::WriteUnswapFloat(float value) void hsStream::WriteUnswapFloat(float value)
{ {
unswapIt(&value); value = hsUNSWAPFloat(value);
this->Write(sizeof(float), &value); this->Write(sizeof(float), &value);
} }
#endif #endif
@ -1061,8 +971,6 @@ void hsFileStream::Truncate()
////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////
#if !HS_BUILD_FOR_PS2
#if !(HS_BUILD_FOR_REFERENCE)
hsUNIXStream::~hsUNIXStream() hsUNIXStream::~hsUNIXStream()
{ {
@ -1187,23 +1095,12 @@ void hsUNIXStream::Truncate()
{ {
if (!fRef) if (!fRef)
return; return;
#if! __MWERKS__ int handle = fileno(fRef);
int handle = _fileno(fRef); #if HS_BUILD_FOR_WIN32
#if !HS_BUILD_FOR_UNIX
_chsize(handle, fPosition); _chsize(handle, fPosition);
#else #else
ftruncate(handle, fPosition); ftruncate(handle, fPosition);
#endif #endif
#else
#if 1
UInt32 handle = (UInt32)fRef->handle;
OSErr err = ::SetEOF(handle, fPosition);
if(err != noErr)
{
hsThrow("Truncate error!");
}
#endif
#endif
} }
void hsUNIXStream::Flush() void hsUNIXStream::Flush()
@ -1213,8 +1110,6 @@ void hsUNIXStream::Flush()
(void)::fflush(fRef); (void)::fflush(fRef);
} }
#endif
#endif
////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////

6
Sources/Plasma/CoreLib/hsStream.h

@ -338,9 +338,6 @@ public:
virtual void SetFileRef(UInt32 refNum); virtual void SetFileRef(UInt32 refNum);
}; };
#if !HS_BUILD_FOR_PS2
#if !(HS_BUILD_FOR_REFERENCE)
class hsUNIXStream: public hsStream class hsUNIXStream: public hsStream
{ {
FILE* fRef; FILE* fRef;
@ -399,9 +396,6 @@ public:
virtual UInt32 GetEOF(); virtual UInt32 GetEOF();
}; };
#endif
#endif
class hsRAMStream : public hsStream { class hsRAMStream : public hsStream {
hsAppender fAppender; hsAppender fAppender;
hsAppenderIterator fIter; hsAppenderIterator fIter;

90
Sources/Plasma/CoreLib/hsTypes.h

@ -30,18 +30,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
/************************** Other Includes *****************************/ /************************** Other Includes *****************************/
#include <stdlib.h>
#if !(HS_BUILD_FOR_REFERENCE) #include <stdio.h>
#if HS_BUILD_FOR_MAC
#include <Types.h>
#include <string.h>
#include <ctype.h>
#include <memory.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#endif
#if HS_CAN_USE_FLOAT #if HS_CAN_USE_FLOAT
#include <math.h> #include <math.h>
#endif #endif
@ -170,30 +161,59 @@ typedef UInt32 hsGSeedValue;
} }
inline UInt32 hsSwapEndian32(UInt32 value) inline UInt32 hsSwapEndian32(UInt32 value)
{ {
return (value << 24) | return ((value) << 24) |
((value & 0xFF00) << 8) | ((value & 0x0000ff00) << 8) |
((value >> 8) & 0xFF00) | ((value & 0x00ff0000) >> 8) |
(value >> 24); ((value) >> 24);
}
inline UInt64 hsSwapEndian64(UInt64 value)
{
return ((value) << 56) |
((value & 0x000000000000ff00) << 40) |
((value & 0x0000000000ff0000) << 24) |
((value & 0x00000000ff000000) << 8) |
((value & 0x000000ff00000000) >> 8) |
((value & 0x0000ff0000000000) >> 24) |
((value & 0x00ff000000000000) >> 40) |
((value) >> 56);
} }
#if HS_CAN_USE_FLOAT #if HS_CAN_USE_FLOAT
inline float hsSwapEndianFloat(float fvalue) inline float hsSwapEndianFloat(float fvalue)
{ {
UInt32 value = *(UInt32*)&fvalue; UInt32 value = *(UInt32*)&fvalue;
value = hsSwapEndian32(value); value = hsSwapEndian32(value);
return *(float*)&value; return *(float*)&value;
} }
inline double hsSwapEndianDouble(double dvalue)
{
UInt64 value = *(UInt64*)&dvalue;
value = hsSwapEndian64(value);
return *(double*)&value;
}
#endif #endif
#if HS_CPU_LENDIAN #if LITTLE_ENDIAN
#define hsUNSWAP16(n) hsSwapEndian16(n) #define hsUNSWAP16(n) hsSwapEndian16(n)
#define hsUNSWAP32(n) hsSwapEndian32(n) #define hsUNSWAP32(n) hsSwapEndian32(n)
#define hsSWAP16(n) (n) #define hsUNSWAP64(n) hsSwapEndian64(n)
#define hsSWAP32(n) (n) #define hsUNSWAPFloat(n) hsSwapEndianFloat(n)
#define hsUNSWAPDouble(n) hsSwapEndianDouble(n)
#define hsSWAP16(n) (n)
#define hsSWAP32(n) (n)
#define hsSWAP64(n) (n)
#define hsSWAPFloat(n) (n)
#define hsSWAPDouble(n) (n)
#else #else
#define hsUNSWAP16(n) (n) #define hsUNSWAP16(n) (n)
#define hsUNSWAP32(n) (n) #define hsUNSWAP32(n) (n)
#define hsSWAP16(n) hsSwapEndian16(n) #define hsUNSWAP64(n) (n)
#define hsSWAP32(n) hsSwapEndian32(n) #define hsUNSWAPFloat(n) (n)
#define hsUNSWAPDouble(n) (n)
#define hsSWAP16(n) hsSwapEndian16(n)
#define hsSWAP32(n) hsSwapEndian32(n)
#define hsSWAP64(n) hsSwapEndian64(n)
#define hsSWAPFloat(n) hsSwapEndianFloat(n)
#define hsSWAPDouble(n) hsSwapEndianDouble(n)
#endif #endif
inline void hsSwap(Int32& a, Int32& b) inline void hsSwap(Int32& a, Int32& b)
@ -224,17 +244,7 @@ typedef UInt32 hsGSeedValue;
struct hsColor32 { struct hsColor32 {
#if 1 // hsColor32 fixed-format optimization
UInt8 b, g, r, a;
#else
#if (HS_BUILD_FOR_WIN32 || HS_BUILD_FOR_BE)
UInt8 b, g, r, a; UInt8 b, g, r, a;
#elif (HS_BUILD_FOR_UNIX && HS_CPU_BENDIAN)
UInt8 a, b, g, r;
#else
UInt8 a, r, g, b;
#endif
#endif
#ifdef __cplusplus #ifdef __cplusplus
void SetARGB(UInt8 aa, UInt8 rr, UInt8 gg, UInt8 bb) void SetARGB(UInt8 aa, UInt8 rr, UInt8 gg, UInt8 bb)

2
Sources/Plasma/CoreLib/hsUtils.cpp

@ -72,7 +72,6 @@ static char hsStrBuf[100];
char *hsScalarToStr(hsScalar s) char *hsScalarToStr(hsScalar s)
{ {
#if !(HS_BUILD_FOR_REFERENCE)
if (s == hsIntToScalar(hsScalarToInt(s))) if (s == hsIntToScalar(hsScalarToInt(s)))
sprintf(hsStrBuf, "%d", hsScalarToInt(s)); sprintf(hsStrBuf, "%d", hsScalarToInt(s));
else else
@ -81,7 +80,6 @@ char *hsScalarToStr(hsScalar s)
#else #else
sprintf(hsStrBuf, "%d:%lu", hsFixedToInt(s), (UInt16)s); sprintf(hsStrBuf, "%d:%lu", hsFixedToInt(s), (UInt16)s);
#endif #endif
#endif
return hsStrBuf; return hsStrBuf;
} }

2
Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.h

@ -113,7 +113,7 @@ public:
tokenType *MakeToken(T parentObject) {return TRACKED_NEW tokenType(parentObject, fGroup);} tokenType *MakeToken(T parentObject) {return TRACKED_NEW tokenType(parentObject, fGroup);}
// return the number of tokens currently in the database // return the number of tokens currently in the database
int Size(void) {return group.size();} int Size(void) {return fGroup.size();}
}; };
// A basic vehicle class that handles accelleration, braking, and turning // A basic vehicle class that handles accelleration, braking, and turning

4
Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp

@ -613,11 +613,11 @@ void plLineFollowMod::RemoveStereizer(const plKey& key)
// it. // it.
plRailCameraMod::plRailCameraMod() : plRailCameraMod::plRailCameraMod() :
plLineFollowMod(),
fCurrentTime(0.0f), fCurrentTime(0.0f),
fTargetTime(0.0f), fTargetTime(0.0f),
fFarthest(false) fFarthest(false)
{ {
plLineFollowMod::plLineFollowMod();
fGoal.Set(0,0,0); fGoal.Set(0,0,0);
} }
@ -684,4 +684,4 @@ hsPoint3 plRailCameraMod::GetGoal(double secs, hsScalar speed)
fPath->SetCurTime(fTargetTime, plAnimPath::kCalcPosOnly); fPath->SetCurTime(fTargetTime, plAnimPath::kCalcPosOnly);
return fGoal; return fGoal;
} }

8
Sources/Plasma/NucleusLib/inc/plCreatableStrings.h

@ -58,17 +58,17 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#undef CLASS_INDEX_LIST_END #undef CLASS_INDEX_LIST_END
#define CLASS_INDEX_LIST_START class plCreatableStrings { public:\ #define CLASS_INDEX_LIST_START class plCreatableStrings { public:\
static char *fKeyedStrings[]; static char *fNonKeyedStrings[]; static char *fNonKeyedPostDBStrings[];\ static const char *fKeyedStrings[]; static const char *fNonKeyedStrings[]; static const char *fNonKeyedPostDBStrings[];\
}; \ }; \
char *plCreatableStrings::fKeyedStrings[] = { const char *plCreatableStrings::fKeyedStrings[] = {
#define CLASS_INDEX(ci) #ci #define CLASS_INDEX(ci) #ci
#define CLASS_INDEX_NONKEYED_OBJ_START }; char *plCreatableStrings::fNonKeyedStrings[] = { #define CLASS_INDEX_NONKEYED_OBJ_START }; const char *plCreatableStrings::fNonKeyedStrings[] = {
#define CLASS_INDEX_LIST_END }; #define CLASS_INDEX_LIST_END };
#undef CLASS_INDEX_DATABASE_STRUCT_INDEXES_START #undef CLASS_INDEX_DATABASE_STRUCT_INDEXES_START
#undef CLASS_INDEX_DATABASE_STRUCT_INDEXES_END #undef CLASS_INDEX_DATABASE_STRUCT_INDEXES_END
#define CLASS_INDEX_DATABASE_STRUCT_INDEXES_START #define CLASS_INDEX_DATABASE_STRUCT_INDEXES_START
#define CLASS_INDEX_DATABASE_STRUCT_INDEXES_END }; char *plCreatableStrings::fNonKeyedPostDBStrings[] = { #define CLASS_INDEX_DATABASE_STRUCT_INDEXES_END }; const char *plCreatableStrings::fNonKeyedPostDBStrings[] = {
// Step 3: Include plCI.h // Step 3: Include plCI.h

7
Sources/Plasma/NucleusLib/pnTimer/plTimedValue.h

@ -28,8 +28,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define plTimedValue_inc #define plTimedValue_inc
#include "hsTimer.h" #include "hsTimer.h"
#include "hsStream.h"
class hsStream;
// plTimedValue // plTimedValue
// To use, replace your member var of type T with plTimedValue<T>. // To use, replace your member var of type T with plTimedValue<T>.
@ -133,7 +132,7 @@ void plTimedSimple<T>::Read(hsStream* s)
template <class T> template <class T>
void plTimedSimple<T>::Write(hsStream* s) const void plTimedSimple<T>::Write(hsStream* s) const
{ {
T val = Value(); T val = this->Value();
s->WriteSwap(val); s->WriteSwap(val);
} }
@ -148,7 +147,7 @@ void plTimedCompound<T>::Read(hsStream* s)
template <class T> template <class T>
void plTimedCompound<T>::Write(hsStream* s) const void plTimedCompound<T>::Write(hsStream* s) const
{ {
T val = Value(); T val = this->Value();
val.Write(s); val.Write(s);
} }

142
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h

@ -765,16 +765,16 @@ TArray<T,C> & TArray<T,C>::operator= (const TArray<T,C> & source) {
if (&source == this) if (&source == this)
return *this; return *this;
m_chunkSize = source.m_chunkSize; m_chunkSize = source.m_chunkSize;
AdjustSize(max(m_alloc, source.m_count), 0); AdjustSize(max(this->m_alloc, source.m_count), 0);
C::CopyConstruct(m_data, source.m_data, source.m_count); C::CopyConstruct(this->m_data, source.m_data, source.m_count);
m_count = source.m_count; this->m_count = source.m_count;
return *this; return *this;
} }
//=========================================================================== //===========================================================================
template<class T, class C> template<class T, class C>
unsigned TArray<T,C>::Add (const T & source) { unsigned TArray<T,C>::Add (const T & source) {
unsigned index = m_count; unsigned index = this->m_count;
Push(source); Push(source);
return index; return index;
} }
@ -782,20 +782,20 @@ unsigned TArray<T,C>::Add (const T & source) {
//=========================================================================== //===========================================================================
template<class T, class C> template<class T, class C>
unsigned TArray<T,C>::Add (const T * source, unsigned count) { unsigned TArray<T,C>::Add (const T * source, unsigned count) {
unsigned index = m_count; unsigned index = this->m_count;
AdjustSizeChunked(m_count + count, m_count); AdjustSizeChunked(this->m_count + count, this->m_count);
C::CopyConstruct(&m_data[m_count], source, count); C::CopyConstruct(&this->m_data[this->m_count], source, count);
m_count += count; this->m_count += count;
return index; return index;
} }
//=========================================================================== //===========================================================================
template<class T, class C> template<class T, class C>
unsigned TArray<T,C>::AddArray (const TArray<T,C> & source) { unsigned TArray<T,C>::AddArray (const TArray<T,C> & source) {
unsigned index = m_count; unsigned index = this->m_count;
AdjustSizeChunked(m_count + source.m_count, m_count); AdjustSizeChunked(this->m_count + source.m_count, this->m_count);
C::CopyConstruct(&m_data[m_count], source.m_data, source.m_count); C::CopyConstruct(&this->m_data[this->m_count], source.m_data, source.m_count);
m_count += source.m_count; this->m_count += source.m_count;
return index; return index;
} }
@ -804,15 +804,15 @@ template<class T, class C>
void TArray<T,C>::AdjustSizeChunked (unsigned newAlloc, unsigned newCount) { void TArray<T,C>::AdjustSizeChunked (unsigned newAlloc, unsigned newCount) {
// Disallow shrinking the allocation // Disallow shrinking the allocation
if (newAlloc <= m_alloc) if (newAlloc <= this->m_alloc)
newAlloc = m_alloc; newAlloc = this->m_alloc;
// Process growing the allocation // Process growing the allocation
else else
newAlloc = CalcAllocGrowth(newAlloc, m_alloc, &m_chunkSize); newAlloc = CalcAllocGrowth(newAlloc, this->m_alloc, &this->m_chunkSize);
// Perform the allocation // Perform the allocation
AdjustSize(newAlloc, newCount); this->AdjustSize(newAlloc, newCount);
} }
@ -823,38 +823,38 @@ void TArray<T,C>::Copy (unsigned destIndex, unsigned sourceIndex, unsigned count
// Copy the data to the destination // Copy the data to the destination
ASSERT(destIndex + count <= m_count); ASSERT(destIndex + count <= m_count);
ASSERT(sourceIndex + count <= m_count); ASSERT(sourceIndex + count <= m_count);
C::Assign(m_data + destIndex, m_data + sourceIndex, count); C::Assign(this->m_data + destIndex, this->m_data + sourceIndex, count);
} }
//=========================================================================== //===========================================================================
template<class T, class C> template<class T, class C>
void TArray<T,C>::DeleteOrdered (unsigned index) { void TArray<T,C>::DeleteOrdered (unsigned index) {
ASSERT(index < m_count); ASSERT(index < this->m_count);
if (index + 1 < m_count) if (index + 1 < this->m_count)
C::Assign(&m_data[index], &m_data[index + 1], m_count - index - 1); C::Assign(&this->m_data[index], &this->m_data[index + 1], this->m_count - index - 1);
C::Destruct(&m_data[--m_count]); C::Destruct(&this->m_data[--this->m_count]);
} }
//=========================================================================== //===========================================================================
template<class T, class C> template<class T, class C>
void TArray<T,C>::DeleteUnordered (unsigned index) { void TArray<T,C>::DeleteUnordered (unsigned index) {
ASSERT(index < m_count); ASSERT(index < this->m_count);
if (index + 1 < m_count) if (index + 1 < this->m_count)
C::Assign(&m_data[index], &m_data[m_count - 1], 1); C::Assign(&this->m_data[index], &this->m_data[this->m_count - 1], 1);
C::Destruct(&m_data[--m_count]); C::Destruct(&this->m_data[--this->m_count]);
} }
//=========================================================================== //===========================================================================
template<class T, class C> template<class T, class C>
void TArray<T,C>::GrowToCount (unsigned count, bool zero) { void TArray<T,C>::GrowToCount (unsigned count, bool zero) {
if (count <= m_count) if (count <= this->m_count)
return; return;
AdjustSizeChunked(count, m_count); AdjustSizeChunked(count, this->m_count);
if (zero) if (zero)
memset(m_data + m_count, 0, (count - m_count) * sizeof(T)); memset(this->m_data + this->m_count, 0, (count - this->m_count) * sizeof(T));
C::Construct(m_data + m_count, count - m_count); C::Construct(this->m_data + this->m_count, count - this->m_count);
m_count = count; this->m_count = count;
} }
//=========================================================================== //===========================================================================
@ -866,9 +866,9 @@ void TArray<T,C>::GrowToFit (unsigned index, bool zero) {
//=========================================================================== //===========================================================================
template<class T, class C> template<class T, class C>
void TArray<T,C>::ShrinkBy (unsigned count) { void TArray<T,C>::ShrinkBy (unsigned count) {
ASSERT(count <= m_count); ASSERT(count <= this->m_count);
C::Destruct(m_data + m_count - count, count); C::Destruct(this->m_data + this->m_count - count, count);
m_count -= count; this->m_count -= count;
} }
//=========================================================================== //===========================================================================
@ -876,20 +876,20 @@ template<class T, class C>
void TArray<T,C>::Move (unsigned destIndex, unsigned sourceIndex, unsigned count) { void TArray<T,C>::Move (unsigned destIndex, unsigned sourceIndex, unsigned count) {
// Copy the data to the destination // Copy the data to the destination
ASSERT(destIndex + count <= m_count); ASSERT(destIndex + count <= this->m_count);
ASSERT(sourceIndex + count <= m_count); ASSERT(sourceIndex + count <= this->m_count);
C::Assign(m_data + destIndex, m_data + sourceIndex, count); C::Assign(this->m_data + destIndex, this->m_data + sourceIndex, count);
// Remove it from the source // Remove it from the source
if (destIndex >= sourceIndex) { if (destIndex >= sourceIndex) {
C::Destruct(m_data + sourceIndex, min(count, destIndex - sourceIndex)); C::Destruct(this->m_data + sourceIndex, min(count, destIndex - sourceIndex));
C::Construct(m_data + sourceIndex, min(count, destIndex - sourceIndex)); C::Construct(this->m_data + sourceIndex, min(count, destIndex - sourceIndex));
} }
else { else {
unsigned overlap = (destIndex + count > sourceIndex) ? (destIndex + count - sourceIndex) : 0; unsigned overlap = (destIndex + count > sourceIndex) ? (destIndex + count - sourceIndex) : 0;
ASSERT(overlap <= count); ASSERT(overlap <= count);
C::Destruct(m_data + sourceIndex + overlap, count - overlap); C::Destruct(this->m_data + sourceIndex + overlap, count - overlap);
C::Construct(m_data + sourceIndex + overlap, count - overlap); C::Construct(this->m_data + sourceIndex + overlap, count - overlap);
} }
} }
@ -897,72 +897,72 @@ void TArray<T,C>::Move (unsigned destIndex, unsigned sourceIndex, unsigned count
//=========================================================================== //===========================================================================
template<class T, class C> template<class T, class C>
T * TArray<T,C>::New () { T * TArray<T,C>::New () {
AdjustSizeChunked(m_count + 1, m_count + 1); AdjustSizeChunked(this->m_count + 1, this->m_count + 1);
return &m_data[m_count - 1]; return &this->m_data[this->m_count - 1];
} }
//=========================================================================== //===========================================================================
template<class T, class C> template<class T, class C>
T * TArray<T,C>::New (unsigned count) { T * TArray<T,C>::New (unsigned count) {
AdjustSizeChunked(m_count + count, m_count + count); AdjustSizeChunked(this->m_count + count, this->m_count + count);
return &m_data[m_count - count]; return &this->m_data[this->m_count - count];
} }
//=========================================================================== //===========================================================================
template<class T, class C> template<class T, class C>
void TArray<T,C>::Push (const T & source) { void TArray<T,C>::Push (const T & source) {
AdjustSizeChunked(m_count + 1, m_count); AdjustSizeChunked(this->m_count + 1, this->m_count);
C::CopyConstruct(&m_data[m_count], source); C::CopyConstruct(&this->m_data[this->m_count], source);
++m_count; ++this->m_count;
} }
//=========================================================================== //===========================================================================
template<class T, class C> template<class T, class C>
T TArray<T,C>::Pop () { T TArray<T,C>::Pop () {
ASSERT(m_count); ASSERT(this->m_count);
T result = m_data[--m_count]; T result = this->m_data[--this->m_count];
C::Destruct(m_data + m_count); C::Destruct(this->m_data + this->m_count);
return result; return result;
} }
//=========================================================================== //===========================================================================
template<class T, class C> template<class T, class C>
void TArray<T,C>::Reserve (unsigned additionalCount) { void TArray<T,C>::Reserve (unsigned additionalCount) {
AdjustSizeChunked(max(m_alloc, m_count + additionalCount), m_count); AdjustSizeChunked(max(this->m_alloc, this->m_count + additionalCount), this->m_count);
} }
//=========================================================================== //===========================================================================
template<class T, class C> template<class T, class C>
void TArray<T,C>::Set (const T * source, unsigned count) { void TArray<T,C>::Set (const T * source, unsigned count) {
AdjustSizeChunked(count, 0); AdjustSizeChunked(count, 0);
C::CopyConstruct(m_data, source, count); C::CopyConstruct(this->m_data, source, count);
m_count = count; this->m_count = count;
} }
//=========================================================================== //===========================================================================
template<class T, class C> template<class T, class C>
void TArray<T,C>::SetChunkSize (unsigned chunkSize) { void TArray<T,C>::SetChunkSize (unsigned chunkSize) {
m_chunkSize = chunkSize; this->m_chunkSize = chunkSize;
} }
//=========================================================================== //===========================================================================
template<class T, class C> template<class T, class C>
void TArray<T,C>::SetCount (unsigned count) { void TArray<T,C>::SetCount (unsigned count) {
AdjustSizeChunked(max(m_alloc, count), count); AdjustSizeChunked(max(this->m_alloc, count), count);
} }
//=========================================================================== //===========================================================================
template<class T, class C> template<class T, class C>
void TArray<T,C>::SetCountFewer (unsigned count) { void TArray<T,C>::SetCountFewer (unsigned count) {
ASSERT(count <= m_count); ASSERT(count <= this->m_count);
C::Destruct(m_data + count, m_count - count); C::Destruct(this->m_data + count, this->m_count - count);
m_count = count; this->m_count = count;
} }
//=========================================================================== //===========================================================================
template<class T, class C> template<class T, class C>
void TArray<T,C>::Trim () { void TArray<T,C>::Trim () {
AdjustSize(m_count, m_count); this->AdjustSize(this->m_count, this->m_count);
} }
@ -995,15 +995,15 @@ bool TSortArray<T,C,K,OFFSET>::Delete (K sortKey) {
// Find the correct position for this key // Find the correct position for this key
unsigned index; unsigned index;
BSEARCH(T, Ptr(), Count(), (sortKey > SortKey(elem)), &index); BSEARCH(T, this->Ptr(), this->Count(), (sortKey > SortKey(elem)), &index);
// Verify that an entry exists for this key // Verify that an entry exists for this key
unsigned count = Count(); unsigned count = this->Count();
if ((index >= count) || (SortKey((*this)[index]) != sortKey)) if ((index >= count) || (SortKey((*this)[index]) != sortKey))
return false; return false;
// Delete the entry // Delete the entry
DeleteOrdered(index); this->DeleteOrdered(index);
return true; return true;
} }
@ -1013,8 +1013,8 @@ template<class T, class C, class K, unsigned OFFSET>
T * TSortArray<T,C,K,OFFSET>::Find (K sortKey, unsigned * index) { T * TSortArray<T,C,K,OFFSET>::Find (K sortKey, unsigned * index) {
// Find the correct position for this key // Find the correct position for this key
BSEARCH(T, Ptr(), Count(), (sortKey > SortKey(elem)), index); BSEARCH(T, this->Ptr(), this->Count(), (sortKey > SortKey(elem)), index);
if (*index >= Count()) if (*index >= this->Count())
return nil; return nil;
// Check whether the key is at that position // Check whether the key is at that position
@ -1028,8 +1028,8 @@ template<class T, class C, class K, unsigned OFFSET>
const T * TSortArray<T,C,K,OFFSET>::Find (K sortKey, unsigned * index) const { const T * TSortArray<T,C,K,OFFSET>::Find (K sortKey, unsigned * index) const {
// Find the correct position for this key // Find the correct position for this key
BSEARCH(T, Ptr(), Count(), (sortKey > SortKey(elem)), index); BSEARCH(T, this->Ptr(), this->Count(), (sortKey > SortKey(elem)), index);
if (*index >= Count()) if (*index >= this->Count())
return nil; return nil;
// Check whether the key is at that position // Check whether the key is at that position
@ -1043,10 +1043,10 @@ template<class T, class C, class K, unsigned OFFSET>
T * TSortArray<T,C,K,OFFSET>::Insert (K sortKey, unsigned index) { T * TSortArray<T,C,K,OFFSET>::Insert (K sortKey, unsigned index) {
// Insert a new entry at this position // Insert a new entry at this position
unsigned count = Count(); unsigned count = this->Count();
SetCount(count + 1); this->SetCount(count + 1);
if (index < count) if (index < count)
Move(index + 1, index, count - index); this->Move(index + 1, index, count - index);
// Fill in the new entry // Fill in the new entry
T & elem = (*this)[index]; T & elem = (*this)[index];
@ -1058,8 +1058,8 @@ T * TSortArray<T,C,K,OFFSET>::Insert (K sortKey, unsigned index) {
//=========================================================================== //===========================================================================
template<class T, class C, class K, unsigned OFFSET> template<class T, class C, class K, unsigned OFFSET>
void TSortArray<T,C,K,OFFSET>::Sort () { void TSortArray<T,C,K,OFFSET>::Sort () {
T * ptr = Ptr(); T * ptr = this->Ptr();
unsigned count = Count(); unsigned count = this->Count();
QSORT( QSORT(
T, T,
ptr, ptr,

30
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h

@ -451,7 +451,7 @@ T * THashTable<T,K>::FindNext (const K & key, T * object) {
template<class T, class K> template<class T, class K>
const T * THashTable<T,K>::Find (const K & key) const { const T * THashTable<T,K>::Find (const K & key) const {
unsigned hash = key.GetHash(); unsigned hash = key.GetHash();
const LIST(T) & slotList = GetSlotList(hash); const LIST(T) & slotList = this->GetSlotList(hash);
for (const T * curr = slotList.Head(); curr; curr = slotList.Next(curr)) for (const T * curr = slotList.Head(); curr; curr = slotList.Next(curr))
if ((GetHash(curr) == hash) && (*curr == key)) if ((GetHash(curr) == hash) && (*curr == key))
return curr; return curr;
@ -462,7 +462,7 @@ const T * THashTable<T,K>::Find (const K & key) const {
template<class T, class K> template<class T, class K>
const T * THashTable<T,K>::FindNext (const K & key, const T * object) const { const T * THashTable<T,K>::FindNext (const K & key, const T * object) const {
unsigned hash = key.GetHash(); unsigned hash = key.GetHash();
const LIST(T) & slotList = GetSlotList(hash); const LIST(T) & slotList = this->GetSlotList(hash);
for (const T * curr = slotList.Next(object); curr; curr = slotList.Next(curr)) for (const T * curr = slotList.Next(object); curr; curr = slotList.Next(curr))
if ((GetHash(curr) == hash) && (*curr == key)) if ((GetHash(curr) == hash) && (*curr == key))
return curr; return curr;
@ -501,8 +501,8 @@ public:
//=========================================================================== //===========================================================================
template<class T, class K, int linkOffset, unsigned maxSize> template<class T, class K, int linkOffset, unsigned maxSize>
THashTableDecl<T,K,linkOffset,maxSize>::THashTableDecl () { THashTableDecl<T,K,linkOffset,maxSize>::THashTableDecl () {
SetLinkOffset(linkOffset, maxSize); this->SetLinkOffset(linkOffset, maxSize);
SetSlotMaxCount(maxSize); this->SetSlotMaxCount(maxSize);
} }
@ -523,8 +523,8 @@ public:
//=========================================================================== //===========================================================================
template<class T, class K> template<class T, class K>
void THashTableDyn<T,K>::Initialize (int linkOffset, unsigned maxSize) { void THashTableDyn<T,K>::Initialize (int linkOffset, unsigned maxSize) {
SetLinkOffset(linkOffset, maxSize); this->SetLinkOffset(linkOffset, maxSize);
SetSlotMaxCount(maxSize); this->SetSlotMaxCount(maxSize);
} }
@ -581,10 +581,10 @@ template<class C>
class THashKeyStrCmp : public THashKeyStrBase<C> { class THashKeyStrCmp : public THashKeyStrBase<C> {
public: public:
bool operator== (const THashKeyStrCmp & rhs) const { bool operator== (const THashKeyStrCmp & rhs) const {
return StrCmp(m_str, rhs.m_str) == 0; return StrCmp(this->m_str, rhs.m_str) == 0;
} }
unsigned GetHash () const { unsigned GetHash () const {
return StrHash(m_str); return StrHash(this->m_str);
} }
protected: protected:
@ -597,10 +597,10 @@ template<class C>
class THashKeyStrCmpI : public THashKeyStrBase<C> { class THashKeyStrCmpI : public THashKeyStrBase<C> {
public: public:
bool operator== (const THashKeyStrCmpI & rhs) const { bool operator== (const THashKeyStrCmpI & rhs) const {
return StrCmpI(m_str, rhs.m_str) == 0; return StrCmpI(this->m_str, rhs.m_str) == 0;
} }
unsigned GetHash () const { unsigned GetHash () const {
return StrHashI(m_str); return StrHashI(this->m_str);
} }
protected: protected:
@ -621,7 +621,7 @@ public:
THashKeyStrPtr () { } THashKeyStrPtr () { }
THashKeyStrPtr (const C str[]) : T(str) { } THashKeyStrPtr (const C str[]) : T(str) { }
void SetString (const C str[]) { void SetString (const C str[]) {
m_str = str; this->m_str = str;
} }
}; };
@ -648,12 +648,12 @@ public:
SetString(nil); SetString(nil);
} }
void SetString (const C str[]) { // deprecated void SetString (const C str[]) { // deprecated
if (m_str) if (this->m_str)
FREE(const_cast<C *>(m_str)); FREE(const_cast<C *>(this->m_str));
if (str) if (str)
m_str = StrDup(str); this->m_str = StrDup(str);
else else
m_str = nil; this->m_str = nil;
} }
}; };

6
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.h

@ -554,7 +554,7 @@ inline T * TList<T>::NewFlags (unsigned flags, ELinkType linkType, T * existingN
//=========================================================================== //===========================================================================
template<class T> template<class T>
inline T * TList<T>::NewZero (ELinkType linkType, T * existingNode, const char file[], int line) { inline T * TList<T>::NewZero (ELinkType linkType, T * existingNode, const char file[], int line) {
return NewFlags(MEM_ZERO, linkType, existingNode, file, line); return NewFlags(0, linkType, existingNode, file, line);
} }
//=========================================================================== //===========================================================================
@ -605,7 +605,7 @@ public:
//=========================================================================== //===========================================================================
template<class T, int linkOffset> template<class T, int linkOffset>
TListDecl<T,linkOffset>::TListDecl () { TListDecl<T,linkOffset>::TListDecl () {
SetLinkOffset(linkOffset); this->SetLinkOffset(linkOffset);
} }
@ -626,5 +626,5 @@ public:
//=========================================================================== //===========================================================================
template<class T> template<class T>
void TListDyn<T>::Initialize (int linkOffset) { void TListDyn<T>::Initialize (int linkOffset) {
SetLinkOffset(linkOffset); this->SetLinkOffset(linkOffset);
} }

12
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPriQ.h

@ -99,7 +99,7 @@ private:
int m_linkOffset; int m_linkOffset;
ARRAY(C *) m_array; ARRAY(C *) m_array;
friend TBasePriority<C,P>; friend class TBasePriority<C,P>;
}; };
//=========================================================================== //===========================================================================
@ -332,7 +332,7 @@ inline void TPriorityQueue<C,P>::UnlinkAll () {
template<class C, class P, int linkOffset> template<class C, class P, int linkOffset>
class TPriorityQueueDecl : public TPriorityQueue<C,P> { class TPriorityQueueDecl : public TPriorityQueue<C,P> {
public: public:
TPriorityQueueDecl () { SetLinkOffset(linkOffset); } TPriorityQueueDecl () { this->SetLinkOffset(linkOffset); }
}; };
@ -345,7 +345,7 @@ public:
template<class C, class P> template<class C, class P>
class TPriorityQueueDyn : public TPriorityQueue<C,P> { class TPriorityQueueDyn : public TPriorityQueue<C,P> {
public: public:
void Initialize (int linkOffset) { SetLinkOffset(linkOffset); } void Initialize (int linkOffset) { this->SetLinkOffset(linkOffset); }
}; };
@ -381,7 +381,7 @@ private:
TPriorityQueue<C,P> * m_queue; TPriorityQueue<C,P> * m_queue;
unsigned m_index; unsigned m_index;
friend TPriorityQueue<C,P>; friend class TPriorityQueue<C,P>;
}; };
//=========================================================================== //===========================================================================
@ -421,7 +421,7 @@ public:
if (value == m_value) if (value == m_value)
return; return;
m_value = value; m_value = value;
Relink(); this->Relink();
} }
T Get () const { T Get () const {
return m_value; return m_value;
@ -454,7 +454,7 @@ public:
if (m_time == time) if (m_time == time)
return; return;
m_time = time; m_time = time;
Relink(); this->Relink();
} }
unsigned Get () const { unsigned Get () const {
return m_time; return m_time;

12
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSkipList.h

@ -97,13 +97,13 @@ class TSkipList {
private: private:
enum { kMaxLevels = 32 }; enum { kMaxLevels = 32 };
template<class T, class K> template<class T2, class K2>
struct TNode { struct TNode {
const K * key; const K2 * key;
T * object; T2 * object;
unsigned level; unsigned level;
TNode<T, K> * prev; TNode<T2, K2> * prev;
TNode<T, K> * next[1]; // variable size array TNode<T2, K2> * next[1]; // variable size array
}; };
typedef TNode<T,K> Node; typedef TNode<T,K> Node;
@ -147,7 +147,7 @@ public:
//============================================================================ //============================================================================
template<class T, class K, unsigned keyOffset, class Cmp> template<class T, class K, unsigned keyOffset, class Cmp>
typename TSkipList<T,K,keyOffset,Cmp>::TNode<T,K> * TSkipList<T,K,keyOffset,Cmp>::AllocNode (unsigned level) { typename TSkipList<T,K,keyOffset,Cmp>::Node* TSkipList<T,K,keyOffset,Cmp>::AllocNode (unsigned level) {
unsigned size = offsetof(Node, next) + (level + 1) * sizeof(Node); unsigned size = offsetof(Node, next) + (level + 1) * sizeof(Node);
Node * node = (Node *)ALLOC(size); Node * node = (Node *)ALLOC(size);

6
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.h

@ -102,13 +102,13 @@ public:
//=========================================================================== //===========================================================================
template<class T> template<class T>
void * TSpareList<T>::Alloc () { void * TSpareList<T>::Alloc () {
return CBaseSpareList::Alloc(OBJECT_SIZE, typeid(T).raw_name()); return CBaseSpareList::Alloc(OBJECT_SIZE, typeid(T).name());
} }
//=========================================================================== //===========================================================================
template<class T> template<class T>
void TSpareList<T>::CleanUp () { void TSpareList<T>::CleanUp () {
CBaseSpareList::CleanUp(typeid(T).raw_name()); CBaseSpareList::CleanUp(typeid(T).name());
} }
//=========================================================================== //===========================================================================
@ -127,5 +127,5 @@ void TSpareList<T>::Free (T * node) {
//=========================================================================== //===========================================================================
template<class T> template<class T>
T * TSpareList<T>::New () { T * TSpareList<T>::New () {
return new(CBaseSpareList::Alloc(OBJECT_SIZE, typeid(T).raw_name())) T; return new(CBaseSpareList::Alloc(OBJECT_SIZE, typeid(T).name())) T;
} }

4
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.h

@ -36,10 +36,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
template<typename chartype> template<typename chartype>
struct SubstParsedData { struct SubstParsedData {
template<typename chartype> template<typename char_type>
struct SubstBlock { struct SubstBlock {
bool isVar; bool isVar;
chartype * data; char_type * data;
unsigned strLen; unsigned strLen;
SubstBlock() SubstBlock()

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

@ -761,7 +761,6 @@ void plDSoundBuffer::SetTimeOffsetSec(float seconds)
void plDSoundBuffer::SetTimeOffsetBytes(unsigned bytes) void plDSoundBuffer::SetTimeOffsetBytes(unsigned bytes)
{ {
alSourcef(source, AL_BYTE_OFFSET, bytes); alSourcei(source, AL_BYTE_OFFSET, bytes);
ALenum error = alGetError(); ALenum error = alGetError();
} }

1
Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h

@ -33,7 +33,6 @@ class plDSoundBuffer;
class DSoundCallbackHandle; class DSoundCallbackHandle;
class plAudioFileReader; class plAudioFileReader;
class plStreamingSoundThread; class plStreamingSoundThread;
enum CallbackHandleType;
class plSoundDeswizzler; class plSoundDeswizzler;
class plWin32StreamingSound : public plWin32Sound class plWin32StreamingSound : public plWin32Sound

5
Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp

@ -23,7 +23,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
Mead, WA 99021 Mead, WA 99021
*==LICENSE==*/ *==LICENSE==*/
#include <process.h>
#include "hsTypes.h" #include "hsTypes.h"
#include "plSoundBuffer.h" #include "plSoundBuffer.h"
@ -36,7 +36,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plFile/plFileUtils.h" #include "plFile/plFileUtils.h"
#include "plFile/hsFiles.h" #include "plFile/hsFiles.h"
#include "plUnifiedTime/plUnifiedTime.h" #include "plUnifiedTime/plUnifiedTime.h"
#include "pnUtils/pnUtils.h"
#include "plStatusLog/plStatusLog.h" #include "plStatusLog/plStatusLog.h"
#include "hsTimer.h" #include "hsTimer.h"
@ -167,7 +166,7 @@ plSoundBuffer::~plSoundBuffer()
{ {
while(!fLoaded) while(!fLoaded)
{ {
Sleep(10); hsSleep::Sleep(10);
} }
} }

1
Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h

@ -227,7 +227,6 @@ protected:
plAnimVector fPrivateAnims; plAnimVector fPrivateAnims;
// animations that require AnimTimeConvert state to be synched // animations that require AnimTimeConvert state to be synched
typedef std::vector<plAGAnim*> plAnimVector;
plInstanceVector fATCAnimInstances; plInstanceVector fATCAnimInstances;
hsBool fFirstEval; hsBool fFirstEval;

1
Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h

@ -66,6 +66,7 @@ class plAGChannel;
class plClothingOutfit; class plClothingOutfit;
class plClothingSDLModifier; class plClothingSDLModifier;
class plAvatarSDLModifier; class plAvatarSDLModifier;
class plAvatarPhysicalSDLModifier;
class plMatrixDelayedCorrectionApplicator; class plMatrixDelayedCorrectionApplicator;
class plMatrixDifferenceApp; class plMatrixDifferenceApp;
class plDebugText; class plDebugText;

1
Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.h

@ -39,6 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <deque> #include <deque>
class plArmatureModBase; class plArmatureModBase;
class plArmatureMod;
class plArmatureBehavior; class plArmatureBehavior;
class plHKAction; class plHKAction;
class plAvTask; class plAvTask;

1
Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.h

@ -39,6 +39,7 @@ class plATCEaseCurve;
class plATCState; class plATCState;
class plATCAnim; class plATCAnim;
class plAGMasterMod; class plAGMasterMod;
class plAGAnimInstance;
class plAnimTimeConvert : public plCreatable class plAnimTimeConvert : public plCreatable
{ {

2
Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h

@ -71,7 +71,7 @@ protected:
plRegistryPageNode() {} plRegistryPageNode() {}
inline plRegistryKeyList* IGetKeyList(UInt16 classType) const; plRegistryKeyList* IGetKeyList(UInt16 classType) const;
PageCond IVerify(); PageCond IVerify();
public: public:

Loading…
Cancel
Save