mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 10:52:46 +00:00
Obliterate hsBool
This commit is contained in:
@ -139,10 +139,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
# define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef int hsBool;
|
||||
#endif
|
||||
|
||||
#ifndef nil
|
||||
# define nil (0)
|
||||
#endif
|
||||
|
@ -53,7 +53,7 @@ template <class T> class hsExpander {
|
||||
private:
|
||||
int32_t fNumPost;
|
||||
int32_t fNumPostAlloc;
|
||||
T* fArray;
|
||||
T* fArray;
|
||||
|
||||
int32_t fGrowBy; // default = 0, to double
|
||||
int32_t fMinSize; // default = 1, min == 1
|
||||
@ -72,23 +72,23 @@ public:
|
||||
hsExpander<T>& operator=(const hsExpander<T>&orig) { return Copy(orig); }
|
||||
hsExpander<T>& Copy(const hsExpander<T>& orig);
|
||||
|
||||
void SetCount(int cnt) { if( cnt >= fNumPostAlloc )IExpand(cnt); fNumPost = cnt; }
|
||||
int32_t GetCount() const { return fNumPost; }
|
||||
hsBool Empty() const { return GetCount() == 0; }
|
||||
const T& Get(int32_t index) const;
|
||||
int32_t Get(int32_t index, int32_t count, T data[]) const;
|
||||
int32_t Find(const T&) const; // returns kMissingIndex if not found
|
||||
void SetCount(int cnt) { if( cnt >= fNumPostAlloc )IExpand(cnt); fNumPost = cnt; }
|
||||
int32_t GetCount() const { return fNumPost; }
|
||||
bool Empty() const { return GetCount() == 0; }
|
||||
const T& Get(int32_t index) const;
|
||||
int32_t Get(int32_t index, int32_t count, T data[]) const;
|
||||
int32_t Find(const T&) const; // returns kMissingIndex if not found
|
||||
|
||||
void SetArray(T* a, int32_t cnt);
|
||||
T* GetArray() { return fArray; }
|
||||
T& operator[]( int32_t index );
|
||||
int32_t Append(const T&); // returns t's index
|
||||
int32_t Append(const T&); // returns t's index
|
||||
T* Append();
|
||||
int32_t Push(const T& t) { return Append(t); }
|
||||
int32_t Push(const T& t) { return Append(t); }
|
||||
T* Push() { return Append(); }
|
||||
T* Top() { return fNumPost ? fArray + fNumPost-1 : nil; }
|
||||
int32_t Pop(T* t); // returns count of remaining
|
||||
int32_t Pop();
|
||||
int32_t Pop(T* t); // returns count of remaining
|
||||
int32_t Pop();
|
||||
void Reset(); // clears out everything
|
||||
|
||||
T& Head() { return fArray[0]; }
|
||||
@ -97,7 +97,7 @@ public:
|
||||
void First();
|
||||
void Last();
|
||||
void Plus() { ++fCurrent; }
|
||||
hsBool More() { return (fCurrent < fNumPost); }
|
||||
bool More() { return (fCurrent < fNumPost); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
@ -261,7 +261,7 @@ private:
|
||||
int32_t fNumPost;
|
||||
int32_t fNumPreAlloc;
|
||||
int32_t fNumPostAlloc;
|
||||
T* fArray;
|
||||
T* fArray;
|
||||
|
||||
int32_t fGrowBy; // default = 0, to double
|
||||
int32_t fMinSize; // default = 1, min == 1
|
||||
@ -271,7 +271,7 @@ private:
|
||||
hsBiExpander<T>& operator=(const hsBiExpander<T>&); // don't allow assignment
|
||||
hsBiExpander(const hsBiExpander<T>&); // make it passed as ref or pointer
|
||||
|
||||
void IExpand(int newSize, hsBool towardEnd = true);
|
||||
void IExpand(int newSize, bool towardEnd = true);
|
||||
public:
|
||||
enum { kMissingIndex = -1 };
|
||||
|
||||
@ -280,22 +280,22 @@ public:
|
||||
|
||||
int32_t GetFirst() const { return -fNumPre; }
|
||||
int32_t GetCount() const { return fNumPre + fNumPost; }
|
||||
hsBool Empty() const { return GetCount() == 0; }
|
||||
const T& Get(int32_t index) const;
|
||||
bool Empty() const { return GetCount() == 0; }
|
||||
const T& Get(int32_t index) const;
|
||||
int32_t Get(int32_t index, int32_t count, T data[]) const;
|
||||
int32_t Find(const T&) const; // returns kMissingIndex if not found
|
||||
|
||||
void SetArray(T* a, int32_t cnt, int32_t numPre=0);
|
||||
T** GetArray() { return fArray - fNumPre; }
|
||||
T& operator[]( int32_t index );
|
||||
T* Append(); // returns t's index
|
||||
T* Push(); // returns t's index
|
||||
void SetArray(T* a, int32_t cnt, int32_t numPre=0);
|
||||
T** GetArray() { return fArray - fNumPre; }
|
||||
T& operator[]( int32_t index );
|
||||
T* Append(); // returns t's index
|
||||
T* Push(); // returns t's index
|
||||
int32_t Append(const T&); // returns t's index
|
||||
int32_t Push(const T&); // returns t's index
|
||||
int32_t Pop(T*t = nil) { return PopHead(t); } // returns count of remaining
|
||||
int32_t PopHead(T*t = nil); // returns count of remaining
|
||||
int32_t PopTail(T*t = nil); // returns count of remaining
|
||||
void Reset(); // clears out everything
|
||||
void Reset(); // clears out everything
|
||||
|
||||
T& Head() { return fArray[-fNumPre]; }
|
||||
T& Tail() { return fArray[fNumPost-1]; }
|
||||
@ -304,7 +304,7 @@ public:
|
||||
void Last();
|
||||
void Plus() { ++fCurrent; }
|
||||
void Minus() { --fCurrent; }
|
||||
hsBool More() { return (fCurrent < fNumPost)&&(fCurrent >= -fNumPre); }
|
||||
bool More() { return (fCurrent < fNumPost)&&(fCurrent >= -fNumPre); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
@ -321,7 +321,7 @@ void hsBiExpander<T>::SetArray(T* a, int32_t cnt, int32_t numPre)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void hsBiExpander<T>::IExpand(int newSize, hsBool towardEnd)
|
||||
void hsBiExpander<T>::IExpand(int newSize, bool towardEnd)
|
||||
{
|
||||
int32_t newPreAlloc = fNumPreAlloc;
|
||||
int32_t newPostAlloc = fNumPostAlloc;
|
||||
|
@ -69,21 +69,21 @@ public:
|
||||
hsBitVector& Clear(); // everyone clear, but no dealloc
|
||||
hsBitVector& Set(int upToBit=-1); // WARNING - see comments at function
|
||||
|
||||
int operator==(const hsBitVector& other) const; // unset (ie uninitialized) bits are clear,
|
||||
int operator!=(const hsBitVector& other) const { return !(*this == other); }
|
||||
bool operator==(const hsBitVector& other) const; // unset (ie uninitialized) bits are clear,
|
||||
bool operator!=(const hsBitVector& other) const { return !(*this == other); }
|
||||
hsBitVector& operator=(const hsBitVector& other); // will wind up identical
|
||||
|
||||
hsBool ClearBit(uint32_t which) { return SetBit(which, 0); } // returns previous state
|
||||
hsBool SetBit(uint32_t which, hsBool on = true); // returns previous state
|
||||
hsBool IsBitSet(uint32_t which) const; // returns current state
|
||||
hsBool ToggleBit(uint32_t which); // returns previous state
|
||||
bool ClearBit(uint32_t which) { return SetBit(which, 0); } // returns previous state
|
||||
bool SetBit(uint32_t which, bool on = true); // returns previous state
|
||||
bool IsBitSet(uint32_t which) const; // returns current state
|
||||
bool ToggleBit(uint32_t which); // returns previous state
|
||||
hsBitVector& RemoveBit(uint32_t which); // removes bit, sliding higher bits down to fill the gap.
|
||||
|
||||
friend inline int Overlap(const hsBitVector& lhs, const hsBitVector& rhs) { return lhs.Overlap(rhs); }
|
||||
hsBool Overlap(const hsBitVector& other) const;
|
||||
hsBool Empty() const;
|
||||
bool Overlap(const hsBitVector& other) const;
|
||||
bool Empty() const;
|
||||
|
||||
hsBool operator[](uint32_t which) const { return IsBitSet(which); }
|
||||
bool operator[](uint32_t which) const { return IsBitSet(which); }
|
||||
|
||||
friend inline hsBitVector operator&(const hsBitVector& lhs, const hsBitVector& rhs); // See Overlap()
|
||||
friend inline hsBitVector operator|(const hsBitVector& lhs, const hsBitVector& rhs);
|
||||
@ -127,7 +127,7 @@ inline hsBitVector::hsBitVector(const hsBitVector& other)
|
||||
fBitVectors = nil;
|
||||
}
|
||||
|
||||
inline hsBool hsBitVector::Empty() const
|
||||
inline bool hsBitVector::Empty() const
|
||||
{
|
||||
int i;
|
||||
for( i = 0; i < fNumBitVectors; i++ )
|
||||
@ -138,7 +138,7 @@ inline hsBool hsBitVector::Empty() const
|
||||
return true;
|
||||
}
|
||||
|
||||
inline hsBool hsBitVector::Overlap(const hsBitVector& other) const
|
||||
inline bool hsBitVector::Overlap(const hsBitVector& other) const
|
||||
{
|
||||
if( fNumBitVectors > other.fNumBitVectors )
|
||||
return other.Overlap(*this);
|
||||
@ -174,7 +174,7 @@ inline hsBitVector& hsBitVector::operator=(const hsBitVector& other)
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline int hsBitVector::operator==(const hsBitVector& other) const
|
||||
inline bool hsBitVector::operator==(const hsBitVector& other) const
|
||||
{
|
||||
if( fNumBitVectors < other.fNumBitVectors )
|
||||
return other.operator==(*this);
|
||||
@ -315,7 +315,7 @@ inline hsBitVector& hsBitVector::Set(int upToBit)
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline hsBool hsBitVector::IsBitSet(uint32_t which) const
|
||||
inline bool hsBitVector::IsBitSet(uint32_t which) const
|
||||
{
|
||||
uint32_t major = which >> 5;
|
||||
return
|
||||
@ -323,13 +323,13 @@ inline hsBool hsBitVector::IsBitSet(uint32_t which) const
|
||||
&& (0 != (fBitVectors[major] & 1 << (which & 0x1f)));
|
||||
}
|
||||
|
||||
inline hsBool hsBitVector::SetBit(uint32_t which, hsBool on)
|
||||
inline bool hsBitVector::SetBit(uint32_t which, bool on)
|
||||
{
|
||||
uint32_t major = which >> 5;
|
||||
uint32_t minor = 1 << (which & 0x1f);
|
||||
if( major >= fNumBitVectors )
|
||||
IGrow(major+1);
|
||||
hsBool ret = 0 != (fBitVectors[major] & minor);
|
||||
bool ret = 0 != (fBitVectors[major] & minor);
|
||||
if( ret != on )
|
||||
{
|
||||
if( on )
|
||||
@ -341,13 +341,13 @@ inline hsBool hsBitVector::SetBit(uint32_t which, hsBool on)
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline hsBool hsBitVector::ToggleBit(uint32_t which)
|
||||
inline bool hsBitVector::ToggleBit(uint32_t which)
|
||||
{
|
||||
uint32_t major = which >> 5;
|
||||
uint32_t minor = 1 << (which & 0x1f);
|
||||
if( major >= fNumBitVectors )
|
||||
IGrow(major);
|
||||
hsBool ret = 0 != (fBitVectors[major] & minor);
|
||||
bool ret = 0 != (fBitVectors[major] & minor);
|
||||
if( ret )
|
||||
fBitVectors[major] &= ~minor;
|
||||
else
|
||||
|
@ -249,7 +249,7 @@ int32_t hsBounds3::TestBound(const hsBounds3& other) const
|
||||
return retVal;
|
||||
}
|
||||
|
||||
hsBool hsBounds3::IsInside(const hsPoint3* pos) const
|
||||
bool hsBounds3::IsInside(const hsPoint3* pos) const
|
||||
{
|
||||
hsAssert(fType != kBoundsUninitialized, "Invalid bounds type for hsBounds3::IsInside() ");
|
||||
if(fType == kBoundsEmpty)
|
||||
@ -471,7 +471,7 @@ float hsBounds3::ClosestPointToInfiniteLine(const hsPoint3* p, const hsVector3*
|
||||
return t;
|
||||
}
|
||||
|
||||
hsBool hsBounds3::ClosestPoint(const hsPoint3& p, hsPoint3& inner, hsPoint3& outer) const
|
||||
bool hsBounds3::ClosestPoint(const hsPoint3& p, hsPoint3& inner, hsPoint3& outer) const
|
||||
{
|
||||
// Look for axis intervals p is within
|
||||
int nSect = 0;
|
||||
@ -532,7 +532,7 @@ void hsBoundsOriented::TestPlane(const hsVector3 &n, hsPoint2 &depth) const
|
||||
//
|
||||
// Return true if inside all the planes
|
||||
//
|
||||
hsBool hsBoundsOriented::IsInside(const hsPoint3* pos) const
|
||||
bool hsBoundsOriented::IsInside(const hsPoint3* pos) const
|
||||
{
|
||||
hsAssert(fType == kBoundsNormal, "Invalid bounds type for hsBounds3::IsInside() ");
|
||||
if(fType == kBoundsEmpty)
|
||||
@ -629,7 +629,7 @@ void hsBoundsOriented::Read(hsStream *stream)
|
||||
{
|
||||
hsBounds::Read(stream);
|
||||
fCenter.Read(stream);
|
||||
fCenterValid = (hsBool)stream->ReadLE32();
|
||||
fCenterValid = (bool)stream->ReadLE32();
|
||||
fNumPlanes = stream->ReadLE32();
|
||||
if (fPlanes)
|
||||
delete [] fPlanes;
|
||||
@ -1009,7 +1009,7 @@ void hsBounds3Ext::Translate(const hsVector3 &v)
|
||||
}
|
||||
}
|
||||
|
||||
hsBool hsBounds3Ext::IsInside(const hsPoint3 *p) const
|
||||
bool hsBounds3Ext::IsInside(const hsPoint3 *p) const
|
||||
{
|
||||
if( fExtFlags & kAxisAligned )
|
||||
return hsBounds3::IsInside(p);
|
||||
@ -1192,9 +1192,9 @@ int32_t hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList, const hsVector3 &
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
float diff = fAxes[i].InnerProduct(ptVel);
|
||||
hsBool someLow = false;
|
||||
hsBool someHi = false;
|
||||
hsBool someIn = false;
|
||||
bool someLow = false;
|
||||
bool someHi = false;
|
||||
bool someIn = false;
|
||||
int j;
|
||||
for( j = 0; j < n; j++ )
|
||||
{
|
||||
@ -1230,8 +1230,8 @@ int32_t hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList, const hsVector3 &
|
||||
|
||||
int32_t hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList) const
|
||||
{
|
||||
hsBool someIn = false;
|
||||
hsBool someOut = false;
|
||||
bool someIn = false;
|
||||
bool someOut = false;
|
||||
int i;
|
||||
for( i = 0; i < n; i++ )
|
||||
{
|
||||
@ -1247,7 +1247,7 @@ int32_t hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList) const
|
||||
return 1;
|
||||
}
|
||||
|
||||
hsBool hsBounds3Ext::ClosestPoint(const hsPoint3& p, hsPoint3& inner, hsPoint3& outer) const
|
||||
bool hsBounds3Ext::ClosestPoint(const hsPoint3& p, hsPoint3& inner, hsPoint3& outer) const
|
||||
{
|
||||
if( fExtFlags & kAxisAligned )
|
||||
return hsBounds3::ClosestPoint(p, inner, outer);
|
||||
@ -1282,7 +1282,7 @@ hsBool hsBounds3Ext::ClosestPoint(const hsPoint3& p, hsPoint3& inner, hsPoint3&
|
||||
return nSect == 3;
|
||||
}
|
||||
|
||||
hsBool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel) const
|
||||
bool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel) const
|
||||
{
|
||||
if( fExtFlags & kAxisAligned )
|
||||
{
|
||||
@ -1356,7 +1356,7 @@ hsBool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel)
|
||||
}
|
||||
|
||||
|
||||
static hsBool ISectInterval(const hsPoint2& other, const hsPoint2& mine)
|
||||
static bool ISectInterval(const hsPoint2& other, const hsPoint2& mine)
|
||||
{
|
||||
if( other.fY - mine.fX <= 0 )
|
||||
return false;
|
||||
@ -1366,7 +1366,7 @@ static hsBool ISectInterval(const hsPoint2& other, const hsPoint2& mine)
|
||||
return true;
|
||||
}
|
||||
|
||||
static hsBool ITestDepth(const hsPoint2& other, const hsPoint2& mine,
|
||||
static bool ITestDepth(const hsPoint2& other, const hsPoint2& mine,
|
||||
const hsVector3& inAx,
|
||||
hsVector3 &outAx, float& depth)
|
||||
{
|
||||
@ -1475,7 +1475,7 @@ void hsBounds3Ext::Unalign()
|
||||
fAxes[2].Set(0, 0, span);
|
||||
}
|
||||
|
||||
hsBool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const
|
||||
bool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const
|
||||
{
|
||||
if( fExtFlags & kAxisAligned )
|
||||
{
|
||||
@ -1640,7 +1640,7 @@ hsBool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel,
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsBounds3Ext::ISectABB(const hsBounds3Ext &other, const hsVector3 &myVel) const
|
||||
bool hsBounds3Ext::ISectABB(const hsBounds3Ext &other, const hsVector3 &myVel) const
|
||||
{
|
||||
hsPoint3 effMaxs = fMaxs;
|
||||
hsPoint3 effMins = fMins;
|
||||
@ -1662,7 +1662,7 @@ hsBool hsBounds3Ext::ISectABB(const hsBounds3Ext &other, const hsVector3 &myVel)
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsBounds3Ext::ISectBS(const hsBounds3Ext &other, const hsVector3 &myVel) const
|
||||
bool hsBounds3Ext::ISectBS(const hsBounds3Ext &other, const hsVector3 &myVel) const
|
||||
{
|
||||
if( !(fExtFlags & kSphereSet) )
|
||||
IMakeSphere();
|
||||
@ -1691,7 +1691,7 @@ hsBool hsBounds3Ext::ISectBS(const hsBounds3Ext &other, const hsVector3 &myVel)
|
||||
}
|
||||
|
||||
#if 0 // Commenting out this which will be made redundant and/or obsolete by Havok integration
|
||||
hsBool hsBounds3Ext::ISectTriABB(hsBounds3Tri &tri, const hsVector3 &myVel) const
|
||||
bool hsBounds3Ext::ISectTriABB(hsBounds3Tri &tri, const hsVector3 &myVel) const
|
||||
{
|
||||
int i;
|
||||
for( i = 0; i < 3; i++ )
|
||||
@ -1719,13 +1719,13 @@ hsBool hsBounds3Ext::ISectTriABB(hsBounds3Tri &tri, const hsVector3 &myVel) cons
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsBounds3Ext::TriBSHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsHitInfoExt* hit) const
|
||||
bool hsBounds3Ext::TriBSHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsHitInfoExt* hit) const
|
||||
{
|
||||
hsPoint3 myPt = GetCenter();
|
||||
myPt += myVel;
|
||||
|
||||
hsPoint3 closePt;
|
||||
hsBool onTri = tri.ClosestTriPoint(&myPt, &closePt);
|
||||
bool onTri = tri.ClosestTriPoint(&myPt, &closePt);
|
||||
|
||||
hsVector3 repel;
|
||||
repel.Set(&myPt, &closePt);
|
||||
@ -1761,7 +1761,7 @@ hsBool hsBounds3Ext::TriBSHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsH
|
||||
}
|
||||
|
||||
#if 0 // TOCENTER
|
||||
hsBool hsBounds3Ext::TriBBHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsHitInfoExt* hit) const
|
||||
bool hsBounds3Ext::TriBBHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsHitInfoExt* hit) const
|
||||
{
|
||||
// Find our closest point (after movement)
|
||||
hsPoint3 myPt = fCorner;
|
||||
@ -1789,7 +1789,7 @@ hsBool hsBounds3Ext::TriBBHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsH
|
||||
|
||||
// Find closest point on tri to our closest corner
|
||||
hsPoint3 closePt;
|
||||
hsBool onTri = tri.ClosestTriPoint(&myPt, &closePt);
|
||||
bool onTri = tri.ClosestTriPoint(&myPt, &closePt);
|
||||
|
||||
// Repel vector is from closest corner to closest point on tri
|
||||
hsVector3 repel;
|
||||
@ -1816,13 +1816,13 @@ hsBool hsBounds3Ext::TriBBHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsH
|
||||
}
|
||||
#else // TOCENTER
|
||||
|
||||
hsBool hsBounds3Ext::TriBBHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsHitInfoExt* hit) const
|
||||
bool hsBounds3Ext::TriBBHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsHitInfoExt* hit) const
|
||||
{
|
||||
hsPoint3 myPt = GetCenter();
|
||||
myPt += myVel;
|
||||
|
||||
hsPoint3 closePt;
|
||||
hsBool onTri = tri.ClosestTriPoint(&myPt, &closePt);
|
||||
bool onTri = tri.ClosestTriPoint(&myPt, &closePt);
|
||||
|
||||
hsVector3 repel;
|
||||
repel.Set(&myPt, &closePt);
|
||||
@ -1855,7 +1855,7 @@ hsBool hsBounds3Ext::TriBBHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsH
|
||||
|
||||
#endif // TOCENTER
|
||||
|
||||
hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel) const
|
||||
bool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel) const
|
||||
{
|
||||
hsPoint2 faceDepth;
|
||||
// first test box against the triangle plane
|
||||
@ -1904,7 +1904,7 @@ hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel) const
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel, hsHitInfoExt *hit) const
|
||||
bool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel, hsHitInfoExt *hit) const
|
||||
{
|
||||
hsPoint2 faceDepth;
|
||||
// first test box against the triangle plane
|
||||
@ -1972,7 +1972,7 @@ hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit
|
||||
return hit->fDepth > hsBounds::kRealSmall;
|
||||
}
|
||||
|
||||
hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel) const
|
||||
bool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel) const
|
||||
{
|
||||
if( !(fExtFlags & kSphereSet) )
|
||||
IMakeSphere();
|
||||
@ -2047,7 +2047,7 @@ hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel) const
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel, hsHitInfoExt *hit) const
|
||||
bool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel, hsHitInfoExt *hit) const
|
||||
{
|
||||
if( !(fExtFlags & kSphereSet) )
|
||||
IMakeSphere();
|
||||
@ -2142,7 +2142,7 @@ hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit
|
||||
|
||||
#endif // Commenting out this which will be made redundant and/or obsolete by Havok integration
|
||||
|
||||
hsBool hsBounds3Ext::ISectBSBS(const hsBounds3Ext& other, const hsVector3& myVel, hsHitInfoExt *hit) const
|
||||
bool hsBounds3Ext::ISectBSBS(const hsBounds3Ext& other, const hsVector3& myVel, hsHitInfoExt *hit) const
|
||||
{
|
||||
if(!(fExtFlags & kSphereSet) )
|
||||
IMakeSphere();
|
||||
@ -2177,7 +2177,7 @@ hsBool hsBounds3Ext::ISectBSBS(const hsBounds3Ext& other, const hsVector3& myVel
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsBounds3Ext::ISectBSBox(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const
|
||||
bool hsBounds3Ext::ISectBSBox(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const
|
||||
{
|
||||
hit->fDelPos = -myVel;
|
||||
if( other.ISectBoxBS(*this, hit->fDelPos, hit) )
|
||||
@ -2194,7 +2194,7 @@ hsBool hsBounds3Ext::ISectBSBox(const hsBounds3Ext &other, const hsVector3 &myVe
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const
|
||||
bool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const
|
||||
{
|
||||
if(!(fExtFlags & kSphereSet) )
|
||||
IMakeSphere();
|
||||
@ -2202,13 +2202,13 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe
|
||||
|
||||
hsVector3 minAxis;
|
||||
float minDepth;
|
||||
hsBool haveAxis = false;
|
||||
bool haveAxis = false;
|
||||
hsVector3 tstAxis;
|
||||
float tstDepth;
|
||||
int i;
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
hsBool tryAxis;
|
||||
bool tryAxis;
|
||||
if( other.fExtFlags & kAxisAligned )
|
||||
{
|
||||
// first try the other box axes
|
||||
@ -2346,7 +2346,7 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel) const
|
||||
bool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel) const
|
||||
{
|
||||
if( !(fExtFlags & kSphereSet) )
|
||||
IMakeSphere();
|
||||
@ -2423,7 +2423,7 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsBounds3Ext::ISectLine(const hsPoint3* from, const hsPoint3* at) const
|
||||
bool hsBounds3Ext::ISectLine(const hsPoint3* from, const hsPoint3* at) const
|
||||
{
|
||||
if( !(fExtFlags & kSphereSet) )
|
||||
IMakeSphere();
|
||||
@ -2475,7 +2475,7 @@ hsBool hsBounds3Ext::ISectLine(const hsPoint3* from, const hsPoint3* at) const
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsBounds3Ext::ISectCone(const hsPoint3* from, const hsPoint3* at, float radius) const
|
||||
bool hsBounds3Ext::ISectCone(const hsPoint3* from, const hsPoint3* at, float radius) const
|
||||
{
|
||||
if( !(fExtFlags & kSphereSet) )
|
||||
IMakeSphere();
|
||||
@ -2553,7 +2553,7 @@ hsBool hsBounds3Ext::ISectCone(const hsPoint3* from, const hsPoint3* at, float r
|
||||
}
|
||||
|
||||
|
||||
hsBool hsBounds3Ext::ISectRayBS(const hsPoint3& from, const hsPoint3& to, hsPoint3& at) const
|
||||
bool hsBounds3Ext::ISectRayBS(const hsPoint3& from, const hsPoint3& to, hsPoint3& at) const
|
||||
{
|
||||
hsVector3 c2f(&from,&GetCenter());
|
||||
hsVector3 f2t(&to,&from);
|
||||
@ -2660,7 +2660,7 @@ void hsBounds3Tri::TestPlane(const hsVector3 &n, hsPoint2 &depth) const
|
||||
depth.fX = d1;
|
||||
}
|
||||
}
|
||||
hsBool hsBounds3Tri::ClosestTriPoint(const hsPoint3 *p, hsPoint3 *out, const hsVector3 *ax) const
|
||||
bool hsBounds3Tri::ClosestTriPoint(const hsPoint3 *p, hsPoint3 *out, const hsVector3 *ax) const
|
||||
{
|
||||
// project point onto tri plane
|
||||
hsPoint3 pPln;
|
||||
@ -2702,7 +2702,7 @@ hsBool hsBounds3Tri::ClosestTriPoint(const hsPoint3 *p, hsPoint3 *out, const hsV
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
float tst = fPerpAxes[i].InnerProduct(pPln);
|
||||
hsBool in = false;
|
||||
bool in = false;
|
||||
if( fOnIsMax & (1 << i) )
|
||||
{
|
||||
if( tst <= fPerpDists[i].fY )
|
||||
@ -2781,7 +2781,7 @@ hsBool hsBounds3Tri::ClosestTriPoint(const hsPoint3 *p, hsPoint3 *out, const hsV
|
||||
hsAssert( vDis - dis > -hsBounds::kRealSmall, "Bad closest point");
|
||||
vDis = hsVector3(&pPln, fVerts+2).MagnitudeSquared();
|
||||
hsAssert( vDis - dis > -hsBounds::kRealSmall, "Bad closest point");
|
||||
hsBool dork = false;
|
||||
bool dork = false;
|
||||
if( dork )
|
||||
{
|
||||
float zn[3];
|
||||
@ -2977,7 +2977,7 @@ hsBounds3Tri::~hsBounds3Tri()
|
||||
|
||||
|
||||
// Finds closest intersection vertex or triangle/center-line intersection
|
||||
hsBool hsBounds3Tri::ISectCone(const hsPoint3& from, const hsPoint3& to, float cosThetaSq, hsBool ignoreFacing, hsPoint3& at, hsBool& backSide) const
|
||||
bool hsBounds3Tri::ISectCone(const hsPoint3& from, const hsPoint3& to, float cosThetaSq, bool ignoreFacing, hsPoint3& at, bool& backSide) const
|
||||
{
|
||||
float d0 = from.InnerProduct(fNormal);
|
||||
float d1 = at.InnerProduct(fNormal);
|
||||
@ -2996,7 +2996,7 @@ hsBool hsBounds3Tri::ISectCone(const hsPoint3& from, const hsPoint3& to, float c
|
||||
|
||||
float minDistSq = 0;
|
||||
int32_t minVert = 0;
|
||||
hsBool sect = false;
|
||||
bool sect = false;
|
||||
for (int32_t i=0; i<3; i++)
|
||||
{
|
||||
hsPoint3 onLine;
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
//
|
||||
virtual void Reset(const hsBounds3*) = 0;
|
||||
|
||||
virtual hsBool IsInside(const hsPoint3* pos) const =0; // Only valid for kBounds Normal
|
||||
virtual bool IsInside(const hsPoint3* pos) const =0; // Only valid for kBounds Normal
|
||||
|
||||
virtual void Read(hsStream*);
|
||||
virtual void Write(hsStream*);
|
||||
@ -132,10 +132,10 @@ public:
|
||||
const hsPoint3& GetMaxs() const;
|
||||
float GetMaxDim() const; // Computes the answer
|
||||
const hsPoint3& GetCenter() const; // Computes the answer if not already there
|
||||
virtual hsBool IsInside(const hsPoint3* pos) const; // ok for full/empty
|
||||
virtual bool 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;
|
||||
virtual hsBool ClosestPoint(const hsPoint3& p, hsPoint3& inner, hsPoint3& outer) const;
|
||||
virtual bool ClosestPoint(const hsPoint3& p, hsPoint3& inner, hsPoint3& outer) const;
|
||||
|
||||
// Test according to my axes only, doesn't check other's axes
|
||||
// neg, pos, zero == disjoint, I contain other, overlap
|
||||
@ -195,10 +195,10 @@ inline float hsBounds3::GetMaxDim() const
|
||||
class hsBoundsOriented : public hsBounds
|
||||
{
|
||||
private:
|
||||
hsBool fCenterValid;
|
||||
bool fCenterValid;
|
||||
hsPoint3 fCenter;
|
||||
hsPlane3 *fPlanes;
|
||||
uint32_t fNumPlanes;
|
||||
uint32_t fNumPlanes;
|
||||
public:
|
||||
hsBoundsOriented() : fPlanes(nil),fNumPlanes(0),fCenterValid(false) {}
|
||||
virtual ~hsBoundsOriented() { if (fPlanes) delete [] fPlanes; }
|
||||
@ -223,7 +223,7 @@ public:
|
||||
//
|
||||
// Only valid for kBounds Normal
|
||||
//
|
||||
virtual hsBool IsInside(const hsPoint3* pos) const;
|
||||
virtual bool IsInside(const hsPoint3* pos) const;
|
||||
virtual void TestPlane(const hsVector3 &n, hsPoint2 &depth) const; // Complain and refuse
|
||||
|
||||
virtual void Write(hsStream *stream);
|
||||
@ -247,7 +247,7 @@ protected:
|
||||
mutable hsPoint2 fDists[3];
|
||||
mutable float fRadius;
|
||||
|
||||
hsBool IAxisIsZero(uint32_t i) const { return (fExtFlags & (1 << (20+i))) != 0; };
|
||||
bool IAxisIsZero(uint32_t i) const { return (fExtFlags & (1 << (20+i))) != 0; };
|
||||
void IMakeSphere() const;
|
||||
void IMakeDists() const;
|
||||
void IMakeMinsMaxs();
|
||||
@ -280,9 +280,9 @@ public:
|
||||
virtual void GetAxes(hsVector3 *fAxis0, hsVector3 *fAxis1, hsVector3 *fAxis2) const;
|
||||
virtual hsPoint3 *GetCorner(hsPoint3 *c) const { *c = (fExtFlags & kAxisAligned ? fMins : fCorner); return c; }
|
||||
virtual void GetCorners(hsPoint3 *b) const;
|
||||
virtual hsBool ClosestPoint(const hsPoint3& p, hsPoint3& inner, hsPoint3& outer) const;
|
||||
virtual bool ClosestPoint(const hsPoint3& p, hsPoint3& inner, hsPoint3& outer) const;
|
||||
|
||||
virtual hsBool IsInside(const hsPoint3* pos) const; // ok for full/empty
|
||||
virtual bool IsInside(const hsPoint3* pos) const; // ok for full/empty
|
||||
|
||||
virtual void TestPlane(const hsVector3 &n, hsPoint2 &depth) const;
|
||||
virtual int32_t TestPoints(int n, const hsPoint3 *pList) const; // pos,neg,zero == allout, allin, cut
|
||||
@ -294,21 +294,21 @@ public:
|
||||
virtual void TestPlane(const hsVector3 &n, const hsVector3 &myVel, hsPoint2 &depth) const;
|
||||
virtual void TestPlane(const hsPlane3 *p, const hsVector3 &myVel, hsPoint2 &depth) const;
|
||||
virtual int32_t TestPoints(int n, const hsPoint3 *pList, const hsVector3 &ptVel) const; // pos,neg,zero == allout, allin, cut
|
||||
virtual hsBool ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel) 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 ISectBS(const hsBounds3Ext &other, const hsVector3 &myVel) const;
|
||||
virtual bool ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel) const;
|
||||
virtual bool ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const;
|
||||
virtual bool ISectABB(const hsBounds3Ext &other, const hsVector3 &myVel) const;
|
||||
virtual bool ISectBS(const hsBounds3Ext &other, const hsVector3 &myVel) const;
|
||||
|
||||
virtual int32_t IClosestISect(const hsBounds3Ext& other, const hsVector3& myVel,
|
||||
float* tClose, float* tImpact) 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 ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel) const;
|
||||
virtual hsBool ISectBSBS(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const;
|
||||
virtual bool ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const;
|
||||
virtual bool ISectBSBox(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const;
|
||||
virtual bool ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel) const;
|
||||
virtual bool ISectBSBS(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const;
|
||||
|
||||
virtual hsBool ISectLine(const hsPoint3* from, const hsPoint3* to) const;
|
||||
virtual hsBool ISectCone(const hsPoint3* from, const hsPoint3* to, float radius) const;
|
||||
virtual hsBool ISectRayBS(const hsPoint3& from, const hsPoint3& to, hsPoint3& at) const;
|
||||
virtual bool ISectLine(const hsPoint3* from, const hsPoint3* to) const;
|
||||
virtual bool ISectCone(const hsPoint3* from, const hsPoint3* to, float radius) const;
|
||||
virtual bool ISectRayBS(const hsPoint3& from, const hsPoint3& to, hsPoint3& at) const;
|
||||
|
||||
virtual void Read(hsStream *s);
|
||||
virtual void Write(hsStream *s);
|
||||
|
@ -52,8 +52,8 @@ struct hsColorRGBA {
|
||||
|
||||
hsColorRGBA& Set(float red, float grn, float blu, float alp) { r = red; g = grn; b = blu; a = alp; return *this; }
|
||||
|
||||
hsBool operator==(const hsColorRGBA&c) const { return (r==c.r)&&(g==c.g)&&(b==c.b)&&(a==c.a); }
|
||||
hsBool operator!=(const hsColorRGBA&c) const { return !(c == *this); }
|
||||
bool operator==(const hsColorRGBA&c) const { return (r==c.r)&&(g==c.g)&&(b==c.b)&&(a==c.a); }
|
||||
bool operator!=(const hsColorRGBA&c) const { return !(c == *this); }
|
||||
|
||||
friend inline hsColorRGBA operator+(const hsColorRGBA& s, const hsColorRGBA& t);
|
||||
hsColorRGBA& operator+=(const hsColorRGBA& s);
|
||||
@ -179,7 +179,7 @@ public:
|
||||
};
|
||||
hsColorRGBA fShade;
|
||||
hsColorRGBA fColor;
|
||||
hsBool fFlags;
|
||||
unsigned int fFlags;
|
||||
};
|
||||
|
||||
|
||||
|
@ -111,7 +111,7 @@ inline void hsThrowIfNilParam(const void* p)
|
||||
}
|
||||
}
|
||||
|
||||
inline void hsThrowIfBadParam(hsBool trueIfBadParam)
|
||||
inline void hsThrowIfBadParam(bool trueIfBadParam)
|
||||
{
|
||||
if (trueIfBadParam)
|
||||
{
|
||||
@ -129,7 +129,7 @@ inline void hsThrowIfOSErr(long osErr)
|
||||
}
|
||||
}
|
||||
|
||||
inline void hsThrowIfTrue(hsBool condition)
|
||||
inline void hsThrowIfTrue(bool condition)
|
||||
{
|
||||
if (condition)
|
||||
{
|
||||
@ -138,7 +138,7 @@ inline void hsThrowIfTrue(hsBool condition)
|
||||
}
|
||||
}
|
||||
|
||||
inline void hsThrowIfFalse(hsBool condition)
|
||||
inline void hsThrowIfFalse(bool condition)
|
||||
{
|
||||
if (condition == false)
|
||||
{
|
||||
@ -147,7 +147,7 @@ inline void hsThrowIfFalse(hsBool condition)
|
||||
}
|
||||
}
|
||||
|
||||
inline void hsThrowIfTrue(hsBool condition, const char message[])
|
||||
inline void hsThrowIfTrue(bool condition, const char message[])
|
||||
{
|
||||
if (condition)
|
||||
{
|
||||
@ -156,7 +156,7 @@ inline void hsThrowIfTrue(hsBool condition, const char message[])
|
||||
}
|
||||
}
|
||||
|
||||
inline void hsThrowIfFalse(hsBool condition, const char message[])
|
||||
inline void hsThrowIfFalse(bool condition, const char message[])
|
||||
{
|
||||
if (condition == false)
|
||||
{
|
||||
@ -176,7 +176,7 @@ inline void hsThrowIfNilParam(const void* p)
|
||||
hsAssert(p!=nil,"hsThrowIfNilParam");
|
||||
}
|
||||
|
||||
inline void hsThrowIfBadParam(hsBool trueIfBadParam)
|
||||
inline void hsThrowIfBadParam(bool trueIfBadParam)
|
||||
{
|
||||
hsAssert(!trueIfBadParam,"hsThrowIfBadParam");
|
||||
}
|
||||
@ -186,22 +186,22 @@ inline void hsThrowIfOSErr(long osErr)
|
||||
hsAssert(osErr==0,"hsThrowIfOSErr");
|
||||
}
|
||||
|
||||
inline void hsThrowIfTrue(hsBool condition)
|
||||
inline void hsThrowIfTrue(bool condition)
|
||||
{
|
||||
hsAssert(!condition,"hsThrowIfTrue");
|
||||
}
|
||||
|
||||
inline void hsThrowIfFalse(hsBool condition)
|
||||
inline void hsThrowIfFalse(bool condition)
|
||||
{
|
||||
hsAssert(condition,"hsThrowIfFalse");
|
||||
}
|
||||
|
||||
inline void hsThrowIfTrue(hsBool condition, const char message[])
|
||||
inline void hsThrowIfTrue(bool condition, const char message[])
|
||||
{
|
||||
hsAssert(!condition,message);
|
||||
}
|
||||
|
||||
inline void hsThrowIfFalse(hsBool condition, const char message[])
|
||||
inline void hsThrowIfFalse(bool condition, const char message[])
|
||||
{
|
||||
hsAssert(condition,message);
|
||||
}
|
||||
|
@ -604,10 +604,10 @@ float hsFastMath::IATan2OverTwoPi(float y, float x)
|
||||
if( (x == 0)&&(y == 0) )
|
||||
return 0;
|
||||
|
||||
hsBool xNeg, yNeg;
|
||||
bool xNeg, yNeg;
|
||||
if((yNeg = (y < 0)))y = -y;
|
||||
if((xNeg = (x < 0)))x = -x;
|
||||
hsBool yBigger = y >= x;
|
||||
bool yBigger = y >= x;
|
||||
float div = yBigger ? x / y : y / x;
|
||||
|
||||
float fInd = div * tabMax;
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
float Magnitude() const;
|
||||
float MagnitudeSquared() const { return (fX * fX + fY * fY + fZ * fZ); }
|
||||
|
||||
hsBool IsEmpty() const { return fX == 0 && fY == 0 && fZ == 0; }
|
||||
bool IsEmpty() const { return fX == 0 && fY == 0 && fZ == 0; }
|
||||
|
||||
float operator[](int i) const;
|
||||
float& operator[](int i);
|
||||
@ -166,11 +166,11 @@ struct hsPoint3 : public hsScalarTriple {
|
||||
friend inline hsPoint3 operator*(const float& s, const hsPoint3& t);
|
||||
friend inline hsPoint3 operator*(const hsPoint3& t, const float& s);
|
||||
friend inline hsPoint3 operator/(const hsPoint3& t, const float& s);
|
||||
hsBool operator==(const hsPoint3& ss) const
|
||||
bool operator==(const hsPoint3& ss) const
|
||||
{
|
||||
return (ss.fX == fX && ss.fY == fY && ss.fZ == fZ);
|
||||
}
|
||||
hsBool operator!=(const hsPoint3& ss) const { return !(*this == ss); }
|
||||
bool 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 float s) { fX *= s; fY *= s; fZ *= s; return *this; }
|
||||
};
|
||||
@ -226,17 +226,11 @@ struct hsVector3 : public hsScalarTriple {
|
||||
friend inline hsVector3 operator/(const hsVector3& t, const float& s);
|
||||
friend inline float operator*(const hsVector3& t, const hsVector3& s);
|
||||
friend hsVector3 operator%(const hsVector3& t, const hsVector3& s);
|
||||
#if 0 // Havok reeks
|
||||
friend hsBool32 operator==(const hsVector3& s, const hsVector3& t)
|
||||
{
|
||||
return (s.fX == t.fX && s.fY == t.fY && s.fZ == t.fZ);
|
||||
}
|
||||
#else // Havok reeks
|
||||
hsBool operator==(const hsVector3& ss) const
|
||||
bool operator==(const hsVector3& ss) const
|
||||
{
|
||||
return (ss.fX == fX && ss.fY == fY && ss.fZ == fZ);
|
||||
}
|
||||
#endif // Havok reeks
|
||||
|
||||
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 float s) { fX *= s; fY *= s; fZ *= s; return *this; }
|
||||
|
@ -62,8 +62,8 @@ public:
|
||||
hsHashTableIterator<T>& operator--() { fIndex++; return *this; }
|
||||
const hsHashTableIterator<T>& operator--(int) { hsHashTableIterator<T> temp(*this); ++(*this); return temp; }
|
||||
|
||||
hsBool operator==(const hsHashTableIterator<T>& other) const { return fList==other.fList && fIndex==other.fIndex; }
|
||||
hsBool operator!=(const hsHashTableIterator<T>& other) const { return !(*this == other); }
|
||||
bool operator==(const hsHashTableIterator<T>& other) const { return fList==other.fList && fIndex==other.fIndex; }
|
||||
bool operator!=(const hsHashTableIterator<T>& other) const { return !(*this == other); }
|
||||
|
||||
private:
|
||||
hsTArray<T>* fList;
|
||||
|
@ -212,7 +212,7 @@ hsVector3 hsMatrix44::operator*(const hsVector3& p) const
|
||||
return rVal;
|
||||
}
|
||||
|
||||
int hsMatrix44::operator==(const hsMatrix44& ss) const
|
||||
bool hsMatrix44::operator==(const hsMatrix44& ss) const
|
||||
{
|
||||
if( ss.fFlags & fFlags & hsMatrix44::kIsIdent )
|
||||
{
|
||||
@ -807,9 +807,9 @@ hsPoint3* hsMatrix44::MapPoints(long count, hsPoint3 points[]) const
|
||||
return points;
|
||||
}
|
||||
|
||||
hsBool hsMatrix44::IsIdentity(void)
|
||||
bool hsMatrix44::IsIdentity(void)
|
||||
{
|
||||
hsBool retVal = true;
|
||||
bool retVal = true;
|
||||
int i, j;
|
||||
for( i = 0; i < 4; i++ )
|
||||
{
|
||||
@ -866,7 +866,7 @@ hsBool hsMatrix44::IsIdentity(void)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
hsBool hsMatrix44::GetParity() const
|
||||
bool hsMatrix44::GetParity() const
|
||||
{
|
||||
if( fFlags & kIsIdent )
|
||||
return false;
|
||||
@ -896,7 +896,7 @@ void hsMatrix44::Read(hsStream *stream)
|
||||
|
||||
void hsMatrix44::Write(hsStream *stream)
|
||||
{
|
||||
hsBool ident = IsIdentity();
|
||||
bool ident = IsIdentity();
|
||||
stream->WriteBool(!ident);
|
||||
if (!ident)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ struct hsMatrix44 {
|
||||
kView
|
||||
};
|
||||
float fMap[4][4];
|
||||
uint32_t fFlags;
|
||||
uint32_t fFlags;
|
||||
|
||||
hsMatrix44() : fFlags(0) {}
|
||||
hsMatrix44(const hsScalarTriple &translate, const hsQuat &rotate);
|
||||
@ -79,7 +79,7 @@ struct hsMatrix44 {
|
||||
hsMatrix44& Scale(const hsVector3 *);
|
||||
hsMatrix44& Rotate(int axis, float radians);
|
||||
|
||||
hsMatrix44& Reset(hsBool asIdent=true)
|
||||
hsMatrix44& Reset(bool asIdent=true)
|
||||
{
|
||||
fMap[0][0] = 1.0f; fMap[0][1] = 0.0f; fMap[0][2] = 0.0f; fMap[0][3] = 0.0f;
|
||||
fMap[1][0] = 0.0f; fMap[1][1] = 1.0f; fMap[1][2] = 0.0f; fMap[1][3] = 0.0f;
|
||||
@ -104,7 +104,7 @@ struct hsMatrix44 {
|
||||
hsMatrix44& MakeCameraUpPreserving(const hsPoint3* from, const hsPoint3* at,
|
||||
const hsVector3* up);
|
||||
|
||||
hsBool GetParity() const;
|
||||
bool GetParity() const;
|
||||
float GetDeterminant() const;
|
||||
hsMatrix44* GetInverse(hsMatrix44* inverse) const;
|
||||
hsMatrix44* GetTranspose(hsMatrix44* inverse) const;
|
||||
@ -145,11 +145,11 @@ struct hsMatrix44 {
|
||||
|
||||
hsPoint3* MapPoints(long count, hsPoint3 points[]) const;
|
||||
|
||||
hsBool IsIdentity(void);
|
||||
void NotIdentity() { fFlags &= ~kIsIdent; }
|
||||
bool IsIdentity(void);
|
||||
void NotIdentity() { fFlags &= ~kIsIdent; }
|
||||
|
||||
hsBool operator==(const hsMatrix44& ss) const;
|
||||
hsBool operator!=(const hsMatrix44& ss) const { return !(ss == *this); }
|
||||
bool operator==(const hsMatrix44& ss) const;
|
||||
bool operator!=(const hsMatrix44& ss) const { return !(ss == *this); }
|
||||
|
||||
void Read(hsStream *stream);
|
||||
void Write(hsStream *stream);
|
||||
|
@ -54,7 +54,7 @@ void HSMemory::BlockMove(const void* src, void* dst, uint32_t length)
|
||||
memmove(dst, src, length);
|
||||
}
|
||||
|
||||
hsBool HSMemory::EqualBlocks(const void* block1, const void* block2, uint32_t length)
|
||||
bool HSMemory::EqualBlocks(const void* block1, const void* block2, uint32_t length)
|
||||
{
|
||||
const uint8_t* byte1 = (uint8_t*)block1;
|
||||
const uint8_t* byte2 = (uint8_t*)block2;
|
||||
@ -247,13 +247,13 @@ struct hsAppenderHead {
|
||||
void* GetBottom() const { return fBottom; }
|
||||
void* GetStop() const { return fStop; }
|
||||
|
||||
void* GetFirst() const { return fFirst; }
|
||||
void* GetLast(uint32_t elemSize) const { return (char*)fStop - elemSize; }
|
||||
uint32_t GetSize() const { return (char*)fStop - (char*)fFirst; }
|
||||
void* GetFirst() const { return fFirst; }
|
||||
void* GetLast(uint32_t elemSize) const { return (char*)fStop - elemSize; }
|
||||
uint32_t GetSize() const { return (char*)fStop - (char*)fFirst; }
|
||||
|
||||
hsBool CanPrepend() const { return fFirst != this->GetTop(); }
|
||||
bool CanPrepend() const { return fFirst != this->GetTop(); }
|
||||
int PrependSize() const { return (char*)fFirst - (char*)this->GetTop(); }
|
||||
hsBool CanAppend() const { return fStop != this->GetBottom(); }
|
||||
bool CanAppend() const { return fStop != this->GetBottom(); }
|
||||
int AppendSize() const { return (char*)this->GetBottom() - (char*)fStop; }
|
||||
|
||||
void* Prepend(uint32_t elemSize)
|
||||
@ -271,7 +271,7 @@ struct hsAppenderHead {
|
||||
hsAssert((char*)fStop <= (char*)fBottom, "bad elemSize");
|
||||
return data;
|
||||
}
|
||||
hsBool PopHead(uint32_t elemSize, void* data)
|
||||
bool PopHead(uint32_t elemSize, void* data)
|
||||
{
|
||||
hsAssert(fFirst != fStop, "Empty");
|
||||
if( data )
|
||||
@ -279,7 +279,7 @@ struct hsAppenderHead {
|
||||
fFirst = (char*)fFirst + elemSize;
|
||||
return fFirst == fStop;
|
||||
}
|
||||
hsBool PopTail(uint32_t elemSize, void* data)
|
||||
bool PopTail(uint32_t elemSize, void* data)
|
||||
{
|
||||
hsAssert(fFirst != fStop, "Empty");
|
||||
fStop = (char*)fStop - elemSize;
|
||||
@ -388,7 +388,7 @@ void* hsAppender::PeekHead() const
|
||||
return nil;
|
||||
}
|
||||
|
||||
hsBool hsAppender::PopHead(void* data)
|
||||
bool hsAppender::PopHead(void* data)
|
||||
{
|
||||
if (fCount == 0)
|
||||
return false;
|
||||
@ -500,7 +500,7 @@ void* hsAppender::PeekTail() const
|
||||
return nil;
|
||||
}
|
||||
|
||||
hsBool hsAppender::PopTail(void* data)
|
||||
bool hsAppender::PopTail(void* data)
|
||||
{
|
||||
if (fCount == 0)
|
||||
return false;
|
||||
@ -570,7 +570,7 @@ void* hsAppenderIterator::Next()
|
||||
return item;
|
||||
}
|
||||
|
||||
hsBool hsAppenderIterator::Next(void* data)
|
||||
bool hsAppenderIterator::Next(void* data)
|
||||
{
|
||||
void* addr = this->Next();
|
||||
if (addr)
|
||||
@ -613,7 +613,7 @@ void* hsAppenderIterator::Prev()
|
||||
return item;
|
||||
}
|
||||
|
||||
hsBool hsAppenderIterator::Prev(void* data)
|
||||
bool hsAppenderIterator::Prev(void* data)
|
||||
{
|
||||
void* addr = this->Prev();
|
||||
if (addr)
|
||||
|
@ -51,13 +51,13 @@ public:
|
||||
static void Clear(void *m, uint32_t byteLen);
|
||||
static void ClearMemory(void *m, uint32_t byteLen) { HSMemory::Clear(m, byteLen); }
|
||||
|
||||
static hsBool EqualBlocks(const void* block1, const void* block2, uint32_t length);
|
||||
static bool EqualBlocks(const void* block1, const void* block2, uint32_t length);
|
||||
|
||||
static void* New(uint32_t size);
|
||||
static void Delete(void* block);
|
||||
static void* Copy(uint32_t length, const void* source);
|
||||
static void* New(uint32_t size);
|
||||
static void Delete(void* block);
|
||||
static void* Copy(uint32_t length, const void* source);
|
||||
|
||||
static void* SoftNew(uint32_t size); // returns nil if can't allocate
|
||||
static void* SoftNew(uint32_t size); // returns nil if can't allocate
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -127,21 +127,21 @@ public:
|
||||
|
||||
uint32_t ElemSize() const { return fElemSize; }
|
||||
uint32_t Count() const { return fCount; }
|
||||
hsBool IsEmpty() const { return fCount == 0; }
|
||||
void Reset();
|
||||
bool IsEmpty() const { return fCount == 0; }
|
||||
void Reset();
|
||||
|
||||
uint32_t CopyInto(void* data = nil) const; // return size of data array in bytes
|
||||
|
||||
void* PushHead();
|
||||
void PushHead(const void* data);
|
||||
void* PushTail();
|
||||
void PushTail(const void* data);
|
||||
void PushTail(int count, const void* data); // data[] = count * fElemSize
|
||||
void* PeekHead() const;
|
||||
void* PeekTail() const;
|
||||
hsBool PopHead(void* data = nil);
|
||||
int PopHead(int count, void* data = nil); // data[] = count * fElemSize
|
||||
hsBool PopTail(void* data = nil);
|
||||
void* PushHead();
|
||||
void PushHead(const void* data);
|
||||
void* PushTail();
|
||||
void PushTail(const void* data);
|
||||
void PushTail(int count, const void* data); // data[] = count * fElemSize
|
||||
void* PeekHead() const;
|
||||
void* PeekTail() const;
|
||||
bool PopHead(void* data = nil);
|
||||
int PopHead(int count, void* data = nil); // data[] = count * fElemSize
|
||||
bool PopTail(void* data = nil);
|
||||
|
||||
// Alternate interfaces
|
||||
|
||||
@ -149,13 +149,13 @@ public:
|
||||
void* Append() { return this->PushTail(); }
|
||||
|
||||
void* Push() { return this->PushHead(); }
|
||||
void Push(const void* data) { this->PushHead(data); }
|
||||
hsBool Pop(void* data = nil) { return this->PopHead(data); }
|
||||
void Push(const void* data) { this->PushHead(data); }
|
||||
bool Pop(void* data = nil) { return this->PopHead(data); }
|
||||
|
||||
void* Enqueue() { return this->PushTail(); };
|
||||
void Enqueue(const void* data) { this->PushTail(data); }
|
||||
void Enqueue(int count, const void* data) { this->PushTail(count, data); }
|
||||
hsBool Dequeue(void* data = nil) { return this->PopHead(data); }
|
||||
void Enqueue(const void* data) { this->PushTail(data); }
|
||||
void Enqueue(int count, const void* data) { this->PushTail(count, data); }
|
||||
bool Dequeue(void* data = nil) { return this->PopHead(data); }
|
||||
int Dequeue(int count, void* data = nil) { return this->PopHead(count, data); }
|
||||
};
|
||||
|
||||
@ -169,10 +169,10 @@ public:
|
||||
void ResetToHead(const hsAppender* list = nil);
|
||||
void ResetToTail(const hsAppender* list = nil);
|
||||
void* Next();
|
||||
hsBool Next(void* data);
|
||||
bool Next(void* data);
|
||||
int Next(int count, void* data);
|
||||
void* Prev();
|
||||
hsBool Prev(void* data);
|
||||
bool Prev(void* data);
|
||||
|
||||
// Obsolete interface
|
||||
|
||||
@ -190,37 +190,37 @@ public:
|
||||
const hsAppender* GetAppender() const { return this; }
|
||||
|
||||
uint32_t Count() const { return hsAppender::Count(); }
|
||||
hsBool IsEmpty() const { return hsAppender::IsEmpty(); }
|
||||
void Reset() { hsAppender::Reset(); }
|
||||
bool IsEmpty() const { return hsAppender::IsEmpty(); }
|
||||
void Reset() { hsAppender::Reset(); }
|
||||
|
||||
uint32_t CopyInto(T copy[]) const { return hsAppender::CopyInto(copy); }
|
||||
|
||||
T* PushHead() { return (T*)hsAppender::PushHead(); }
|
||||
void PushHead(const T& item) { *this->PushHead() = item; }
|
||||
void PushHead(const T& item) { *this->PushHead() = item; }
|
||||
T* PushTail() { return (T*)hsAppender::PushTail(); }
|
||||
void PushTail(const T& item) { *this->PushTail() = item; };
|
||||
void PushTail(int count, const T item[]) { this->hsAppender::PushTail(count, item); };
|
||||
void PushTail(const T& item) { *this->PushTail() = item; };
|
||||
void PushTail(int count, const T item[]) { this->hsAppender::PushTail(count, item); };
|
||||
T* PeekHead() const { return (T*)hsAppender::PeekHead(); }
|
||||
T* PeekTail() const { return (T*)hsAppender::PeekTail(); }
|
||||
hsBool PopHead(T* item = nil) { return hsAppender::PopHead(item); }
|
||||
bool PopHead(T* item = nil) { return hsAppender::PopHead(item); }
|
||||
int PopHead(int count, T item[] = nil) { return hsAppender::PopHead(count, item); }
|
||||
hsBool PopTail(T* item = nil) { return hsAppender::PopTail(item); }
|
||||
bool PopTail(T* item = nil) { return hsAppender::PopTail(item); }
|
||||
|
||||
// Alternate intefaces
|
||||
|
||||
T* Prepend() { return this->PushHead(); }
|
||||
T* Append() { return this->PushTail(); }
|
||||
void PrependItem(const T& item) { this->PushHead(item); }
|
||||
void AppendItem(const T& item) { this->PushTail(item); }
|
||||
void PrependItem(const T& item) { this->PushHead(item); }
|
||||
void AppendItem(const T& item) { this->PushTail(item); }
|
||||
|
||||
T* Push() { return this->PushHead(); }
|
||||
void Push(const T& item) { this->PushHead(item); }
|
||||
hsBool Pop(T* item = nil) { return this->PopHead(item); }
|
||||
void Push(const T& item) { this->PushHead(item); }
|
||||
bool Pop(T* item = nil) { return this->PopHead(item); }
|
||||
|
||||
T* Enqueue() { return this->PushTail(); };
|
||||
void Enqueue(const T& item) { this->PushTail(item); }
|
||||
void Enqueue(int count, const T item[]) { this->PushTail(count, item); }
|
||||
hsBool Dequeue(T* item = nil) { return this->PopHead(item); }
|
||||
void Enqueue(const T& item) { this->PushTail(item); }
|
||||
void Enqueue(int count, const T item[]) { this->PushTail(count, item); }
|
||||
bool Dequeue(T* item = nil) { return this->PopHead(item); }
|
||||
int Dequeue(int count, T item[] = nil) { return this->PopHead(count, item); }
|
||||
};
|
||||
|
||||
@ -234,9 +234,9 @@ public:
|
||||
void ResetToTail() { hsAppenderIterator::ResetToTail(nil); }
|
||||
void ResetToTail(const hsTAppender<T>* list) { hsAppenderIterator::ResetToTail(list->GetAppender()); }
|
||||
T* Next() { return (T*)hsAppenderIterator::Next(); }
|
||||
hsBool Next(T* item) { return hsAppenderIterator::Next(item); }
|
||||
int Next(T* item) { return hsAppenderIterator::Next(item); }
|
||||
T* Prev() { return (T*)hsAppenderIterator::Prev(); }
|
||||
hsBool Prev(T* item) { return hsAppenderIterator::Prev(item); }
|
||||
bool Prev(T* item) { return hsAppenderIterator::Prev(item); }
|
||||
|
||||
// Obsolete interfaces
|
||||
|
||||
|
@ -112,7 +112,7 @@ struct hsPoint2 {
|
||||
}
|
||||
|
||||
hsPoint2* Grid(float period);
|
||||
hsBool CloseEnough(const hsPoint2* p, float tolerance) const;
|
||||
bool CloseEnough(const hsPoint2* p, float tolerance) const;
|
||||
|
||||
float MagnitudeSquared() const { return fX * fX + fY * fY; }
|
||||
float Magnitude() const { return Magnitude(fX, fY); }
|
||||
|
@ -54,7 +54,7 @@ hsVectorStream::~hsVectorStream()
|
||||
{
|
||||
}
|
||||
|
||||
hsBool hsVectorStream::AtEnd()
|
||||
bool hsVectorStream::AtEnd()
|
||||
{
|
||||
return (fBytesRead >= fEnd);
|
||||
}
|
||||
@ -174,7 +174,7 @@ hsNamedPipeStream::~hsNamedPipeStream()
|
||||
fOverlap.hEvent = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::WaitForClientConnect()
|
||||
bool hsNamedPipeStream::WaitForClientConnect()
|
||||
{
|
||||
// Look for a client connect (this should return zero since it's overlapped)
|
||||
BOOL ret = ConnectNamedPipe(fPipe, &fOverlap);
|
||||
@ -201,17 +201,17 @@ hsBool hsNamedPipeStream::WaitForClientConnect()
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::Open(const char *name, const char *mode)
|
||||
bool hsNamedPipeStream::Open(const char *name, const char *mode)
|
||||
{
|
||||
wchar_t* wName = hsStringToWString(name);
|
||||
wchar_t* wMode = hsStringToWString(mode);
|
||||
hsBool ret = Open(wName, wMode);
|
||||
bool ret = Open(wName, wMode);
|
||||
delete [] wName;
|
||||
delete [] wMode;
|
||||
return ret;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::Open(const wchar_t *name, const wchar_t *mode)
|
||||
bool hsNamedPipeStream::Open(const wchar_t *name, const wchar_t *mode)
|
||||
{
|
||||
if (wcschr(mode, L'w'))
|
||||
{
|
||||
@ -249,7 +249,7 @@ hsBool hsNamedPipeStream::Open(const wchar_t *name, const wchar_t *mode)
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::Close()
|
||||
bool hsNamedPipeStream::Close()
|
||||
{
|
||||
if (fPipe == INVALID_HANDLE_VALUE)
|
||||
return false;
|
||||
@ -270,7 +270,7 @@ hsBool hsNamedPipeStream::Close()
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::ICheckOverlappedResult(BOOL result, uint32_t &numTransferred)
|
||||
bool hsNamedPipeStream::ICheckOverlappedResult(BOOL result, uint32_t &numTransferred)
|
||||
{
|
||||
// Read/Write succeeded, return now
|
||||
if (result)
|
||||
@ -294,7 +294,7 @@ hsBool hsNamedPipeStream::ICheckOverlappedResult(BOOL result, uint32_t &numTrans
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::IRead(uint32_t byteCount, void *buffer, uint32_t &numRead)
|
||||
bool hsNamedPipeStream::IRead(uint32_t byteCount, void *buffer, uint32_t &numRead)
|
||||
{
|
||||
numRead = 0;
|
||||
|
||||
@ -312,7 +312,7 @@ hsBool hsNamedPipeStream::IRead(uint32_t byteCount, void *buffer, uint32_t &numR
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::IWrite(uint32_t byteCount, const void *buffer, uint32_t &numWritten)
|
||||
bool hsNamedPipeStream::IWrite(uint32_t byteCount, const void *buffer, uint32_t &numWritten)
|
||||
{
|
||||
numWritten = 0;
|
||||
|
||||
|
@ -57,17 +57,17 @@ public:
|
||||
hsVectorStream(uint32_t chunkSize);
|
||||
virtual ~hsVectorStream();
|
||||
|
||||
virtual hsBool Open(const char *, const char *) { hsAssert(0, "hsVectorStream::Open Not Implemented"); return false; }
|
||||
virtual hsBool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "hsVectorStream::Open Not Implemented"); return false; }
|
||||
virtual hsBool Close() { hsAssert(0, "hsVectorStream::Close Not Implemented"); return false; }
|
||||
virtual bool Open(const char *, const char *) { hsAssert(0, "hsVectorStream::Open Not Implemented"); return false; }
|
||||
virtual bool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "hsVectorStream::Open Not Implemented"); return false; }
|
||||
virtual bool Close() { hsAssert(0, "hsVectorStream::Close Not Implemented"); return false; }
|
||||
|
||||
virtual hsBool AtEnd();
|
||||
virtual bool AtEnd();
|
||||
virtual uint32_t Read(uint32_t byteCount, void * buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void FastFwd();
|
||||
virtual void Truncate();
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void FastFwd();
|
||||
virtual void Truncate();
|
||||
|
||||
virtual uint32_t GetEOF();
|
||||
virtual void CopyToMem(void* mem);
|
||||
@ -92,13 +92,13 @@ class hsNamedPipeStream : public hsStream
|
||||
protected:
|
||||
HANDLE fPipe;
|
||||
OVERLAPPED fOverlap;
|
||||
hsBool fReadMode; // True for read, false for write
|
||||
bool fReadMode; // True for read, false for write
|
||||
uint8_t fFlags;
|
||||
uint32_t fTimeout;
|
||||
|
||||
hsBool ICheckOverlappedResult(BOOL result, uint32_t &numTransferred);
|
||||
hsBool IRead(uint32_t byteCount, void *buffer, uint32_t &numRead);
|
||||
hsBool IWrite(uint32_t byteCount, const void *buffer, uint32_t &numWritten);
|
||||
bool ICheckOverlappedResult(BOOL result, uint32_t &numTransferred);
|
||||
bool IRead(uint32_t byteCount, void *buffer, uint32_t &numRead);
|
||||
bool IWrite(uint32_t byteCount, const void *buffer, uint32_t &numWritten);
|
||||
|
||||
public:
|
||||
enum { kThrowOnError = 1 }; // Throws if a read or write operation fails
|
||||
@ -110,20 +110,20 @@ public:
|
||||
// The format is "\\.\pipe\pipeName". The '.' can be replaced with a
|
||||
// computer name to do it over the network. 'pipeName' is whatever you
|
||||
// want.
|
||||
virtual hsBool Open(const char *name, const char *mode);
|
||||
virtual hsBool Open(const wchar_t *name, const wchar_t *mode);
|
||||
virtual hsBool Close();
|
||||
virtual bool Open(const char *name, const char *mode);
|
||||
virtual bool Open(const wchar_t *name, const wchar_t *mode);
|
||||
virtual bool Close();
|
||||
|
||||
virtual uint32_t Read(uint32_t byteCount, void *buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void *buffer);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
|
||||
// - For the server (writer) only -
|
||||
// After calling open, signal your client to start reading and call this function.
|
||||
// If a client connects, this will return true and you can start writing. If it
|
||||
// returns false, close the pipe, it ain't happening.
|
||||
hsBool WaitForClientConnect();
|
||||
bool WaitForClientConnect();
|
||||
};
|
||||
|
||||
#endif // HS_BUILD_FOR_WIN32
|
||||
|
@ -277,7 +277,7 @@ char *hsStream::ReadSafeString()
|
||||
|
||||
#ifndef REMOVE_ME_SOON
|
||||
// Backward compat hack - remove in a week or so (from 6/30/03)
|
||||
hsBool oldFormat = !(numChars & 0xf000);
|
||||
bool oldFormat = !(numChars & 0xf000);
|
||||
if (oldFormat)
|
||||
ReadLE16();
|
||||
#endif
|
||||
@ -354,7 +354,7 @@ plString hsStream::ReadSafeWString_TEMP()
|
||||
return result;
|
||||
}
|
||||
|
||||
hsBool hsStream::Read4Bytes(void *pv) // Virtual, faster version in sub classes
|
||||
bool hsStream::Read4Bytes(void *pv) // Virtual, faster version in sub classes
|
||||
{
|
||||
int knt = this->Read(sizeof(uint32_t), pv);
|
||||
if (knt != 4)
|
||||
@ -362,7 +362,7 @@ hsBool hsStream::Read4Bytes(void *pv) // Virtual, faster version in sub classe
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsStream::Read12Bytes(void *buffer) // Reads 12 bytes, return true if success
|
||||
bool hsStream::Read12Bytes(void *buffer) // Reads 12 bytes, return true if success
|
||||
{
|
||||
int knt = this->Read(12,buffer);
|
||||
if (knt != 12)
|
||||
@ -370,7 +370,7 @@ hsBool hsStream::Read12Bytes(void *buffer) // Reads 12 bytes, return true if su
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsStream::Read8Bytes(void *buffer) // Reads 12 bytes, return true if success
|
||||
bool hsStream::Read8Bytes(void *buffer) // Reads 12 bytes, return true if success
|
||||
{
|
||||
int knt = this->Read(8,buffer);
|
||||
if (knt !=8)
|
||||
@ -378,27 +378,21 @@ hsBool hsStream::Read8Bytes(void *buffer) // Reads 12 bytes, return true if su
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsStream::ReadBool() // Virtual, faster version in sub classes
|
||||
bool hsStream::ReadBOOL()
|
||||
{
|
||||
return this->ReadByte();
|
||||
uint32_t val;
|
||||
this->Read(sizeof(uint32_t), &val);
|
||||
return val != 0;
|
||||
}
|
||||
|
||||
bool hsStream::Readbool() // Virtual, faster version in sub classes
|
||||
bool hsStream::ReadBool() // Virtual, faster version in sub classes
|
||||
{
|
||||
return this->ReadByte() ? true : false;
|
||||
return (this->ReadByte() != 0);
|
||||
}
|
||||
|
||||
void hsStream::ReadBool(int count, hsBool values[])
|
||||
void hsStream::ReadBool(int count, bool values[])
|
||||
{
|
||||
this->Read(count, values);
|
||||
|
||||
if (sizeof(hsBool) > 1)
|
||||
{ const uint8_t* src = (uint8_t*)values;
|
||||
|
||||
// go backwards so we don't overwrite ourselves
|
||||
for (int i = count - 1; i >= 0; --i)
|
||||
values[i] = src[i];
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t hsStream::ReadByte()
|
||||
@ -409,18 +403,18 @@ uint8_t hsStream::ReadByte()
|
||||
return value;
|
||||
}
|
||||
|
||||
hsBool hsStream::AtEnd()
|
||||
bool hsStream::AtEnd()
|
||||
{
|
||||
hsAssert(0,"No hsStream::AtEnd() implemented for this stream class");
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool hsStream::IsTokenSeparator(char c)
|
||||
bool hsStream::IsTokenSeparator(char c)
|
||||
{
|
||||
return (isspace(c) || c==',' || c=='=');
|
||||
}
|
||||
|
||||
hsBool hsStream::GetToken(char *s, uint32_t maxLen, const char beginComment, const char endComment)
|
||||
bool hsStream::GetToken(char *s, uint32_t maxLen, const char beginComment, const char endComment)
|
||||
{
|
||||
char c;
|
||||
char endCom;
|
||||
@ -470,7 +464,7 @@ hsBool hsStream::GetToken(char *s, uint32_t maxLen, const char beginComment, con
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsStream::ReadLn(char *s, uint32_t maxLen, const char beginComment, const char endComment)
|
||||
bool hsStream::ReadLn(char *s, uint32_t maxLen, const char beginComment, const char endComment)
|
||||
{
|
||||
char c;
|
||||
char endCom;
|
||||
@ -598,32 +592,21 @@ float hsStream::ReadBEFloat()
|
||||
}
|
||||
|
||||
|
||||
void hsStream::WriteBool(hsBool value)
|
||||
void hsStream::WriteBOOL(bool value)
|
||||
{
|
||||
uint8_t dst = (value != 0);
|
||||
uint32_t dst = value != 0;
|
||||
this->Write(sizeof(uint32_t), &dst);
|
||||
}
|
||||
|
||||
void hsStream::WriteBool(bool value)
|
||||
{
|
||||
uint8_t dst = value != 0;
|
||||
this->Write(sizeof(uint8_t), &dst);
|
||||
}
|
||||
|
||||
void hsStream::Writebool(bool value)
|
||||
void hsStream::WriteBool(int count, const bool values[])
|
||||
{
|
||||
uint8_t dst = (value != 0);
|
||||
|
||||
this->Write(sizeof(uint8_t), &dst);
|
||||
}
|
||||
|
||||
void hsStream::WriteBool(int count, const hsBool values[])
|
||||
{
|
||||
if (sizeof(hsBool) > 1)
|
||||
{ hsTempArray<uint8_t> storage(count);
|
||||
uint8_t* dst = (uint8_t*)values;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
dst[i] = (values[i] != 0);
|
||||
this->Write(count, dst);
|
||||
}
|
||||
else
|
||||
this->Write(count, values);
|
||||
this->Write(count, values);
|
||||
}
|
||||
|
||||
void hsStream::WriteByte(uint8_t value)
|
||||
@ -711,19 +694,19 @@ uint32_t hsStream::ReadLEAtom(uint32_t* sizePtr)
|
||||
|
||||
#define kFileStream_Uninitialized ~0
|
||||
|
||||
hsBool hsFileStream::Open(const char *name, const char *mode)
|
||||
bool hsFileStream::Open(const char *name, const char *mode)
|
||||
{
|
||||
hsAssert(0, "hsFileStream::Open NotImplemented");
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool hsFileStream::Open(const wchar_t *name, const wchar_t *mode)
|
||||
bool hsFileStream::Open(const wchar_t *name, const wchar_t *mode)
|
||||
{
|
||||
hsAssert(0, "hsFileStream::Open NotImplemented");
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool hsFileStream::Close ()
|
||||
bool hsFileStream::Close ()
|
||||
{
|
||||
hsAssert(0, "hsFileStream::Close NotImplemented");
|
||||
return false;
|
||||
@ -793,7 +776,7 @@ uint32_t hsFileStream::Write(uint32_t bytes, const void* buffer)
|
||||
}
|
||||
|
||||
|
||||
hsBool hsFileStream::AtEnd()
|
||||
bool hsFileStream::AtEnd()
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
uint32_t bytes;
|
||||
@ -838,21 +821,21 @@ hsUNIXStream::~hsUNIXStream()
|
||||
// Don't Close here, because Sub classes Don't always want that behaviour!
|
||||
}
|
||||
|
||||
hsBool hsUNIXStream::Open(const char *name, const char *mode)
|
||||
bool hsUNIXStream::Open(const char *name, const char *mode)
|
||||
{
|
||||
fPosition = 0;
|
||||
fRef = hsFopen(name, mode);
|
||||
return (fRef) ? true : false;
|
||||
}
|
||||
|
||||
hsBool hsUNIXStream::Open(const wchar_t *name, const wchar_t *mode)
|
||||
bool hsUNIXStream::Open(const wchar_t *name, const wchar_t *mode)
|
||||
{
|
||||
fPosition = 0;
|
||||
fRef = hsWFopen(name, mode);
|
||||
return (fRef) ? true : false;
|
||||
}
|
||||
|
||||
hsBool hsUNIXStream::Close()
|
||||
bool hsUNIXStream::Close()
|
||||
{
|
||||
int rtn = true;
|
||||
if (fRef)
|
||||
@ -885,11 +868,11 @@ uint32_t hsUNIXStream::Read(uint32_t bytes, void* buffer)
|
||||
return numItems;
|
||||
}
|
||||
|
||||
hsBool hsUNIXStream::AtEnd()
|
||||
bool hsUNIXStream::AtEnd()
|
||||
{
|
||||
if (!fRef)
|
||||
return 1;
|
||||
hsBool rVal;
|
||||
bool rVal;
|
||||
int x = getc(fRef);
|
||||
rVal = feof(fRef) != 0;
|
||||
ungetc(x, fRef);
|
||||
@ -993,7 +976,7 @@ void plReadOnlySubStream::IFixPosition( void )
|
||||
fPosition = fBase->GetPosition() - fOffset;
|
||||
}
|
||||
|
||||
hsBool plReadOnlySubStream::AtEnd()
|
||||
bool plReadOnlySubStream::AtEnd()
|
||||
{
|
||||
if( fPosition >= fLength )
|
||||
return true;
|
||||
@ -1074,7 +1057,7 @@ void hsRAMStream::Reset()
|
||||
fIter.ResetToHead(&fAppender);
|
||||
}
|
||||
|
||||
hsBool hsRAMStream::AtEnd()
|
||||
bool hsRAMStream::AtEnd()
|
||||
{
|
||||
return (fBytesRead >= fAppender.Count() * fAppender.ElemSize());
|
||||
}
|
||||
@ -1163,7 +1146,7 @@ void hsNullStream::Truncate()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
hsBool hsReadOnlyStream::AtEnd()
|
||||
bool hsReadOnlyStream::AtEnd()
|
||||
{
|
||||
return fData >= fStop;
|
||||
}
|
||||
@ -1337,7 +1320,7 @@ void hsQueueStream::FastFwd()
|
||||
fReadCursor = fWriteCursor;
|
||||
}
|
||||
|
||||
hsBool hsQueueStream::AtEnd()
|
||||
bool hsQueueStream::AtEnd()
|
||||
{
|
||||
return fReadCursor == fWriteCursor;
|
||||
}
|
||||
@ -1393,7 +1376,7 @@ hsBufferedStream::~hsBufferedStream()
|
||||
#endif // LOG_BUFFERED
|
||||
}
|
||||
|
||||
hsBool hsBufferedStream::Open(const char* name, const char* mode)
|
||||
bool hsBufferedStream::Open(const char* name, const char* mode)
|
||||
{
|
||||
hsAssert(!fRef, "hsBufferedStream:Open Stream already opened");
|
||||
fRef = hsFopen(name, mode);
|
||||
@ -1413,13 +1396,13 @@ hsBool hsBufferedStream::Open(const char* name, const char* mode)
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsBufferedStream::Open(const wchar_t *name, const wchar_t *mode)
|
||||
bool hsBufferedStream::Open(const wchar_t *name, const wchar_t *mode)
|
||||
{
|
||||
hsAssert(0, "hsFileStream::Open NotImplemented for wchar_t");
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool hsBufferedStream::Close()
|
||||
bool hsBufferedStream::Close()
|
||||
{
|
||||
int rtn = true;
|
||||
if (fRef)
|
||||
@ -1556,7 +1539,7 @@ uint32_t hsBufferedStream::Write(uint32_t bytes, const void* buffer)
|
||||
return amtWritten;
|
||||
}
|
||||
|
||||
hsBool hsBufferedStream::AtEnd()
|
||||
bool hsBufferedStream::AtEnd()
|
||||
{
|
||||
if (fWriteBufferUsed)
|
||||
{
|
||||
|
@ -85,24 +85,24 @@ protected:
|
||||
uint32_t fBytesRead;
|
||||
uint32_t fPosition;
|
||||
|
||||
hsBool IsTokenSeparator(char c);
|
||||
bool IsTokenSeparator(char c);
|
||||
public:
|
||||
hsStream() : fBytesRead(0), fPosition(0) {}
|
||||
virtual ~hsStream();
|
||||
|
||||
virtual hsBool Open(const char *, const char * = "rb")=0;
|
||||
virtual hsBool Open(const wchar_t *, const wchar_t * = L"rb")=0;
|
||||
virtual hsBool Close()=0;
|
||||
virtual hsBool AtEnd();
|
||||
virtual bool Open(const char *, const char * = "rb")=0;
|
||||
virtual bool Open(const wchar_t *, const wchar_t * = L"rb")=0;
|
||||
virtual bool Close()=0;
|
||||
virtual bool AtEnd();
|
||||
virtual uint32_t Read(uint32_t byteCount, void * buffer) = 0;
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer) = 0;
|
||||
virtual void Skip(uint32_t deltaByteCount) = 0;
|
||||
virtual void Rewind() = 0;
|
||||
virtual void FastFwd();
|
||||
virtual void Skip(uint32_t deltaByteCount) = 0;
|
||||
virtual void Rewind() = 0;
|
||||
virtual void FastFwd();
|
||||
virtual uint32_t GetPosition() const;
|
||||
virtual void SetPosition(uint32_t position);
|
||||
virtual void Truncate();
|
||||
virtual void Flush() {}
|
||||
virtual void SetPosition(uint32_t position);
|
||||
virtual void Truncate();
|
||||
virtual void Flush() {}
|
||||
|
||||
#ifdef STREAM_LOGGER
|
||||
// Logging Reads & Skips
|
||||
@ -121,14 +121,14 @@ public:
|
||||
|
||||
// Optimization for small Reads
|
||||
virtual uint8_t ReadByte();
|
||||
virtual hsBool Read4Bytes(void *buffer); // Reads 4 bytes, return true if success
|
||||
virtual hsBool Read8Bytes(void *buffer); // Reads 8 bytes, return true if success
|
||||
virtual hsBool Read12Bytes(void *buffer); // Reads 12 bytes, return true if success
|
||||
virtual bool Read4Bytes(void *buffer); // Reads 4 bytes, return true if success
|
||||
virtual bool Read8Bytes(void *buffer); // Reads 8 bytes, return true if success
|
||||
virtual bool Read12Bytes(void *buffer); // Reads 12 bytes, return true if success
|
||||
|
||||
virtual uint32_t GetEOF();
|
||||
uint32_t GetSizeLeft();
|
||||
virtual void CopyToMem(void* mem);
|
||||
virtual hsBool IsCompressed() { return false; }
|
||||
virtual bool IsCompressed() { return false; }
|
||||
|
||||
uint32_t WriteString(const char cstring[]);
|
||||
uint32_t WriteString(const plString & string) { return WriteString(_TEMP_CONVERT_TO_CONST_CHAR(string)); }
|
||||
@ -150,21 +150,23 @@ public:
|
||||
plString ReadSafeString_TEMP();
|
||||
plString ReadSafeWString_TEMP();
|
||||
|
||||
hsBool GetToken(char *s, uint32_t maxLen=uint32_t(-1), const char beginComment=kComment, const char endComment=kEolnCode);
|
||||
hsBool ReadLn(char* s, uint32_t maxLen=uint32_t(-1), const char beginComment=kComment, const char endComment=kEolnCode);
|
||||
bool GetToken(char *s, uint32_t maxLen=uint32_t(-1), const char beginComment=kComment, const char endComment=kEolnCode);
|
||||
bool ReadLn(char* s, uint32_t maxLen=uint32_t(-1), const char beginComment=kComment, const char endComment=kEolnCode);
|
||||
|
||||
bool Readbool();
|
||||
hsBool ReadBool();
|
||||
void ReadBool(int count, hsBool values[]);
|
||||
// Reads a 4-byte BOOLean
|
||||
bool ReadBOOL();
|
||||
// Reads a 1-byte boolean
|
||||
bool ReadBool();
|
||||
void ReadBool(int count, bool values[]);
|
||||
uint16_t ReadLE16();
|
||||
void ReadLE16(int count, uint16_t values[]);
|
||||
uint32_t ReadLE32();
|
||||
void ReadLE32(int count, uint32_t values[]);
|
||||
uint32_t ReadBE32();
|
||||
|
||||
void Writebool(bool value);
|
||||
void WriteBool(hsBool value);
|
||||
void WriteBool(int count, const hsBool values[]);
|
||||
void WriteBOOL(bool value);
|
||||
void WriteBool(bool value);
|
||||
void WriteBool(int count, const bool values[]);
|
||||
void WriteByte(uint8_t value);
|
||||
void WriteLE16(uint16_t value);
|
||||
void WriteLE16(int count, const uint16_t values[]);
|
||||
@ -302,18 +304,18 @@ class hsFileStream: public hsStream
|
||||
uint32_t fRef;
|
||||
|
||||
public:
|
||||
hsFileStream();
|
||||
virtual ~hsFileStream();
|
||||
virtual hsBool Open(const char *name, const char *mode = "rb");
|
||||
virtual hsBool Open(const wchar_t *name, const wchar_t *mode = L"rb");
|
||||
virtual hsBool Close();
|
||||
hsFileStream();
|
||||
virtual ~hsFileStream();
|
||||
virtual bool Open(const char *name, const char *mode = "rb");
|
||||
virtual bool Open(const wchar_t *name, const wchar_t *mode = L"rb");
|
||||
virtual bool Close();
|
||||
|
||||
virtual hsBool AtEnd();
|
||||
virtual bool AtEnd();
|
||||
virtual uint32_t Read(uint32_t byteCount, void* buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void Truncate();
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void Truncate();
|
||||
|
||||
virtual uint32_t GetFileRef();
|
||||
virtual void SetFileRef(uint32_t refNum);
|
||||
@ -327,19 +329,19 @@ class hsUNIXStream: public hsStream
|
||||
public:
|
||||
hsUNIXStream(): fRef(0), fBuff(nil) {}
|
||||
~hsUNIXStream();
|
||||
virtual hsBool Open(const char* name, const char* mode = "rb");
|
||||
virtual hsBool Open(const wchar_t *name, const wchar_t *mode = L"rb");
|
||||
virtual hsBool Close();
|
||||
virtual bool Open(const char* name, const char* mode = "rb");
|
||||
virtual bool Open(const wchar_t *name, const wchar_t *mode = L"rb");
|
||||
virtual bool Close();
|
||||
|
||||
virtual hsBool AtEnd();
|
||||
virtual bool AtEnd();
|
||||
virtual uint32_t Read(uint32_t byteCount, void* buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual void SetPosition(uint32_t position);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void FastFwd();
|
||||
virtual void Truncate();
|
||||
virtual void Flush();
|
||||
virtual void SetPosition(uint32_t position);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void FastFwd();
|
||||
virtual void Truncate();
|
||||
virtual void Flush();
|
||||
|
||||
FILE* GetFILE() { return fRef; }
|
||||
void SetFILE(FILE* file) { fRef = file; }
|
||||
@ -362,17 +364,17 @@ public:
|
||||
plReadOnlySubStream(): fBase( nil ), fOffset( 0 ), fLength( 0 ) {}
|
||||
~plReadOnlySubStream();
|
||||
|
||||
virtual hsBool Open(const char *, const char *) { hsAssert(0, "plReadOnlySubStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "plReadOnlySubStream::Open NotImplemented"); return false; }
|
||||
void Open( hsStream *base, uint32_t offset, uint32_t length );
|
||||
virtual hsBool Close() { fBase = nil; fOffset = 0; fLength = 0; return true; }
|
||||
virtual hsBool AtEnd();
|
||||
virtual bool Open(const char *, const char *) { hsAssert(0, "plReadOnlySubStream::Open NotImplemented"); return false; }
|
||||
virtual bool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "plReadOnlySubStream::Open NotImplemented"); return false; }
|
||||
void Open( hsStream *base, uint32_t offset, uint32_t length );
|
||||
virtual bool Close() { fBase = nil; fOffset = 0; fLength = 0; return true; }
|
||||
virtual bool AtEnd();
|
||||
virtual uint32_t Read(uint32_t byteCount, void* buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void FastFwd();
|
||||
virtual void Truncate();
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void FastFwd();
|
||||
virtual void Truncate();
|
||||
|
||||
virtual uint32_t GetEOF();
|
||||
};
|
||||
@ -385,17 +387,17 @@ public:
|
||||
hsRAMStream(uint32_t chunkSize);
|
||||
virtual ~hsRAMStream();
|
||||
|
||||
virtual hsBool Open(const char *, const char *) { hsAssert(0, "hsRAMStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "hsRAMStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Close() { hsAssert(0, "hsRAMStream::Close NotImplemented"); return false; }
|
||||
virtual bool Open(const char *, const char *) { hsAssert(0, "hsRAMStream::Open NotImplemented"); return false; }
|
||||
virtual bool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "hsRAMStream::Open NotImplemented"); return false; }
|
||||
virtual bool Close() { hsAssert(0, "hsRAMStream::Close NotImplemented"); return false; }
|
||||
|
||||
|
||||
virtual hsBool AtEnd();
|
||||
virtual bool AtEnd();
|
||||
virtual uint32_t Read(uint32_t byteCount, void * buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void Truncate();
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void Truncate();
|
||||
|
||||
virtual uint32_t GetEOF();
|
||||
virtual void CopyToMem(void* mem);
|
||||
@ -406,18 +408,18 @@ public:
|
||||
class hsNullStream : public hsStream {
|
||||
public:
|
||||
|
||||
virtual hsBool Open(const char *, const char *) { return true; }
|
||||
virtual hsBool Open(const wchar_t *, const wchar_t *) { return true; }
|
||||
virtual hsBool Close() { return true; }
|
||||
virtual bool Open(const char *, const char *) { return true; }
|
||||
virtual bool Open(const wchar_t *, const wchar_t *) { return true; }
|
||||
virtual bool Close() { return true; }
|
||||
|
||||
virtual uint32_t Read(uint32_t byteCount, void * buffer); // throw's exception
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void Truncate();
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void Truncate();
|
||||
|
||||
uint32_t GetBytesWritten() const { return fBytesRead; }
|
||||
void Reset( ) { fBytesRead = 0; }
|
||||
uint32_t GetBytesWritten() const { return fBytesRead; }
|
||||
void Reset( ) { fBytesRead = 0; }
|
||||
};
|
||||
|
||||
// read only mem stream
|
||||
@ -430,19 +432,19 @@ public:
|
||||
hsReadOnlyStream(int size, const void* data) { Init(size, data); }
|
||||
hsReadOnlyStream() {}
|
||||
|
||||
virtual void Init(int size, const void* data) { fStart=((char*)data); fData=((char*)data); fStop=((char*)data + size); }
|
||||
virtual hsBool Open(const char *, const char *) { hsAssert(0, "hsReadOnlyStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "hsReadOnlyStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Close() { hsAssert(0, "hsReadOnlyStream::Close NotImplemented"); return false; }
|
||||
virtual hsBool AtEnd();
|
||||
virtual void Init(int size, const void* data) { fStart=((char*)data); fData=((char*)data); fStop=((char*)data + size); }
|
||||
virtual bool Open(const char *, const char *) { hsAssert(0, "hsReadOnlyStream::Open NotImplemented"); return false; }
|
||||
virtual bool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "hsReadOnlyStream::Open NotImplemented"); return false; }
|
||||
virtual bool Close() { hsAssert(0, "hsReadOnlyStream::Close NotImplemented"); return false; }
|
||||
virtual bool AtEnd();
|
||||
virtual uint32_t Read(uint32_t byteCount, void * buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer); // throws exception
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void Truncate();
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void Truncate();
|
||||
virtual uint32_t GetBytesRead() const { return fBytesRead; }
|
||||
virtual uint32_t GetEOF() { return (uint32_t)(fStop-fStart); }
|
||||
virtual void CopyToMem(void* mem);
|
||||
virtual void CopyToMem(void* mem);
|
||||
};
|
||||
|
||||
// write only mem stream
|
||||
@ -451,9 +453,9 @@ public:
|
||||
hsWriteOnlyStream(int size, const void* data) : hsReadOnlyStream(size, data) {}
|
||||
hsWriteOnlyStream() {}
|
||||
|
||||
virtual hsBool Open(const char *, const char *) { hsAssert(0, "hsWriteOnlyStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "hsWriteOnlyStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Close() { hsAssert(0, "hsWriteOnlyStream::Close NotImplemented"); return false; }
|
||||
virtual bool Open(const char *, const char *) { hsAssert(0, "hsWriteOnlyStream::Open NotImplemented"); return false; }
|
||||
virtual bool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "hsWriteOnlyStream::Open NotImplemented"); return false; }
|
||||
virtual bool Close() { hsAssert(0, "hsWriteOnlyStream::Close NotImplemented"); return false; }
|
||||
virtual uint32_t Read(uint32_t byteCount, void * buffer); // throws exception
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual uint32_t GetBytesRead() const { return 0; }
|
||||
@ -472,16 +474,16 @@ public:
|
||||
hsQueueStream(int32_t size);
|
||||
~hsQueueStream();
|
||||
|
||||
virtual hsBool Open(const char *, const char *) { hsAssert(0, "hsQueueStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "hsQueueStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Close() { hsAssert(0, "hsQueueStream::Close NotImplemented"); return false; }
|
||||
virtual bool Open(const char *, const char *) { hsAssert(0, "hsQueueStream::Open NotImplemented"); return false; }
|
||||
virtual bool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "hsQueueStream::Open NotImplemented"); return false; }
|
||||
virtual bool Close() { hsAssert(0, "hsQueueStream::Close NotImplemented"); return false; }
|
||||
|
||||
virtual uint32_t Read(uint32_t byteCount, void * buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void FastFwd();
|
||||
virtual hsBool AtEnd();
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void FastFwd();
|
||||
virtual bool AtEnd();
|
||||
|
||||
uint32_t GetSize() { return fSize; }
|
||||
const char* GetQueue() { return fQueue; }
|
||||
@ -501,7 +503,7 @@ class hsBufferedStream : public hsStream
|
||||
// a partial block at the end of the file.
|
||||
uint32_t fBufferLen;
|
||||
|
||||
hsBool fWriteBufferUsed;
|
||||
bool fWriteBufferUsed;
|
||||
|
||||
#ifdef HS_DEBUGGING
|
||||
// For doing statistics on how efficient we are
|
||||
@ -515,16 +517,16 @@ public:
|
||||
hsBufferedStream();
|
||||
virtual ~hsBufferedStream();
|
||||
|
||||
virtual hsBool Open(const char* name, const char* mode = "rb");
|
||||
virtual hsBool Open(const wchar_t* name, const wchar_t* mode = L"rb");
|
||||
virtual hsBool Close();
|
||||
virtual bool Open(const char* name, const char* mode = "rb");
|
||||
virtual bool Open(const wchar_t* name, const wchar_t* mode = L"rb");
|
||||
virtual bool Close();
|
||||
|
||||
virtual hsBool AtEnd();
|
||||
virtual bool AtEnd();
|
||||
virtual uint32_t Read(uint32_t byteCount, void* buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void Truncate();
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void Truncate();
|
||||
virtual uint32_t GetEOF();
|
||||
|
||||
FILE* GetFileRef();
|
||||
|
@ -61,12 +61,12 @@ hsStringTokenizer::~hsStringTokenizer()
|
||||
delete[] fSeps;
|
||||
}
|
||||
|
||||
hsBool hsStringTokenizer::HasMoreTokens()
|
||||
bool hsStringTokenizer::HasMoreTokens()
|
||||
{
|
||||
return (*fTok != 0);
|
||||
}
|
||||
|
||||
inline hsBool hsStringTokenizer::IsSep(char c)
|
||||
inline bool hsStringTokenizer::IsSep(char c)
|
||||
{
|
||||
if (!fQAsTok || !fInQuote)
|
||||
{
|
||||
@ -111,7 +111,7 @@ char *hsStringTokenizer::next()
|
||||
}
|
||||
|
||||
// Slightly more loop-friendly version of next
|
||||
hsBool hsStringTokenizer::Next( char *token, uint32_t maxTokLen )
|
||||
bool hsStringTokenizer::Next( char *token, uint32_t maxTokLen )
|
||||
{
|
||||
char *t = next();
|
||||
if( t == nil )
|
||||
@ -161,7 +161,7 @@ void hsStringTokenizer::Reset(const char *string, const char *seps)
|
||||
// next();
|
||||
}
|
||||
|
||||
void hsStringTokenizer::ParseQuotes(hsBool qAsTok)
|
||||
void hsStringTokenizer::ParseQuotes(bool qAsTok)
|
||||
{
|
||||
fQAsTok = qAsTok;
|
||||
}
|
||||
@ -185,12 +185,12 @@ hsWStringTokenizer::~hsWStringTokenizer()
|
||||
delete[] fSeps;
|
||||
}
|
||||
|
||||
hsBool hsWStringTokenizer::HasMoreTokens()
|
||||
bool hsWStringTokenizer::HasMoreTokens()
|
||||
{
|
||||
return (*fTok != L'\0');
|
||||
}
|
||||
|
||||
inline hsBool hsWStringTokenizer::IsSep(wchar_t c)
|
||||
inline bool hsWStringTokenizer::IsSep(wchar_t c)
|
||||
{
|
||||
if (!fQAsTok || !fInQuote)
|
||||
{
|
||||
@ -235,7 +235,7 @@ wchar_t *hsWStringTokenizer::next()
|
||||
}
|
||||
|
||||
// Slightly more loop-friendly version of next
|
||||
hsBool hsWStringTokenizer::Next( wchar_t *token, uint32_t maxTokLen )
|
||||
bool hsWStringTokenizer::Next( wchar_t *token, uint32_t maxTokLen )
|
||||
{
|
||||
wchar_t *t = next();
|
||||
if( t == nil )
|
||||
@ -303,7 +303,7 @@ void hsWStringTokenizer::Reset(const wchar_t *string, const wchar_t *seps)
|
||||
// next();
|
||||
}
|
||||
|
||||
void hsWStringTokenizer::ParseQuotes(hsBool qAsTok)
|
||||
void hsWStringTokenizer::ParseQuotes(bool qAsTok)
|
||||
{
|
||||
fQAsTok = qAsTok;
|
||||
}
|
||||
|
@ -59,17 +59,17 @@ private:
|
||||
char fLastRep;
|
||||
|
||||
int32_t fNumSeps;
|
||||
hsBool fQAsTok;
|
||||
hsBool fInQuote;
|
||||
hsBool fCheckAlphaNum;
|
||||
bool fQAsTok;
|
||||
bool fInQuote;
|
||||
bool fCheckAlphaNum;
|
||||
public:
|
||||
hsStringTokenizer(const char *string=nil, const char *seps=nil);
|
||||
~hsStringTokenizer();
|
||||
char *next();
|
||||
hsBool Next( char *token, uint32_t maxTokLen );
|
||||
hsBool HasMoreTokens();
|
||||
bool Next( char *token, uint32_t maxTokLen );
|
||||
bool HasMoreTokens();
|
||||
void Reset(const char *string, const char *seps);
|
||||
void ParseQuotes(hsBool qAsTok);
|
||||
void ParseQuotes(bool qAsTok);
|
||||
|
||||
char *GetRestOfString( void ) const { return fTok; }
|
||||
|
||||
@ -78,7 +78,7 @@ public:
|
||||
void RestoreLastTerminator( void );
|
||||
|
||||
private:
|
||||
hsBool IsSep(char c);
|
||||
bool IsSep(char c);
|
||||
};
|
||||
|
||||
class hsWStringTokenizer
|
||||
@ -90,17 +90,17 @@ private:
|
||||
wchar_t fLastRep;
|
||||
|
||||
int32_t fNumSeps;
|
||||
hsBool fQAsTok;
|
||||
hsBool fInQuote;
|
||||
hsBool fCheckAlphaNum;
|
||||
bool fQAsTok;
|
||||
bool fInQuote;
|
||||
bool fCheckAlphaNum;
|
||||
public:
|
||||
hsWStringTokenizer(const wchar_t *string=nil, const wchar_t *seps=nil);
|
||||
~hsWStringTokenizer();
|
||||
wchar_t *next();
|
||||
hsBool Next( wchar_t *token, uint32_t maxTokLen );
|
||||
hsBool HasMoreTokens();
|
||||
bool Next( wchar_t *token, uint32_t maxTokLen );
|
||||
bool HasMoreTokens();
|
||||
void Reset(const wchar_t *string, const wchar_t *seps);
|
||||
void ParseQuotes(hsBool qAsTok);
|
||||
void ParseQuotes(bool qAsTok);
|
||||
|
||||
wchar_t *GetRestOfString( void ) const { return fTok; }
|
||||
|
||||
@ -109,7 +109,7 @@ public:
|
||||
void RestoreLastTerminator( void );
|
||||
|
||||
private:
|
||||
hsBool IsSep(wchar_t c);
|
||||
bool IsSep(wchar_t c);
|
||||
};
|
||||
|
||||
#endif // _hsStringTokenizer_Included_
|
||||
|
@ -224,7 +224,7 @@ public:
|
||||
|
||||
template <class T> class hsDynamicArray {
|
||||
private:
|
||||
int32_t fCount;
|
||||
int32_t fCount;
|
||||
T* fArray;
|
||||
|
||||
hsDynamicArray<T>& operator=(const hsDynamicArray<T>&); // don't allow assignment
|
||||
@ -235,28 +235,28 @@ public:
|
||||
virtual ~hsDynamicArray();
|
||||
|
||||
int32_t GetCount() const { return fCount; }
|
||||
hsBool IsEmpty() const { return fCount == 0; }
|
||||
const T& Get(int32_t index) const;
|
||||
bool IsEmpty() const { return fCount == 0; }
|
||||
const T& Get(int32_t index) const;
|
||||
int32_t Get(int32_t index, int32_t count, T data[]) const;
|
||||
int32_t Find(const T&) const; // returns kMissingIndex if not found
|
||||
|
||||
void SetCount(int32_t count);
|
||||
T& operator[]( int32_t index );
|
||||
void SetCount(int32_t count);
|
||||
T& operator[]( int32_t index );
|
||||
int32_t Append(const T&);
|
||||
int32_t InsertAtIndex(uint32_t index, const T& obj);
|
||||
int32_t Push(const T&);
|
||||
int32_t Pop(T*);
|
||||
void Remove(int32_t);
|
||||
void Reset(); // clears out everything
|
||||
void Remove(int32_t);
|
||||
void Reset(); // clears out everything
|
||||
|
||||
T* AcquireArray() { return fArray; }
|
||||
T* DetachArray() { T* t = fArray; fCount = 0; fArray = nil; return t; }
|
||||
void ReleaseArray(T*) {}
|
||||
hsDynamicArray<T>* Copy(hsDynamicArray<T>* dst = nil) const;
|
||||
T* AcquireArray() { return fArray; }
|
||||
T* DetachArray() { T* t = fArray; fCount = 0; fArray = nil; return t; }
|
||||
void ReleaseArray(T*) {}
|
||||
hsDynamicArray<T>* Copy(hsDynamicArray<T>* dst = nil) const;
|
||||
|
||||
T* ForEach(bool (*proc)(T&));
|
||||
T* ForEach(bool (*proc)(T&, void* p1), void* p1);
|
||||
T* ForEach(bool (*proc)(T&, void* p1, void* p2), void* p1, void* p2);
|
||||
T* ForEach(int32_t (*proc)(T&));
|
||||
T* ForEach(int32_t (*proc)(T&, void* p1), void* p1);
|
||||
T* ForEach(int32_t (*proc)(T&, void* p1, void* p2), void* p1, void* p2);
|
||||
};
|
||||
|
||||
// Use this for block of memory allocated with HSMemory::New()
|
||||
@ -475,7 +475,7 @@ hsDynamicArray<T>* hsDynamicArray<T>::Copy(hsDynamicArray<T>* dst) const
|
||||
return dst;
|
||||
}
|
||||
|
||||
template <class T> T* hsDynamicArray<T>::ForEach(bool (*proc)(T&))
|
||||
template <class T> T* hsDynamicArray<T>::ForEach(int32_t (*proc)(T&))
|
||||
{
|
||||
for (int i = 0; i < fCount; i++)
|
||||
if (proc(fArray[i]))
|
||||
@ -483,7 +483,7 @@ template <class T> T* hsDynamicArray<T>::ForEach(bool (*proc)(T&))
|
||||
return nil;
|
||||
}
|
||||
|
||||
template <class T> T* hsDynamicArray<T>::ForEach(bool (*proc)(T&, void* p1), void * p1)
|
||||
template <class T> T* hsDynamicArray<T>::ForEach(int32_t (*proc)(T&, void* p1), void * p1)
|
||||
{
|
||||
for (int i = 0; i < fCount; i++)
|
||||
if (proc(fArray[i], p1))
|
||||
@ -491,7 +491,7 @@ template <class T> T* hsDynamicArray<T>::ForEach(bool (*proc)(T&, void* p1), voi
|
||||
return nil;
|
||||
}
|
||||
|
||||
template <class T> T* hsDynamicArray<T>::ForEach(bool (*proc)(T&, void* p1, void* p2), void *p1, void *p2)
|
||||
template <class T> T* hsDynamicArray<T>::ForEach(int32_t (*proc)(T&, void* p1, void* p2), void *p1, void *p2)
|
||||
{
|
||||
for (int i = 0; i < fCount; i++)
|
||||
if (proc(fArray[i], p1, p2))
|
||||
@ -614,7 +614,7 @@ public:
|
||||
hsTArray_ValidateIndex(index + count - 1);
|
||||
this->DecCount(index, count);
|
||||
}
|
||||
hsBool RemoveItem(const T& item);
|
||||
bool RemoveItem(const T& item);
|
||||
|
||||
T* Push()
|
||||
{
|
||||
@ -638,9 +638,9 @@ public:
|
||||
kMissingIndex = -1
|
||||
};
|
||||
int Find(const T& item) const; // returns kMissingIndex if not found
|
||||
inline T* ForEach(hsBool (*proc)(T&));
|
||||
inline T* ForEach(hsBool (*proc)(T&, void* p1), void* p1);
|
||||
inline T* ForEach(hsBool (*proc)(T&, void* p1, void* p2), void* p1, void* p2);
|
||||
inline T* ForEach(int32_t (*proc)(T&));
|
||||
inline T* ForEach(int32_t (*proc)(T&, void* p1), void* p1);
|
||||
inline T* ForEach(int32_t (*proc)(T&, void* p1, void* p2), void* p1, void* p2);
|
||||
|
||||
T* DetachArray()
|
||||
{
|
||||
@ -813,7 +813,7 @@ template <class T> int hsTArray<T>::Find(const T& item) const
|
||||
return kMissingIndex;
|
||||
}
|
||||
|
||||
template <class T> hsBool hsTArray<T>::RemoveItem(const T& item)
|
||||
template <class T> bool hsTArray<T>::RemoveItem(const T& item)
|
||||
{
|
||||
for (int i = 0; i < fUseCount; i++)
|
||||
if (fArray[i] == item)
|
||||
@ -870,7 +870,7 @@ template <class T> void hsTArray<T>::DecCount(int index, int count)
|
||||
}
|
||||
}
|
||||
|
||||
template <class T> T* hsTArray<T>::ForEach(hsBool (*proc)(T&))
|
||||
template <class T> T* hsTArray<T>::ForEach(int32_t (*proc)(T&))
|
||||
{
|
||||
for (int i = 0; i < fUseCount; i++)
|
||||
if (proc(fArray[i]))
|
||||
@ -878,7 +878,7 @@ template <class T> T* hsTArray<T>::ForEach(hsBool (*proc)(T&))
|
||||
return nil;
|
||||
}
|
||||
|
||||
template <class T> T* hsTArray<T>::ForEach(hsBool (*proc)(T&, void* p1), void* p1)
|
||||
template <class T> T* hsTArray<T>::ForEach(int32_t (*proc)(T&, void* p1), void* p1)
|
||||
{
|
||||
for (int i = 0; i < fUseCount; i++)
|
||||
if (proc(fArray[i], p1))
|
||||
@ -886,7 +886,7 @@ template <class T> T* hsTArray<T>::ForEach(hsBool (*proc)(T&, void* p1), void* p
|
||||
return nil;
|
||||
}
|
||||
|
||||
template <class T> T* hsTArray<T>::ForEach(hsBool (*proc)(T&, void* p1, void* p2), void* p1, void* p2)
|
||||
template <class T> T* hsTArray<T>::ForEach(int32_t (*proc)(T&, void* p1, void* p2), void* p1, void* p2)
|
||||
{
|
||||
for (int i = 0; i < fUseCount; i++)
|
||||
if (proc(fArray[i], p1, p2))
|
||||
@ -1011,7 +1011,7 @@ public:
|
||||
hsLargeArray_ValidateIndex(index + count - 1);
|
||||
this->DecCount(index, count);
|
||||
}
|
||||
hsBool RemoveItem(const T& item);
|
||||
bool RemoveItem(const T& item);
|
||||
|
||||
T* Push()
|
||||
{
|
||||
@ -1035,9 +1035,9 @@ public:
|
||||
kMissingIndex = -1
|
||||
};
|
||||
int Find(const T& item) const; // returns kMissingIndex if not found
|
||||
inline T* ForEach(hsBool (*proc)(T&));
|
||||
inline T* ForEach(hsBool (*proc)(T&, void* p1), void* p1);
|
||||
inline T* ForEach(hsBool (*proc)(T&, void* p1, void* p2), void* p1, void* p2);
|
||||
inline T* ForEach(int32_t (*proc)(T&));
|
||||
inline T* ForEach(int32_t (*proc)(T&, void* p1), void* p1);
|
||||
inline T* ForEach(int32_t (*proc)(T&, void* p1, void* p2), void* p1, void* p2);
|
||||
|
||||
T* DetachArray()
|
||||
{
|
||||
@ -1182,7 +1182,7 @@ template <class T> int hsLargeArray<T>::Find(const T& item) const
|
||||
return kMissingIndex;
|
||||
}
|
||||
|
||||
template <class T> hsBool hsLargeArray<T>::RemoveItem(const T& item)
|
||||
template <class T> bool hsLargeArray<T>::RemoveItem(const T& item)
|
||||
{
|
||||
for (int i = 0; i < fUseCount; i++)
|
||||
if (fArray[i] == item)
|
||||
@ -1239,7 +1239,7 @@ template <class T> void hsLargeArray<T>::DecCount(int index, int count)
|
||||
}
|
||||
}
|
||||
|
||||
template <class T> T* hsLargeArray<T>::ForEach(hsBool (*proc)(T&))
|
||||
template <class T> T* hsLargeArray<T>::ForEach(int32_t (*proc)(T&))
|
||||
{
|
||||
for (int i = 0; i < fUseCount; i++)
|
||||
if (proc(fArray[i]))
|
||||
@ -1247,7 +1247,7 @@ template <class T> T* hsLargeArray<T>::ForEach(hsBool (*proc)(T&))
|
||||
return nil;
|
||||
}
|
||||
|
||||
template <class T> T* hsLargeArray<T>::ForEach(hsBool (*proc)(T&, void* p1), void* p1)
|
||||
template <class T> T* hsLargeArray<T>::ForEach(int32_t (*proc)(T&, void* p1), void* p1)
|
||||
{
|
||||
for (int i = 0; i < fUseCount; i++)
|
||||
if (proc(fArray[i], p1))
|
||||
@ -1255,7 +1255,7 @@ template <class T> T* hsLargeArray<T>::ForEach(hsBool (*proc)(T&, void* p1), voi
|
||||
return nil;
|
||||
}
|
||||
|
||||
template <class T> T* hsLargeArray<T>::ForEach(hsBool (*proc)(T&, void* p1, void* p2), void* p1, void* p2)
|
||||
template <class T> T* hsLargeArray<T>::ForEach(int32_t (*proc)(T&, void* p1, void* p2), void* p1, void* p2)
|
||||
{
|
||||
for (int i = 0; i < fUseCount; i++)
|
||||
if (proc(fArray[i], p1, p2))
|
||||
|
@ -68,20 +68,20 @@ public:
|
||||
typedef pthread_t ThreadId;
|
||||
#endif
|
||||
private:
|
||||
hsBool fQuit;
|
||||
uint32_t fStackSize;
|
||||
bool fQuit;
|
||||
uint32_t fStackSize;
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
ThreadId fThreadId;
|
||||
HANDLE fThreadH;
|
||||
HANDLE fQuitSemaH;
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
ThreadId fPThread;
|
||||
hsBool fIsValid;
|
||||
bool fIsValid;
|
||||
pthread_mutex_t fMutex;
|
||||
#endif
|
||||
protected:
|
||||
hsBool GetQuit() const { return hsBool(fQuit); }
|
||||
void SetQuit(hsBool value) { fQuit = value; }
|
||||
bool GetQuit() const { return fQuit; }
|
||||
void SetQuit(bool value) { fQuit = value; }
|
||||
public:
|
||||
hsThread(uint32_t stackSize = 0);
|
||||
virtual ~hsThread(); // calls Stop()
|
||||
@ -121,7 +121,7 @@ public:
|
||||
#endif
|
||||
|
||||
void Lock();
|
||||
hsBool TryLock();
|
||||
bool TryLock();
|
||||
void Unlock();
|
||||
};
|
||||
|
||||
@ -165,8 +165,8 @@ public:
|
||||
HANDLE GetHandle() const { return fSemaH; }
|
||||
#endif
|
||||
|
||||
hsBool TryWait();
|
||||
hsBool Wait(hsMilliseconds timeToWait = kPosInfinity32);
|
||||
bool TryWait();
|
||||
bool Wait(hsMilliseconds timeToWait = kPosInfinity32);
|
||||
void Signal();
|
||||
};
|
||||
|
||||
@ -177,7 +177,7 @@ class hsEvent
|
||||
#ifndef PSEUDO_EVENT
|
||||
pthread_mutex_t fMutex;
|
||||
pthread_cond_t fCond;
|
||||
hsBool fTriggered;
|
||||
bool fTriggered;
|
||||
#else
|
||||
enum { kRead, kWrite };
|
||||
int fFds[2];
|
||||
@ -195,8 +195,8 @@ public:
|
||||
HANDLE GetHandle() const { return fEvent; }
|
||||
#endif
|
||||
|
||||
hsBool Wait(hsMilliseconds timeToWait = kPosInfinity32);
|
||||
void Signal();
|
||||
bool Wait(hsMilliseconds timeToWait = kPosInfinity32);
|
||||
void Signal();
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -153,7 +153,7 @@ hsSemaphore::~hsSemaphore()
|
||||
hsThrowIfOSErr(status);
|
||||
}
|
||||
|
||||
hsBool hsSemaphore::Wait(hsMilliseconds timeToWait)
|
||||
bool hsSemaphore::Wait(hsMilliseconds timeToWait)
|
||||
{
|
||||
Duration duration;
|
||||
|
||||
|
@ -253,7 +253,7 @@ void hsMutex::Lock()
|
||||
#endif
|
||||
}
|
||||
|
||||
hsBool hsMutex::TryLock()
|
||||
bool hsMutex::TryLock()
|
||||
{
|
||||
int status = ::pthread_mutex_trylock(&fPMutex);
|
||||
hsThrowIfOSErr(status);
|
||||
@ -316,7 +316,7 @@ hsSemaphore::~hsSemaphore()
|
||||
#endif
|
||||
}
|
||||
|
||||
hsBool hsSemaphore::TryWait()
|
||||
bool hsSemaphore::TryWait()
|
||||
{
|
||||
#ifdef USE_SEMA
|
||||
int status = ::sem_trywait(fPSema);
|
||||
@ -328,7 +328,7 @@ hsBool hsSemaphore::TryWait()
|
||||
#endif
|
||||
}
|
||||
|
||||
hsBool hsSemaphore::Wait(hsMilliseconds timeToWait)
|
||||
bool hsSemaphore::Wait(hsMilliseconds timeToWait)
|
||||
{
|
||||
#ifdef USE_SEMA // SHOULDN'T THIS USE timeToWait??!?!? -rje
|
||||
// shouldn't this use sem_timedwait? -dpogue (2012-03-04)
|
||||
@ -337,7 +337,7 @@ hsBool hsSemaphore::Wait(hsMilliseconds timeToWait)
|
||||
hsThrowIfOSErr(status);
|
||||
return true;
|
||||
#else
|
||||
hsBool retVal = true;
|
||||
bool retVal = true;
|
||||
int status = ::pthread_mutex_lock(&fPMutex);
|
||||
hsThrowIfOSErr(status);
|
||||
|
||||
@ -430,9 +430,9 @@ hsEvent::~hsEvent()
|
||||
hsThrowIfOSErr(status);
|
||||
}
|
||||
|
||||
hsBool hsEvent::Wait(hsMilliseconds timeToWait)
|
||||
bool hsEvent::Wait(hsMilliseconds timeToWait)
|
||||
{
|
||||
hsBool retVal = true;
|
||||
bool retVal = true;
|
||||
int status = ::pthread_mutex_lock(&fMutex);
|
||||
hsAssert(status == 0, "hsEvent Mutex Lock");
|
||||
hsThrowIfOSErr(status);
|
||||
@ -530,7 +530,7 @@ hsEvent::~hsEvent()
|
||||
close( fFds[kWrite] );
|
||||
}
|
||||
|
||||
hsBool hsEvent::Wait( hsMilliseconds timeToWait )
|
||||
bool hsEvent::Wait( hsMilliseconds timeToWait )
|
||||
{
|
||||
hsTempMutexLock lock( fWaitLock );
|
||||
|
||||
|
@ -142,7 +142,7 @@ void hsMutex::Lock()
|
||||
hsAssert(state != WAIT_TIMEOUT,"hsMutex::Lock -> Infinite Timeout expired?");
|
||||
}
|
||||
|
||||
hsBool hsMutex::TryLock()
|
||||
bool hsMutex::TryLock()
|
||||
{
|
||||
DWORD state = ::WaitForSingleObject(fMutexH, 0);
|
||||
hsAssert(state != WAIT_ABANDONED,"hsMutex::TryLock -> Abandoned Mutex");
|
||||
@ -170,14 +170,14 @@ hsSemaphore::~hsSemaphore()
|
||||
::CloseHandle(fSemaH);
|
||||
}
|
||||
|
||||
hsBool hsSemaphore::TryWait()
|
||||
bool hsSemaphore::TryWait()
|
||||
{
|
||||
DWORD result = ::WaitForSingleObject(fSemaH, 0);
|
||||
hsAssert(result != WAIT_ABANDONED, "hsSemaphore -> Abandoned Semaphore");
|
||||
return result == WAIT_OBJECT_0;
|
||||
}
|
||||
|
||||
hsBool hsSemaphore::Wait(hsMilliseconds timeToWait)
|
||||
bool hsSemaphore::Wait(hsMilliseconds timeToWait)
|
||||
{
|
||||
if (timeToWait == kPosInfinity32)
|
||||
timeToWait = INFINITE;
|
||||
@ -211,7 +211,7 @@ hsEvent::~hsEvent()
|
||||
::CloseHandle(fEvent);
|
||||
}
|
||||
|
||||
hsBool hsEvent::Wait(hsMilliseconds timeToWait)
|
||||
bool hsEvent::Wait(hsMilliseconds timeToWait)
|
||||
{
|
||||
if (timeToWait == kPosInfinity32)
|
||||
timeToWait = INFINITE;
|
||||
|
@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline hsBool OverflowAdd(uint32_t* sum, uint32_t a, uint32_t b)
|
||||
inline bool OverflowAdd(uint32_t* sum, uint32_t a, uint32_t b)
|
||||
{
|
||||
*sum = a + b;
|
||||
|
||||
@ -55,7 +55,7 @@ inline hsBool OverflowAdd(uint32_t* sum, uint32_t a, uint32_t b)
|
||||
|
||||
wide = (high << 32) + (middle << 16) + low
|
||||
*/
|
||||
inline hsBool SetWide3(hsWide* target, int32_t high, uint32_t middle, uint32_t low)
|
||||
inline bool SetWide3(hsWide* target, int32_t high, uint32_t middle, uint32_t low)
|
||||
{
|
||||
hsAssert(high >= 0, "high is neg");
|
||||
|
||||
@ -308,7 +308,7 @@ int32_t hsWide::CubeRoot() const
|
||||
uint32_t valueL = fLo;
|
||||
uint32_t currH, currL;
|
||||
uint32_t guessH, guessL;
|
||||
hsBool neg = false;
|
||||
bool neg = false;
|
||||
|
||||
if (WIDE_ISNEG(valueH, valueL))
|
||||
{ neg = true;
|
||||
|
@ -51,18 +51,18 @@ struct hsWide {
|
||||
hsWide* Set(int32_t lo) { fLo = lo; if (lo < 0) fHi = -1L; else fHi = 0; return this; }
|
||||
hsWide* Set(int32_t hi, uint32_t lo) { fHi = hi; fLo = lo; return this; }
|
||||
|
||||
inline hsBool IsNeg() const { return fHi < 0; }
|
||||
inline hsBool IsPos() const { return fHi > 0 || (fHi == 0 && fLo != 0); }
|
||||
inline hsBool IsZero() const { return fHi == 0 && fLo == 0; }
|
||||
inline hsBool IsWide() const;
|
||||
inline bool IsNeg() const { return fHi < 0; }
|
||||
inline bool IsPos() const { return fHi > 0 || (fHi == 0 && fLo != 0); }
|
||||
inline bool IsZero() const { return fHi == 0 && fLo == 0; }
|
||||
inline bool IsWide() const;
|
||||
|
||||
|
||||
hsBool operator==(const hsWide& b) const { return fHi == b.fHi && fLo == b.fLo; }
|
||||
hsBool operator<(const hsWide& b) const { return fHi < b.fHi || (fHi == b.fHi && fLo < b.fLo); }
|
||||
hsBool operator>( const hsWide& b) const { return fHi > b.fHi || (fHi == b.fHi && fLo > b.fLo); }
|
||||
hsBool operator!=( const hsWide& b) const { return !( *this == b); }
|
||||
hsBool operator<=(const hsWide& b) const { return !(*this > b); }
|
||||
hsBool operator>=(const hsWide& b) const { return !(*this < b); }
|
||||
bool operator==(const hsWide& b) const { return fHi == b.fHi && fLo == b.fLo; }
|
||||
bool operator<(const hsWide& b) const { return fHi < b.fHi || (fHi == b.fHi && fLo < b.fLo); }
|
||||
bool operator>( const hsWide& b) const { return fHi > b.fHi || (fHi == b.fHi && fLo > b.fLo); }
|
||||
bool operator!=( const hsWide& b) const { return !( *this == b); }
|
||||
bool operator<=(const hsWide& b) const { return !(*this > b); }
|
||||
bool operator>=(const hsWide& b) const { return !(*this < b); }
|
||||
|
||||
inline hsWide* Negate();
|
||||
inline hsWide* Add(int32_t scaler);
|
||||
@ -182,7 +182,7 @@ inline int32_t hsWide::AsLong() const
|
||||
return (int32_t)fLo;
|
||||
}
|
||||
|
||||
inline hsBool hsWide::IsWide() const
|
||||
inline bool hsWide::IsWide() const
|
||||
{
|
||||
return (fHi > 0 || (fHi == 0 && (int32_t)fLo < 0)) || (fHi < -1L || (fHi == -1L && (int32_t)fLo >= 0));
|
||||
}
|
||||
|
@ -73,7 +73,10 @@ class pcSmallRect
|
||||
void Read( hsStream *s );
|
||||
void Write( hsStream *s );
|
||||
|
||||
hsBool Contains( int16_t x, int16_t y ) { if( x >= fX && x <= fX + fWidth && y >= fY && y <= fY + fHeight ) return true; return false; }
|
||||
bool Contains( int16_t x, int16_t y ) const
|
||||
{
|
||||
return (x >= fX) && (x <= fX + fWidth) && (y >= fY) && (y <= fY + fHeight);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -177,7 +177,7 @@ int plGeneric::Read(hsStream* stream)
|
||||
break; // nothing to read
|
||||
|
||||
case kBool:
|
||||
fBoolVal = (stream->ReadBool() != 0);
|
||||
fBoolVal = stream->ReadBool();
|
||||
break;
|
||||
|
||||
case kInt:
|
||||
|
@ -144,13 +144,13 @@ uint32_t plLoadMask::ValidateMasks(int num, plLoadMask masks[])
|
||||
return retVal;
|
||||
}
|
||||
|
||||
hsBool plLoadMask::ComputeRepMasks(
|
||||
bool plLoadMask::ComputeRepMasks(
|
||||
int num,
|
||||
const int quals[],
|
||||
const int caps[],
|
||||
plLoadMask masks[])
|
||||
{
|
||||
hsBool retVal = false; // Okay till proven otherwise.
|
||||
bool retVal = false; // Okay till proven otherwise.
|
||||
|
||||
int i;
|
||||
for( i = 0; i < num; i++ )
|
||||
|
@ -74,21 +74,21 @@ public:
|
||||
plLoadMask(uint8_t qLo, uint8_t qHi) { fQuality[0] = qLo; fQuality[1] = qHi; }
|
||||
~plLoadMask() {}
|
||||
|
||||
hsBool DontLoad() const { return !(fQuality[fGlobalCapability] & fGlobalQuality); }
|
||||
bool DontLoad() const { return !(fQuality[fGlobalCapability] & fGlobalQuality); }
|
||||
|
||||
hsBool NeverLoads() const { return !(fQuality[0] && fQuality[1]); }
|
||||
bool NeverLoads() const { return !(fQuality[0] && fQuality[1]); }
|
||||
|
||||
hsBool IsUsed() const { return (fQuality[0] != uint8_t(-1)) || (fQuality[1] != uint8_t(-1)); }
|
||||
bool IsUsed() const { return (fQuality[0] != uint8_t(-1)) || (fQuality[1] != uint8_t(-1)); }
|
||||
|
||||
hsBool MatchesQuality(int q) const { return (IBitToMask(q) & (fQuality[0] | fQuality[1])) != 0; }
|
||||
hsBool MatchesCapability(int c) const { return fQuality[c] != 0; }
|
||||
hsBool MatchesQualityAndCapability(int q, int c) const { return IBitToMask(q) & fQuality[c]; }
|
||||
bool MatchesQuality(int q) const { return (IBitToMask(q) & (fQuality[0] | fQuality[1])) != 0; }
|
||||
bool MatchesCapability(int c) const { return fQuality[c] != 0; }
|
||||
bool MatchesQualityAndCapability(int q, int c) const { return IBitToMask(q) & fQuality[c]; }
|
||||
|
||||
hsBool MatchesCurrentQuality() const { return MatchesQuality(fGlobalQuality); }
|
||||
hsBool MatchesCurrentCapability() const { return MatchesCapability(fGlobalCapability); }
|
||||
hsBool MatchesCurrent() const { return !DontLoad(); }
|
||||
bool MatchesCurrentQuality() const { return MatchesQuality(fGlobalQuality); }
|
||||
bool MatchesCurrentCapability() const { return MatchesCapability(fGlobalCapability); }
|
||||
bool MatchesCurrent() const { return !DontLoad(); }
|
||||
|
||||
uint8_t GetQualityMask(int cap) const { return fQuality[cap]; }
|
||||
uint8_t GetQualityMask(int cap) const { return fQuality[cap]; }
|
||||
|
||||
plLoadMask& SetMask(uint8_t lo, uint8_t hi) { fQuality[0] = lo; fQuality[1] = hi; return *this; }
|
||||
plLoadMask& SetNever() { return SetMask(0,0); }
|
||||
@ -127,7 +127,7 @@ public:
|
||||
// the output with ValidateMasks. The return value is a bitmask of which
|
||||
// items in the list had problems, so return of zero means A-OK.
|
||||
//
|
||||
static hsBool ComputeRepMasks(int num, const int quals[], const int caps[], plLoadMask masks[]);
|
||||
static bool ComputeRepMasks(int num, const int quals[], const int caps[], plLoadMask masks[]);
|
||||
static uint32_t ValidateReps(int num, const int quals[], const int caps[]);
|
||||
static uint32_t ValidateMasks(int num, plLoadMask masks[]);
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ class plRefCnt
|
||||
public:
|
||||
plRefCnt() : fRefCnt(1){}
|
||||
~plRefCnt(){}
|
||||
hsBool TimeToDelete() { return (fRefCnt == 1); }
|
||||
bool TimeToDelete() { return (fRefCnt == 1); }
|
||||
void Incr() { fRefCnt++; }
|
||||
void Decr() { fRefCnt--; }
|
||||
};
|
||||
|
@ -114,7 +114,7 @@ void plViewTransform::ISetCameraToNDC() const
|
||||
ISetFlag(kCameraToNDCSet);
|
||||
}
|
||||
|
||||
void plViewTransform::SetViewPort(const hsPoint2& mins, const hsPoint2& maxs, hsBool relative)
|
||||
void plViewTransform::SetViewPort(const hsPoint2& mins, const hsPoint2& maxs, bool relative)
|
||||
{
|
||||
fViewPortX.Set(mins.fX, maxs.fX, 1.f / (maxs.fX - mins.fX));
|
||||
fViewPortY.Set(mins.fY, maxs.fY, 1.f / (maxs.fY - mins.fY));
|
||||
@ -221,7 +221,7 @@ hsScalarTriple plViewTransform::NDCToMap(const hsScalarTriple& ndcP) const
|
||||
return map;
|
||||
}
|
||||
|
||||
hsBool plViewTransform::SetProjection(const hsBounds3& bnd)
|
||||
bool plViewTransform::SetProjection(const hsBounds3& bnd)
|
||||
{
|
||||
hsPoint3 maxs;
|
||||
hsPoint3 mins;
|
||||
@ -233,14 +233,14 @@ hsBool plViewTransform::SetProjection(const hsBounds3& bnd)
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool plViewTransform::SetProjectionWorld(const hsBounds3& wBnd)
|
||||
bool plViewTransform::SetProjectionWorld(const hsBounds3& wBnd)
|
||||
{
|
||||
hsBounds3Ext cBnd = wBnd;
|
||||
cBnd.Transform(&GetWorldToCamera());
|
||||
return SetProjection(cBnd);
|
||||
}
|
||||
|
||||
hsBool plViewTransform::IGetMaxMinsFromBnd(const hsBounds3& bnd, hsPoint3& mins, hsPoint3& maxs) const
|
||||
bool plViewTransform::IGetMaxMinsFromBnd(const hsBounds3& bnd, hsPoint3& mins, hsPoint3& maxs) const
|
||||
{
|
||||
if( bnd.GetMaxs().fZ <= kMinHither )
|
||||
return false;
|
||||
@ -259,12 +259,12 @@ hsBool plViewTransform::IGetMaxMinsFromBnd(const hsBounds3& bnd, hsPoint3& mins,
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool plViewTransform::Intersect(const plViewTransform& view)
|
||||
bool plViewTransform::Intersect(const plViewTransform& view)
|
||||
{
|
||||
hsPoint3 mins;
|
||||
hsPoint3 maxs;
|
||||
|
||||
hsBool retVal = true;
|
||||
bool retVal = true;
|
||||
int i;
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
@ -282,7 +282,7 @@ hsBool plViewTransform::Intersect(const plViewTransform& view)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
hsBool plViewTransform::Union(const plViewTransform& view)
|
||||
bool plViewTransform::Union(const plViewTransform& view)
|
||||
{
|
||||
hsPoint3 mins;
|
||||
hsPoint3 maxs;
|
||||
|
@ -95,9 +95,9 @@ public:
|
||||
void Reset(); // resets to default state
|
||||
|
||||
// Queries
|
||||
hsBool GetOrthogonal() const { return IHasFlag(kOrthogonal); }
|
||||
hsBool GetPerspective() const { return !GetOrthogonal(); }
|
||||
hsBool GetViewPortRelative() const { return IHasFlag(kViewPortRelative); }
|
||||
bool GetOrthogonal() const { return IHasFlag(kOrthogonal); }
|
||||
bool GetPerspective() const { return !GetOrthogonal(); }
|
||||
bool GetViewPortRelative() const { return IHasFlag(kViewPortRelative); }
|
||||
|
||||
// Next, all our matrices.
|
||||
const hsMatrix44& GetCameraToWorld() const { return fCameraToWorld; }
|
||||
@ -110,8 +110,8 @@ public:
|
||||
hsVector3 GetUp() const { return *((hsVector3*)&GetWorldToCamera().fMap[1]); }
|
||||
hsVector3 GetAcross() const { return *((hsVector3*)&GetWorldToCamera().fMap[0]); }
|
||||
|
||||
uint16_t GetScreenWidth() const { return fWidth; }
|
||||
uint16_t GetScreenHeight() const { return fHeight; }
|
||||
uint16_t GetScreenWidth() const { return fWidth; }
|
||||
uint16_t GetScreenHeight() const { return fHeight; }
|
||||
|
||||
void GetViewPort(hsPoint2& mins, hsPoint2& maxs) const;
|
||||
void GetViewPort(int& loX, int& loY, int& hiX, int& hiY) const;
|
||||
@ -130,14 +130,14 @@ public:
|
||||
hsPoint3 GetMapMax() const { return fMapMax; }
|
||||
void GetMapping(hsPoint3& mapMin, hsPoint3& mapMax) const { mapMin = fMapMin; mapMax = fMapMax; }
|
||||
|
||||
float GetFovX() const;
|
||||
float GetFovY() const;
|
||||
float GetFovXDeg() const { return hsRadiansToDegrees(GetFovX()); }
|
||||
float GetFovYDeg() const { return hsRadiansToDegrees(GetFovY()); }
|
||||
float GetOrthoWidth() const { return fMax.fX - fMin.fX; }
|
||||
float GetOrthoHeight() const { return fMax.fY - fMin.fY; }
|
||||
float GetHither() const { return fMin.fZ; }
|
||||
float GetYon() const { return fMax.fZ; }
|
||||
float GetFovX() const;
|
||||
float GetFovY() const;
|
||||
float GetFovXDeg() const { return hsRadiansToDegrees(GetFovX()); }
|
||||
float GetFovYDeg() const { return hsRadiansToDegrees(GetFovY()); }
|
||||
float GetOrthoWidth() const { return fMax.fX - fMin.fX; }
|
||||
float GetOrthoHeight() const { return fMax.fY - fMin.fY; }
|
||||
float GetHither() const { return fMin.fZ; }
|
||||
float GetYon() const { return fMax.fZ; }
|
||||
void GetDepth(float& hither, float& yon) const { hither = GetHither(); yon = GetYon(); }
|
||||
|
||||
// Setup.
|
||||
@ -145,8 +145,8 @@ public:
|
||||
void SetCameraTransform(const hsMatrix44& w2c, const hsMatrix44& c2w) { fWorldToCamera = w2c; fCameraToWorld = c2w; ISetFlag(kWorldToNDCSet, false); }
|
||||
|
||||
// Next, what kind of projection.
|
||||
void SetOrthogonal(hsBool on) { ISetFlag(kOrthogonal, on); InvalidateTransforms(); }
|
||||
void SetPerspective(hsBool on) { SetOrthogonal(!on); }
|
||||
void SetOrthogonal(bool on) { ISetFlag(kOrthogonal, on); InvalidateTransforms(); }
|
||||
void SetPerspective(bool on) { SetOrthogonal(!on); }
|
||||
|
||||
// Next, setting the scree/window/rendertarget size
|
||||
void SetWidth(uint16_t w) { fWidth = w; }
|
||||
@ -156,8 +156,8 @@ public:
|
||||
// Next, setting the viewport. You only need to do this if you want to use the screen functions above.
|
||||
// If you're passing in and getting out normalized device coordinates, skip this. If you don't set viewport,
|
||||
// Defaults to 0,0,width,height (i.e. the whole screen).
|
||||
void SetViewPort(const hsPoint2& mins, const hsPoint2& maxs, hsBool relative=true);
|
||||
void SetViewPort(float loX, float loY, float hiX, float hiY, hsBool relative=true) { SetViewPort(hsPoint2().Set(loX, loY), hsPoint2().Set(hiX, hiY), relative); }
|
||||
void SetViewPort(const hsPoint2& mins, const hsPoint2& maxs, bool relative=true);
|
||||
void SetViewPort(float loX, float loY, float hiX, float hiY, bool relative=true) { SetViewPort(hsPoint2().Set(loX, loY), hsPoint2().Set(hiX, hiY), relative); }
|
||||
void SetViewPort(uint16_t left, uint16_t top, uint16_t right, uint16_t bottom) { SetViewPort(float(left), float(top), float(right), float(bottom), false); }
|
||||
|
||||
void SetMapping(const hsPoint3& mins, const hsPoint3& maxs) { SetMapMin(mins); SetMapMax(maxs); }
|
||||
@ -203,8 +203,8 @@ public:
|
||||
// Note this doesn't swivel the camera around to see the box, it offsets the projection.
|
||||
// Return false if there isn't a projection that will capture any of the bnd. This
|
||||
// can be from the bnd being behind the camera.
|
||||
hsBool SetProjection(const hsBounds3& cBnd);
|
||||
hsBool SetProjectionWorld(const hsBounds3& wBnd);
|
||||
bool SetProjection(const hsBounds3& cBnd);
|
||||
bool SetProjectionWorld(const hsBounds3& wBnd);
|
||||
|
||||
// This lets you create insane projection matrices. Note that it won't change the answer on anything like
|
||||
// GetFov().
|
||||
@ -216,8 +216,8 @@ public:
|
||||
// of what the two views will see. The boolean is performed in axis aligned camera space, which lines
|
||||
// up nicely with screen space. Note that this only makes sense for two ViewTransforms with identical
|
||||
// CameraToWorld's (which isn't checked).
|
||||
hsBool Intersect(const plViewTransform& view);
|
||||
hsBool Union(const plViewTransform& view);
|
||||
bool Intersect(const plViewTransform& view);
|
||||
bool Union(const plViewTransform& view);
|
||||
|
||||
// Convenience to move from one space to another.
|
||||
// Screen means pixels - Default is mapping NDC -> [0..1]. Z value of pixel is NDC Z.
|
||||
@ -322,20 +322,20 @@ protected:
|
||||
static const float kMinHither;
|
||||
|
||||
void ISetCameraToNDC() const;
|
||||
hsBool ICameraToNDCSet() const { return IHasFlag(kCameraToNDCSet); }
|
||||
bool ICameraToNDCSet() const { return IHasFlag(kCameraToNDCSet); }
|
||||
const hsMatrix44& ICheckCameraToNDC() const { if( !ICameraToNDCSet() ) ISetCameraToNDC(); return fCameraToNDC; }
|
||||
|
||||
void ISetWorldToNDC() const { fWorldToNDC = GetCameraToNDC() * fWorldToCamera; ISetFlag(kWorldToNDCSet); }
|
||||
hsBool IWorldToNDCSet() const { return IHasFlag(kWorldToNDCSet); }
|
||||
bool IWorldToNDCSet() const { return IHasFlag(kWorldToNDCSet); }
|
||||
const hsMatrix44& ICheckWorldToNDC() const { if( !IWorldToNDCSet() ) ISetWorldToNDC(); return fWorldToNDC; }
|
||||
|
||||
hsBool IGetMaxMinsFromBnd(const hsBounds3& bnd, hsPoint3& mins, hsPoint3& maxs) const;
|
||||
bool IGetMaxMinsFromBnd(const hsBounds3& bnd, hsPoint3& mins, hsPoint3& maxs) const;
|
||||
|
||||
void InvalidateTransforms() { ISetFlag(kCameraToNDCSet|kWorldToNDCSet, false); }
|
||||
|
||||
// Flags - generic
|
||||
hsBool IHasFlag(uint32_t f) const { return 0 != (fFlags & f); }
|
||||
void ISetFlag(uint32_t f, hsBool on=true) const { if(on) fFlags |= f; else fFlags &= ~f; }
|
||||
bool IHasFlag(uint32_t f) const { return 0 != (fFlags & f); }
|
||||
void ISetFlag(uint32_t f, bool on=true) const { if(on) fFlags |= f; else fFlags &= ~f; }
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user