diff --git a/Sources/Plasma/CoreLib/HeadSpin.cpp b/Sources/Plasma/CoreLib/HeadSpin.cpp index a5a9464c..d3e5a7d1 100644 --- a/Sources/Plasma/CoreLib/HeadSpin.cpp +++ b/Sources/Plasma/CoreLib/HeadSpin.cpp @@ -96,7 +96,7 @@ void hsDebugMessage (const char message[], long val) { OutputDebugString(&s[1]); OutputDebugString("\n"); } -#elif (HS_BUILD_FOR_BE || HS_BUILD_FOR_UNIX ) +#elif HS_BUILD_FOR_UNIX { fprintf(stderr, "%s\n", &s[1]); // hsThrow(&s[1]); } diff --git a/Sources/Plasma/CoreLib/hsBounds.cpp b/Sources/Plasma/CoreLib/hsBounds.cpp index 1180e153..ec761fe0 100644 --- a/Sources/Plasma/CoreLib/hsBounds.cpp +++ b/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) { #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; iGetNumPoints(); i++) - { - centroid = centroid + *tMesh->GetPoint(i); - } - centroid = centroid / (hsScalar)tMesh->GetNumPoints(); - SetCenter(¢roid); -#endif // MESH_GEN_DEFER -} - void hsBoundsOriented::Write(hsStream *stream) { diff --git a/Sources/Plasma/CoreLib/hsBounds.h b/Sources/Plasma/CoreLib/hsBounds.h index 5fae502c..400b3ead 100644 --- a/Sources/Plasma/CoreLib/hsBounds.h +++ b/Sources/Plasma/CoreLib/hsBounds.h @@ -31,10 +31,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsPoint2.h" #include "hsMatrix44.h" -class hsTriangle3; -class hsGView3; -class hsG3DDevice; - /////////////////////////////////////////////////////////////////////////////// // BOUNDS /////////////////////////////////////////////////////////////////////////////// @@ -78,8 +74,6 @@ public: // // // -class hsGTriMesh; -struct hsMatrix44; class hsBounds3 : public hsBounds { public: @@ -117,14 +111,11 @@ public: // // 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; const hsPoint3& GetMins() const; const hsPoint3& GetMaxs() const; hsScalar GetMaxDim() const; // Computes the answer 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 void TestPlane(const hsVector3 &n, hsPoint2 &depth) const; virtual void TestPlane(const hsPlane3 *p, hsPoint2 &depth) const; @@ -211,7 +202,6 @@ public: // These set type to kBounds Normal // virtual void Reset(const hsBounds3*); - void Reset(hsGTriMesh *tMesh); void SetPlane(UInt32 i, hsPlane3 *p); // @@ -224,7 +214,6 @@ public: virtual void Read(hsStream *stream); }; -//class hsBounds3Tri; class hsHitInfoExt; class hsBounds3Ext : public hsBounds3 { protected: @@ -293,21 +282,9 @@ public: virtual hsBool ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const; virtual hsBool ISectABB(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, 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 ISectBSBox(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const; virtual hsBool ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel) const; @@ -328,96 +305,21 @@ inline hsScalar hsBounds3Ext::GetRadius() const 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 { public: hsScalar fDepth; hsVector3 fNormal; 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* fOtherBoxBnd; const hsPoint3* fRootCenter; 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) { fDepth = d; 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; } -#endif // Commenting out this which will be made redundant and/or obsolete by Havok integration }; #endif // hsBounds_inc diff --git a/Sources/Plasma/CoreLib/hsConfig.h b/Sources/Plasma/CoreLib/hsConfig.h index edb1896a..a3ae7415 100644 --- a/Sources/Plasma/CoreLib/hsConfig.h +++ b/Sources/Plasma/CoreLib/hsConfig.h @@ -34,16 +34,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #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 ////////////////////// #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 //////////// #if defined(macintosh) && defined(__POWERPC__) #define HS_BUILD_FOR_MACPPC 1 - #define HS_CPU_BENDIAN 1 #elif defined(macintosh) #define HS_BUILD_FOR_MAC68K 1 -#elif defined(_M_IX86) && defined(_WIN32) +#elif defined(_WIN32) #define HS_BUILD_FOR_WIN32 1 - #define HS_CPU_LENDIAN 1 #elif defined(__unix__) #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 #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 -#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 /////////////////////////////// #ifndef HeadSpinHDefined #include "HeadSpin.h" diff --git a/Sources/Plasma/CoreLib/hsGeometry3.cpp b/Sources/Plasma/CoreLib/hsGeometry3.cpp index 177f06da..c68ba61b 100644 --- a/Sources/Plasma/CoreLib/hsGeometry3.cpp +++ b/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) stream->Read12Bytes(&fX); -#if HS_BUILD_FOR_MAC - fX = hsSwapEndianFloat(fX); - fY = hsSwapEndianFloat(fY); - fZ = hsSwapEndianFloat(fZ); -#endif - } void hsScalarTriple::Write(hsStream *stream) const diff --git a/Sources/Plasma/CoreLib/hsGeometry3.h b/Sources/Plasma/CoreLib/hsGeometry3.h index 3fdf99ce..e9ce7cc9 100644 --- a/Sources/Plasma/CoreLib/hsGeometry3.h +++ b/Sources/Plasma/CoreLib/hsGeometry3.h @@ -32,84 +32,6 @@ struct hsPoint3; struct hsScalarTriple; class hsStream; -#if HS_BUILD_FOR_PS2 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/**** 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) */ @@ -166,12 +88,7 @@ public: hsScalar Magnitude() const; hsScalar MagnitudeSquared() const; #else - -#if HS_BUILD_FOR_PS2 - hsScalar Magnitude() const; -#else hsScalar Magnitude() const { return hsSquareRoot(MagnitudeSquared()); } -#endif hsScalar MagnitudeSquared() const { return (fX * fX + fY * fY + fZ * fZ); } #endif @@ -183,19 +100,7 @@ public: void Read(hsStream *stream); 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); } 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; } -} 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 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 { hsScalar fX, fY, fZ, fW; @@ -345,7 +250,7 @@ struct hsPoint4 { hsPoint4* Set(hsScalar x, hsScalar y, hsScalar z, hsScalar w) { fX = x; fY = y; fZ = z; fW = w; return this; } -} ATTRIBUTE_FOR_PS2; /* SUNSOFT */ +}; 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 Write(hsStream* s) const { fPos.Write(s); fNorm.Write(s); } -} ATTRIBUTE_FOR_PS2; /* SUNSOFT */ +}; struct hsPlane3 { @@ -491,6 +396,6 @@ struct hsPlane3 { void Read(hsStream *stream); void Write(hsStream *stream) const; -} ATTRIBUTE_FOR_PS2; +}; #endif diff --git a/Sources/Plasma/CoreLib/hsMMIOStream.h b/Sources/Plasma/CoreLib/hsMMIOStream.h index 83315758..50e28a53 100644 --- a/Sources/Plasma/CoreLib/hsMMIOStream.h +++ b/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 #include -#endif class hsMMIOStream: public hsStream { @@ -52,5 +51,6 @@ public: HMMIO GetHandle() { return fHmfr; } void SetHandle(HMMIO handle) { fHmfr = handle; } }; +#endif #endif // hsMMIOStream_inc diff --git a/Sources/Plasma/CoreLib/hsMatrix44.h b/Sources/Plasma/CoreLib/hsMatrix44.h index 746e9bb8..ef77a6c5 100644 --- a/Sources/Plasma/CoreLib/hsMatrix44.h +++ b/Sources/Plasma/CoreLib/hsMatrix44.h @@ -157,7 +157,7 @@ struct hsMatrix44 { void Read(hsStream *stream); void Write(hsStream *stream); -} ATTRIBUTE_FOR_PS2; /* SUNSOFT */ +}; #if 0 // Havok reeks inline int operator!=(const hsMatrix44& s, const hsMatrix44& t) diff --git a/Sources/Plasma/CoreLib/hsScalar.h b/Sources/Plasma/CoreLib/hsScalar.h index 54ea2157..d50b60ca 100644 --- a/Sources/Plasma/CoreLib/hsScalar.h +++ b/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, 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 hsSine(hsScalar angle) { return sinf(angle); } inline hsScalar hsCosine(hsScalar angle) { return cosf(angle); } diff --git a/Sources/Plasma/CoreLib/hsStream.cpp b/Sources/Plasma/CoreLib/hsStream.cpp index c7123260..9334a841 100644 --- a/Sources/Plasma/CoreLib/hsStream.cpp +++ b/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() { hsThrow("FastFwd unimplemented by subclass of stream"); @@ -567,87 +487,77 @@ UInt16 hsStream::ReadSwap16() { UInt16 value; this->Read(sizeof(UInt16), &value); - swapIt((Int16*)&value); + value = hsSWAP16(value); return value; } void hsStream::ReadSwap16(int count, UInt16 values[]) { this->Read(count * sizeof(UInt16), values); -#if HS_CPU_BENDIAN for (int i = 0; i < count; i++) - swapIt((Int16*)&values[i]); -#endif + values[i] = hsSWAP16(values[i]); } UInt32 hsStream::ReadSwap32() { UInt32 value; Read4Bytes(&value); - swapIt((Int32*)&value); + value = hsSWAP32(value); return value; } void hsStream::ReadSwap32(int count, UInt32 values[]) { this->Read(count * sizeof(UInt32), values); -#if HS_CPU_BENDIAN for (int i = 0; i < count; i++) - swapIt((Int32*)&values[i]); -#endif + values[i] = hsSWAP32(values[i]); } UInt32 hsStream::ReadUnswap32() { UInt32 value; Read4Bytes(&value); - unswapIt((Int32*)&value); + value = hsUNSWAP32(value); return value; } #if HS_CAN_USE_FLOAT double hsStream::ReadSwapDouble() { - double ival; - Read8Bytes(&ival); - double *pval = (double *)&ival; // all in the name of speed, - swapIt(pval); - return *pval; + double value; + Read8Bytes(&value); + value = hsSWAPDouble(value); + return value; } void hsStream::ReadSwapDouble(int count, double values[]) { this->Read(count * sizeof(double), values); -#if HS_CPU_BENDIAN - for (int i = 0; i < count; i++) - swapIt(&values[i]); -#endif - } + for (int i = 0; i < count; i++) + values[i] = hsSWAPDouble(values[i]); + } float hsStream::ReadSwapFloat() { - UInt32 ival; - Read4Bytes(&ival); - float *pval = (float *)&ival; // all in the name of speed, - swapIt(pval); - return *pval; + float value; + Read4Bytes(&value); + value = hsSWAPFloat(value); + return value; } void hsStream::ReadSwapFloat(int count, float values[]) { this->Read(count * sizeof(float), values); -#if HS_CPU_BENDIAN for (int i = 0; i < count; i++) - swapIt(&values[i]); -#endif + values[i] = hsSWAPFloat(values[i]); } float hsStream::ReadUnswapFloat() { - float value; + float value; this->Read(sizeof(float), &value); - unswapIt(&value); + value = hsUNSWAPFloat(value); return value; } #endif @@ -688,7 +598,7 @@ void hsStream::WriteByte(UInt8 value) void hsStream::WriteSwap16(UInt16 value) { - swapIt((Int16*)&value); + value = hsSWAP16(value); this->Write(sizeof(Int16), &value); } @@ -700,7 +610,7 @@ void hsStream::WriteSwap16(int count, const UInt16 values[]) void hsStream::WriteSwap32(UInt32 value) { - swapIt((Int32*)&value); + value = hsSWAP32(value); this->Write(sizeof(Int32), &value); } @@ -712,14 +622,14 @@ void hsStream::WriteSwap32(int count, const UInt32 values[]) void hsStream::WriteUnswap32(UInt32 value) { - unswapIt((Int32*)&value); + value = hsUNSWAP32(value); this->Write(sizeof(Int32), &value); } #if HS_CAN_USE_FLOAT void hsStream::WriteSwapDouble(double value) { - swapIt(&value); + value = hsSWAPDouble(value); this->Write(sizeof(double), &value); } @@ -731,7 +641,7 @@ void hsStream::WriteUnswap32(UInt32 value) void hsStream::WriteSwapFloat(float value) { - swapIt(&value); + value = hsSWAPFloat(value); this->Write(sizeof(float), &value); } @@ -743,7 +653,7 @@ void hsStream::WriteUnswap32(UInt32 value) void hsStream::WriteUnswapFloat(float value) { - unswapIt(&value); + value = hsUNSWAPFloat(value); this->Write(sizeof(float), &value); } #endif @@ -1061,8 +971,6 @@ void hsFileStream::Truncate() ////////////////////////////////////////////////////////////////////////////////////// -#if !HS_BUILD_FOR_PS2 -#if !(HS_BUILD_FOR_REFERENCE) hsUNIXStream::~hsUNIXStream() { @@ -1187,23 +1095,12 @@ void hsUNIXStream::Truncate() { if (!fRef) return; -#if! __MWERKS__ - int handle = _fileno(fRef); -#if !HS_BUILD_FOR_UNIX + int handle = fileno(fRef); +#if HS_BUILD_FOR_WIN32 _chsize(handle, fPosition); #else ftruncate(handle, fPosition); #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() @@ -1213,8 +1110,6 @@ void hsUNIXStream::Flush() (void)::fflush(fRef); } -#endif -#endif ////////////////////////////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/CoreLib/hsStream.h b/Sources/Plasma/CoreLib/hsStream.h index 5f4a2644..718cc96f 100644 --- a/Sources/Plasma/CoreLib/hsStream.h +++ b/Sources/Plasma/CoreLib/hsStream.h @@ -338,9 +338,6 @@ public: virtual void SetFileRef(UInt32 refNum); }; -#if !HS_BUILD_FOR_PS2 -#if !(HS_BUILD_FOR_REFERENCE) - class hsUNIXStream: public hsStream { FILE* fRef; @@ -399,9 +396,6 @@ public: virtual UInt32 GetEOF(); }; -#endif -#endif - class hsRAMStream : public hsStream { hsAppender fAppender; hsAppenderIterator fIter; diff --git a/Sources/Plasma/CoreLib/hsTypes.h b/Sources/Plasma/CoreLib/hsTypes.h index 8b8fef09..679cea4b 100644 --- a/Sources/Plasma/CoreLib/hsTypes.h +++ b/Sources/Plasma/CoreLib/hsTypes.h @@ -30,18 +30,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com /************************** Other Includes *****************************/ - -#if !(HS_BUILD_FOR_REFERENCE) - #if HS_BUILD_FOR_MAC - #include - #include - #include - #include - #endif - #include - #include +#include +#include -#endif #if HS_CAN_USE_FLOAT #include #endif @@ -170,30 +161,59 @@ typedef UInt32 hsGSeedValue; } inline UInt32 hsSwapEndian32(UInt32 value) { - return (value << 24) | - ((value & 0xFF00) << 8) | - ((value >> 8) & 0xFF00) | - (value >> 24); + return ((value) << 24) | + ((value & 0x0000ff00) << 8) | + ((value & 0x00ff0000) >> 8) | + ((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 - inline float hsSwapEndianFloat(float fvalue) - { - UInt32 value = *(UInt32*)&fvalue; - value = hsSwapEndian32(value); - return *(float*)&value; - } + inline float hsSwapEndianFloat(float fvalue) + { + UInt32 value = *(UInt32*)&fvalue; + value = hsSwapEndian32(value); + return *(float*)&value; + } + inline double hsSwapEndianDouble(double dvalue) + { + UInt64 value = *(UInt64*)&dvalue; + value = hsSwapEndian64(value); + return *(double*)&value; + } #endif - #if HS_CPU_LENDIAN - #define hsUNSWAP16(n) hsSwapEndian16(n) - #define hsUNSWAP32(n) hsSwapEndian32(n) - #define hsSWAP16(n) (n) - #define hsSWAP32(n) (n) + #if LITTLE_ENDIAN + #define hsUNSWAP16(n) hsSwapEndian16(n) + #define hsUNSWAP32(n) hsSwapEndian32(n) + #define hsUNSWAP64(n) hsSwapEndian64(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 - #define hsUNSWAP16(n) (n) - #define hsUNSWAP32(n) (n) - #define hsSWAP16(n) hsSwapEndian16(n) - #define hsSWAP32(n) hsSwapEndian32(n) + #define hsUNSWAP16(n) (n) + #define hsUNSWAP32(n) (n) + #define hsUNSWAP64(n) (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 inline void hsSwap(Int32& a, Int32& b) @@ -224,17 +244,7 @@ typedef UInt32 hsGSeedValue; 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; -#elif (HS_BUILD_FOR_UNIX && HS_CPU_BENDIAN) - UInt8 a, b, g, r; -#else - UInt8 a, r, g, b; -#endif -#endif #ifdef __cplusplus void SetARGB(UInt8 aa, UInt8 rr, UInt8 gg, UInt8 bb) diff --git a/Sources/Plasma/CoreLib/hsUtils.cpp b/Sources/Plasma/CoreLib/hsUtils.cpp index 5815f5da..8b1d78a0 100644 --- a/Sources/Plasma/CoreLib/hsUtils.cpp +++ b/Sources/Plasma/CoreLib/hsUtils.cpp @@ -72,7 +72,6 @@ static char hsStrBuf[100]; char *hsScalarToStr(hsScalar s) { -#if !(HS_BUILD_FOR_REFERENCE) if (s == hsIntToScalar(hsScalarToInt(s))) sprintf(hsStrBuf, "%d", hsScalarToInt(s)); else @@ -81,7 +80,6 @@ char *hsScalarToStr(hsScalar s) #else sprintf(hsStrBuf, "%d:%lu", hsFixedToInt(s), (UInt16)s); #endif -#endif return hsStrBuf; } diff --git a/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.h b/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.h index 6500160e..2e731f0e 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.h @@ -113,7 +113,7 @@ public: tokenType *MakeToken(T parentObject) {return TRACKED_NEW tokenType(parentObject, fGroup);} // 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 diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp index a3496814..9ece5df2 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp @@ -613,11 +613,11 @@ void plLineFollowMod::RemoveStereizer(const plKey& key) // it. plRailCameraMod::plRailCameraMod() : +plLineFollowMod(), fCurrentTime(0.0f), fTargetTime(0.0f), fFarthest(false) { - plLineFollowMod::plLineFollowMod(); fGoal.Set(0,0,0); } @@ -684,4 +684,4 @@ hsPoint3 plRailCameraMod::GetGoal(double secs, hsScalar speed) fPath->SetCurTime(fTargetTime, plAnimPath::kCalcPosOnly); return fGoal; -} \ No newline at end of file +} diff --git a/Sources/Plasma/NucleusLib/inc/plCreatableStrings.h b/Sources/Plasma/NucleusLib/inc/plCreatableStrings.h index 4c449e77..33f2b4a3 100644 --- a/Sources/Plasma/NucleusLib/inc/plCreatableStrings.h +++ b/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 #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_NONKEYED_OBJ_START }; char *plCreatableStrings::fNonKeyedStrings[] = { +#define CLASS_INDEX_NONKEYED_OBJ_START }; const char *plCreatableStrings::fNonKeyedStrings[] = { #define CLASS_INDEX_LIST_END }; #undef CLASS_INDEX_DATABASE_STRUCT_INDEXES_START #undef CLASS_INDEX_DATABASE_STRUCT_INDEXES_END #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 diff --git a/Sources/Plasma/NucleusLib/pnTimer/plTimedValue.h b/Sources/Plasma/NucleusLib/pnTimer/plTimedValue.h index 7cd42e31..ac468cca 100644 --- a/Sources/Plasma/NucleusLib/pnTimer/plTimedValue.h +++ b/Sources/Plasma/NucleusLib/pnTimer/plTimedValue.h @@ -28,8 +28,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define plTimedValue_inc #include "hsTimer.h" - -class hsStream; +#include "hsStream.h" // plTimedValue // To use, replace your member var of type T with plTimedValue. @@ -133,7 +132,7 @@ void plTimedSimple::Read(hsStream* s) template void plTimedSimple::Write(hsStream* s) const { - T val = Value(); + T val = this->Value(); s->WriteSwap(val); } @@ -148,7 +147,7 @@ void plTimedCompound::Read(hsStream* s) template void plTimedCompound::Write(hsStream* s) const { - T val = Value(); + T val = this->Value(); val.Write(s); } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h index c3e20f75..abe45221 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h @@ -765,16 +765,16 @@ TArray & TArray::operator= (const TArray & source) { if (&source == this) return *this; m_chunkSize = source.m_chunkSize; - AdjustSize(max(m_alloc, source.m_count), 0); - C::CopyConstruct(m_data, source.m_data, source.m_count); - m_count = source.m_count; + AdjustSize(max(this->m_alloc, source.m_count), 0); + C::CopyConstruct(this->m_data, source.m_data, source.m_count); + this->m_count = source.m_count; return *this; } //=========================================================================== template unsigned TArray::Add (const T & source) { - unsigned index = m_count; + unsigned index = this->m_count; Push(source); return index; } @@ -782,20 +782,20 @@ unsigned TArray::Add (const T & source) { //=========================================================================== template unsigned TArray::Add (const T * source, unsigned count) { - unsigned index = m_count; - AdjustSizeChunked(m_count + count, m_count); - C::CopyConstruct(&m_data[m_count], source, count); - m_count += count; + unsigned index = this->m_count; + AdjustSizeChunked(this->m_count + count, this->m_count); + C::CopyConstruct(&this->m_data[this->m_count], source, count); + this->m_count += count; return index; } //=========================================================================== template unsigned TArray::AddArray (const TArray & source) { - unsigned index = m_count; - AdjustSizeChunked(m_count + source.m_count, m_count); - C::CopyConstruct(&m_data[m_count], source.m_data, source.m_count); - m_count += source.m_count; + unsigned index = this->m_count; + AdjustSizeChunked(this->m_count + source.m_count, this->m_count); + C::CopyConstruct(&this->m_data[this->m_count], source.m_data, source.m_count); + this->m_count += source.m_count; return index; } @@ -804,15 +804,15 @@ template void TArray::AdjustSizeChunked (unsigned newAlloc, unsigned newCount) { // Disallow shrinking the allocation - if (newAlloc <= m_alloc) - newAlloc = m_alloc; + if (newAlloc <= this->m_alloc) + newAlloc = this->m_alloc; // Process growing the allocation else - newAlloc = CalcAllocGrowth(newAlloc, m_alloc, &m_chunkSize); + newAlloc = CalcAllocGrowth(newAlloc, this->m_alloc, &this->m_chunkSize); // Perform the allocation - AdjustSize(newAlloc, newCount); + this->AdjustSize(newAlloc, newCount); } @@ -823,38 +823,38 @@ void TArray::Copy (unsigned destIndex, unsigned sourceIndex, unsigned count // Copy the data to the destination ASSERT(destIndex + count <= m_count); ASSERT(sourceIndex + count <= m_count); - C::Assign(m_data + destIndex, m_data + sourceIndex, count); + C::Assign(this->m_data + destIndex, this->m_data + sourceIndex, count); } //=========================================================================== template void TArray::DeleteOrdered (unsigned index) { - ASSERT(index < m_count); - if (index + 1 < m_count) - C::Assign(&m_data[index], &m_data[index + 1], m_count - index - 1); - C::Destruct(&m_data[--m_count]); + ASSERT(index < this->m_count); + if (index + 1 < this->m_count) + C::Assign(&this->m_data[index], &this->m_data[index + 1], this->m_count - index - 1); + C::Destruct(&this->m_data[--this->m_count]); } //=========================================================================== template void TArray::DeleteUnordered (unsigned index) { - ASSERT(index < m_count); - if (index + 1 < m_count) - C::Assign(&m_data[index], &m_data[m_count - 1], 1); - C::Destruct(&m_data[--m_count]); + ASSERT(index < this->m_count); + if (index + 1 < this->m_count) + C::Assign(&this->m_data[index], &this->m_data[this->m_count - 1], 1); + C::Destruct(&this->m_data[--this->m_count]); } //=========================================================================== template void TArray::GrowToCount (unsigned count, bool zero) { - if (count <= m_count) + if (count <= this->m_count) return; - AdjustSizeChunked(count, m_count); + AdjustSizeChunked(count, this->m_count); if (zero) - memset(m_data + m_count, 0, (count - m_count) * sizeof(T)); - C::Construct(m_data + m_count, count - m_count); - m_count = count; + memset(this->m_data + this->m_count, 0, (count - this->m_count) * sizeof(T)); + C::Construct(this->m_data + this->m_count, count - this->m_count); + this->m_count = count; } //=========================================================================== @@ -866,9 +866,9 @@ void TArray::GrowToFit (unsigned index, bool zero) { //=========================================================================== template void TArray::ShrinkBy (unsigned count) { - ASSERT(count <= m_count); - C::Destruct(m_data + m_count - count, count); - m_count -= count; + ASSERT(count <= this->m_count); + C::Destruct(this->m_data + this->m_count - count, count); + this->m_count -= count; } //=========================================================================== @@ -876,20 +876,20 @@ template void TArray::Move (unsigned destIndex, unsigned sourceIndex, unsigned count) { // Copy the data to the destination - ASSERT(destIndex + count <= m_count); - ASSERT(sourceIndex + count <= m_count); - C::Assign(m_data + destIndex, m_data + sourceIndex, count); + ASSERT(destIndex + count <= this->m_count); + ASSERT(sourceIndex + count <= this->m_count); + C::Assign(this->m_data + destIndex, this->m_data + sourceIndex, count); // Remove it from the source if (destIndex >= sourceIndex) { - C::Destruct(m_data + sourceIndex, min(count, destIndex - sourceIndex)); - C::Construct(m_data + sourceIndex, min(count, destIndex - sourceIndex)); + C::Destruct(this->m_data + sourceIndex, min(count, destIndex - sourceIndex)); + C::Construct(this->m_data + sourceIndex, min(count, destIndex - sourceIndex)); } else { unsigned overlap = (destIndex + count > sourceIndex) ? (destIndex + count - sourceIndex) : 0; ASSERT(overlap <= count); - C::Destruct(m_data + sourceIndex + overlap, count - overlap); - C::Construct(m_data + sourceIndex + overlap, count - overlap); + C::Destruct(this->m_data + sourceIndex + overlap, count - overlap); + C::Construct(this->m_data + sourceIndex + overlap, count - overlap); } } @@ -897,72 +897,72 @@ void TArray::Move (unsigned destIndex, unsigned sourceIndex, unsigned count //=========================================================================== template T * TArray::New () { - AdjustSizeChunked(m_count + 1, m_count + 1); - return &m_data[m_count - 1]; + AdjustSizeChunked(this->m_count + 1, this->m_count + 1); + return &this->m_data[this->m_count - 1]; } //=========================================================================== template T * TArray::New (unsigned count) { - AdjustSizeChunked(m_count + count, m_count + count); - return &m_data[m_count - count]; + AdjustSizeChunked(this->m_count + count, this->m_count + count); + return &this->m_data[this->m_count - count]; } //=========================================================================== template void TArray::Push (const T & source) { - AdjustSizeChunked(m_count + 1, m_count); - C::CopyConstruct(&m_data[m_count], source); - ++m_count; + AdjustSizeChunked(this->m_count + 1, this->m_count); + C::CopyConstruct(&this->m_data[this->m_count], source); + ++this->m_count; } //=========================================================================== template T TArray::Pop () { - ASSERT(m_count); - T result = m_data[--m_count]; - C::Destruct(m_data + m_count); + ASSERT(this->m_count); + T result = this->m_data[--this->m_count]; + C::Destruct(this->m_data + this->m_count); return result; } //=========================================================================== template void TArray::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 void TArray::Set (const T * source, unsigned count) { AdjustSizeChunked(count, 0); - C::CopyConstruct(m_data, source, count); - m_count = count; + C::CopyConstruct(this->m_data, source, count); + this->m_count = count; } //=========================================================================== template void TArray::SetChunkSize (unsigned chunkSize) { - m_chunkSize = chunkSize; + this->m_chunkSize = chunkSize; } //=========================================================================== template void TArray::SetCount (unsigned count) { - AdjustSizeChunked(max(m_alloc, count), count); + AdjustSizeChunked(max(this->m_alloc, count), count); } //=========================================================================== template void TArray::SetCountFewer (unsigned count) { - ASSERT(count <= m_count); - C::Destruct(m_data + count, m_count - count); - m_count = count; + ASSERT(count <= this->m_count); + C::Destruct(this->m_data + count, this->m_count - count); + this->m_count = count; } //=========================================================================== template void TArray::Trim () { - AdjustSize(m_count, m_count); + this->AdjustSize(this->m_count, this->m_count); } @@ -995,15 +995,15 @@ bool TSortArray::Delete (K sortKey) { // Find the correct position for this key 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 - unsigned count = Count(); + unsigned count = this->Count(); if ((index >= count) || (SortKey((*this)[index]) != sortKey)) return false; // Delete the entry - DeleteOrdered(index); + this->DeleteOrdered(index); return true; } @@ -1013,8 +1013,8 @@ template T * TSortArray::Find (K sortKey, unsigned * index) { // Find the correct position for this key - BSEARCH(T, Ptr(), Count(), (sortKey > SortKey(elem)), index); - if (*index >= Count()) + BSEARCH(T, this->Ptr(), this->Count(), (sortKey > SortKey(elem)), index); + if (*index >= this->Count()) return nil; // Check whether the key is at that position @@ -1028,8 +1028,8 @@ template const T * TSortArray::Find (K sortKey, unsigned * index) const { // Find the correct position for this key - BSEARCH(T, Ptr(), Count(), (sortKey > SortKey(elem)), index); - if (*index >= Count()) + BSEARCH(T, this->Ptr(), this->Count(), (sortKey > SortKey(elem)), index); + if (*index >= this->Count()) return nil; // Check whether the key is at that position @@ -1043,10 +1043,10 @@ template T * TSortArray::Insert (K sortKey, unsigned index) { // Insert a new entry at this position - unsigned count = Count(); - SetCount(count + 1); + unsigned count = this->Count(); + this->SetCount(count + 1); if (index < count) - Move(index + 1, index, count - index); + this->Move(index + 1, index, count - index); // Fill in the new entry T & elem = (*this)[index]; @@ -1058,8 +1058,8 @@ T * TSortArray::Insert (K sortKey, unsigned index) { //=========================================================================== template void TSortArray::Sort () { - T * ptr = Ptr(); - unsigned count = Count(); + T * ptr = this->Ptr(); + unsigned count = this->Count(); QSORT( T, ptr, diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h index a3d8b10f..1c45c149 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h @@ -451,7 +451,7 @@ T * THashTable::FindNext (const K & key, T * object) { template const T * THashTable::Find (const K & key) const { 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)) if ((GetHash(curr) == hash) && (*curr == key)) return curr; @@ -462,7 +462,7 @@ const T * THashTable::Find (const K & key) const { template const T * THashTable::FindNext (const K & key, const T * object) const { 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)) if ((GetHash(curr) == hash) && (*curr == key)) return curr; @@ -501,8 +501,8 @@ public: //=========================================================================== template THashTableDecl::THashTableDecl () { - SetLinkOffset(linkOffset, maxSize); - SetSlotMaxCount(maxSize); + this->SetLinkOffset(linkOffset, maxSize); + this->SetSlotMaxCount(maxSize); } @@ -523,8 +523,8 @@ public: //=========================================================================== template void THashTableDyn::Initialize (int linkOffset, unsigned maxSize) { - SetLinkOffset(linkOffset, maxSize); - SetSlotMaxCount(maxSize); + this->SetLinkOffset(linkOffset, maxSize); + this->SetSlotMaxCount(maxSize); } @@ -581,10 +581,10 @@ template class THashKeyStrCmp : public THashKeyStrBase { public: 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 { - return StrHash(m_str); + return StrHash(this->m_str); } protected: @@ -597,10 +597,10 @@ template class THashKeyStrCmpI : public THashKeyStrBase { public: 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 { - return StrHashI(m_str); + return StrHashI(this->m_str); } protected: @@ -621,7 +621,7 @@ public: THashKeyStrPtr () { } THashKeyStrPtr (const C str[]) : T(str) { } void SetString (const C str[]) { - m_str = str; + this->m_str = str; } }; @@ -648,12 +648,12 @@ public: SetString(nil); } void SetString (const C str[]) { // deprecated - if (m_str) - FREE(const_cast(m_str)); + if (this->m_str) + FREE(const_cast(this->m_str)); if (str) - m_str = StrDup(str); + this->m_str = StrDup(str); else - m_str = nil; + this->m_str = nil; } }; diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.h index 3d436873..6da06c0c 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.h @@ -554,7 +554,7 @@ inline T * TList::NewFlags (unsigned flags, ELinkType linkType, T * existingN //=========================================================================== template inline T * TList::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 TListDecl::TListDecl () { - SetLinkOffset(linkOffset); + this->SetLinkOffset(linkOffset); } @@ -626,5 +626,5 @@ public: //=========================================================================== template void TListDyn::Initialize (int linkOffset) { - SetLinkOffset(linkOffset); + this->SetLinkOffset(linkOffset); } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPriQ.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPriQ.h index cd2d6876..7b6ed941 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPriQ.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPriQ.h @@ -99,7 +99,7 @@ private: int m_linkOffset; ARRAY(C *) m_array; - friend TBasePriority; + friend class TBasePriority; }; //=========================================================================== @@ -332,7 +332,7 @@ inline void TPriorityQueue::UnlinkAll () { template class TPriorityQueueDecl : public TPriorityQueue { public: - TPriorityQueueDecl () { SetLinkOffset(linkOffset); } + TPriorityQueueDecl () { this->SetLinkOffset(linkOffset); } }; @@ -345,7 +345,7 @@ public: template class TPriorityQueueDyn : public TPriorityQueue { public: - void Initialize (int linkOffset) { SetLinkOffset(linkOffset); } + void Initialize (int linkOffset) { this->SetLinkOffset(linkOffset); } }; @@ -381,7 +381,7 @@ private: TPriorityQueue * m_queue; unsigned m_index; - friend TPriorityQueue; + friend class TPriorityQueue; }; //=========================================================================== @@ -421,7 +421,7 @@ public: if (value == m_value) return; m_value = value; - Relink(); + this->Relink(); } T Get () const { return m_value; @@ -454,7 +454,7 @@ public: if (m_time == time) return; m_time = time; - Relink(); + this->Relink(); } unsigned Get () const { return m_time; diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSkipList.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSkipList.h index e6002d6c..684ede09 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSkipList.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSkipList.h @@ -97,13 +97,13 @@ class TSkipList { private: enum { kMaxLevels = 32 }; - template + template struct TNode { - const K * key; - T * object; + const K2 * key; + T2 * object; unsigned level; - TNode * prev; - TNode * next[1]; // variable size array + TNode * prev; + TNode * next[1]; // variable size array }; typedef TNode Node; @@ -147,7 +147,7 @@ public: //============================================================================ template -typename TSkipList::TNode * TSkipList::AllocNode (unsigned level) { +typename TSkipList::Node* TSkipList::AllocNode (unsigned level) { unsigned size = offsetof(Node, next) + (level + 1) * sizeof(Node); Node * node = (Node *)ALLOC(size); diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.h index a6fcdef5..6a0487b5 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.h @@ -102,13 +102,13 @@ public: //=========================================================================== template void * TSpareList::Alloc () { - return CBaseSpareList::Alloc(OBJECT_SIZE, typeid(T).raw_name()); + return CBaseSpareList::Alloc(OBJECT_SIZE, typeid(T).name()); } //=========================================================================== template void TSpareList::CleanUp () { - CBaseSpareList::CleanUp(typeid(T).raw_name()); + CBaseSpareList::CleanUp(typeid(T).name()); } //=========================================================================== @@ -127,5 +127,5 @@ void TSpareList::Free (T * node) { //=========================================================================== template T * TSpareList::New () { - return new(CBaseSpareList::Alloc(OBJECT_SIZE, typeid(T).raw_name())) T; + return new(CBaseSpareList::Alloc(OBJECT_SIZE, typeid(T).name())) T; } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.h index 03d140da..51cbd82e 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.h @@ -36,10 +36,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com template struct SubstParsedData { - template + template struct SubstBlock { bool isVar; - chartype * data; + char_type * data; unsigned strLen; SubstBlock() diff --git a/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp b/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp index d757e8b0..ca88fd95 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp @@ -761,7 +761,6 @@ void plDSoundBuffer::SetTimeOffsetSec(float seconds) void plDSoundBuffer::SetTimeOffsetBytes(unsigned bytes) { - alSourcef(source, AL_BYTE_OFFSET, bytes); + alSourcei(source, AL_BYTE_OFFSET, bytes); ALenum error = alGetError(); } - \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h index 98ac679e..f100ee24 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h @@ -33,7 +33,6 @@ class plDSoundBuffer; class DSoundCallbackHandle; class plAudioFileReader; class plStreamingSoundThread; -enum CallbackHandleType; class plSoundDeswizzler; class plWin32StreamingSound : public plWin32Sound diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp index eb1d6ef7..157c8264 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp @@ -23,7 +23,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include + #include "hsTypes.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/hsFiles.h" #include "plUnifiedTime/plUnifiedTime.h" -#include "pnUtils/pnUtils.h" #include "plStatusLog/plStatusLog.h" #include "hsTimer.h" @@ -167,7 +166,7 @@ plSoundBuffer::~plSoundBuffer() { while(!fLoaded) { - Sleep(10); + hsSleep::Sleep(10); } } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h index 641e0d88..a4626e47 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h @@ -227,7 +227,6 @@ protected: plAnimVector fPrivateAnims; // animations that require AnimTimeConvert state to be synched - typedef std::vector plAnimVector; plInstanceVector fATCAnimInstances; hsBool fFirstEval; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h index 0c481880..1a00dbca 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h @@ -66,6 +66,7 @@ class plAGChannel; class plClothingOutfit; class plClothingSDLModifier; class plAvatarSDLModifier; +class plAvatarPhysicalSDLModifier; class plMatrixDelayedCorrectionApplicator; class plMatrixDifferenceApp; class plDebugText; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.h index 1083f58e..b2f0db7a 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.h @@ -39,6 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include class plArmatureModBase; +class plArmatureMod; class plArmatureBehavior; class plHKAction; class plAvTask; diff --git a/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.h b/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.h index be6fec21..d484cfc0 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.h +++ b/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.h @@ -39,6 +39,7 @@ class plATCEaseCurve; class plATCState; class plATCAnim; class plAGMasterMod; +class plAGAnimInstance; class plAnimTimeConvert : public plCreatable { diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h b/Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h index 73dac075..17584646 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h +++ b/Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h @@ -71,7 +71,7 @@ protected: plRegistryPageNode() {} - inline plRegistryKeyList* IGetKeyList(UInt16 classType) const; + plRegistryKeyList* IGetKeyList(UInt16 classType) const; PageCond IVerify(); public: