NadnerbD
13 years ago
1722 changed files with 24174 additions and 27621 deletions
@ -1,6 +1,5 @@ |
|||||||
add_subdirectory(Apps) |
add_subdirectory(Apps) |
||||||
add_subdirectory(CoreLib) |
add_subdirectory(CoreLib) |
||||||
add_subdirectory(CoreLibExe) |
|
||||||
add_subdirectory(FeatureLib) |
add_subdirectory(FeatureLib) |
||||||
add_subdirectory(NucleusLib) |
add_subdirectory(NucleusLib) |
||||||
add_subdirectory(PubUtilLib) |
add_subdirectory(PubUtilLib) |
||||||
|
@ -1,61 +0,0 @@ |
|||||||
struct HS_POINT2_NAME { |
|
||||||
HS_POINT2_TYPE fX, fY; |
|
||||||
|
|
||||||
HS_POINT2_NAME& Set(HS_POINT2_TYPE x, HS_POINT2_TYPE y) |
|
||||||
{ |
|
||||||
fX = x; |
|
||||||
fY = y; |
|
||||||
return *this; |
|
||||||
} |
|
||||||
HS_POINT2_NAME& operator+=(const HS_POINT2_NAME& s) |
|
||||||
{ |
|
||||||
this->fX += s.fX; |
|
||||||
this->fY += s.fY; |
|
||||||
return *this; |
|
||||||
} |
|
||||||
HS_POINT2_NAME& operator-=(const HS_POINT2_NAME& s) |
|
||||||
{ |
|
||||||
this->fX -= s.fX; |
|
||||||
this->fY -= s.fY; |
|
||||||
return *this; |
|
||||||
} |
|
||||||
|
|
||||||
#if 0 // Havok reeks |
|
||||||
friend int operator==(const HS_POINT2_NAME& s, const HS_POINT2_NAME& t) |
|
||||||
{ |
|
||||||
return (s.fX == t.fX && s.fY == t.fY); |
|
||||||
} |
|
||||||
friend int operator!=(const HS_POINT2_NAME& s, const HS_POINT2_NAME& t) |
|
||||||
{ |
|
||||||
return !(s == t); |
|
||||||
} |
|
||||||
#else // Havok reeks |
|
||||||
int operator==(const HS_POINT2_NAME& ss) const |
|
||||||
{ |
|
||||||
return (ss.fX == fX && ss.fY == fY); |
|
||||||
} |
|
||||||
int operator!=(const HS_POINT2_NAME& ss) |
|
||||||
{ |
|
||||||
return !(ss == *this); |
|
||||||
} |
|
||||||
#endif // Havok reeks |
|
||||||
friend HS_POINT2_NAME operator+(const HS_POINT2_NAME& s, const HS_POINT2_NAME& t) |
|
||||||
{ |
|
||||||
HS_POINT2_NAME result; |
|
||||||
result.Set(s.fX + t.fX, s.fY + t.fY); |
|
||||||
return result; |
|
||||||
} |
|
||||||
friend HS_POINT2_NAME operator-(const HS_POINT2_NAME& s, const HS_POINT2_NAME& t) |
|
||||||
{ |
|
||||||
HS_POINT2_NAME result; |
|
||||||
result.Set(s.fX - t.fX, s.fY - t.fY); |
|
||||||
return result; |
|
||||||
} |
|
||||||
friend HS_POINT2_NAME operator-(const HS_POINT2_NAME& s) |
|
||||||
{ |
|
||||||
HS_POINT2_NAME result = { -s.fX, -s.fY }; |
|
||||||
return result; |
|
||||||
} |
|
||||||
|
|
||||||
#undef HS_POINT2_NAME |
|
||||||
#undef HS_POINT2_TYPE |
|
File diff suppressed because it is too large
Load Diff
@ -1,128 +0,0 @@ |
|||||||
/*==LICENSE==*
|
|
||||||
|
|
||||||
CyanWorlds.com Engine - MMOG client, server and tools |
|
||||||
Copyright (C) 2011 Cyan Worlds, Inc. |
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify |
|
||||||
it under the terms of the GNU General Public License as published by |
|
||||||
the Free Software Foundation, either version 3 of the License, or |
|
||||||
(at your option) any later version. |
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, |
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
GNU General Public License for more details. |
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License |
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
#include "HeadSpin.h" |
|
||||||
|
|
||||||
#ifndef hsConfigDefined |
|
||||||
#define hsConfigDefined |
|
||||||
|
|
||||||
|
|
||||||
#ifndef SERVER |
|
||||||
# define CLIENT |
|
||||||
#endif |
|
||||||
|
|
||||||
|
|
||||||
//////////////////// Change the 1s and 0s //////////////////////
|
|
||||||
|
|
||||||
#define HS_CAN_USE_FLOAT 1 |
|
||||||
#define HS_SCALAR_IS_FLOAT 1 |
|
||||||
|
|
||||||
#define HS_PIN_MATH_OVERFLOW 0 // This forces hsWide versions of FixMath routines
|
|
||||||
#define HS_DEBUG_MATH_OVERFLOW 0 // This calls hsDebugMessage on k[Pos,Neg]Infinity
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////// Specific Compiler Stuff This Section is computed ////////////
|
|
||||||
|
|
||||||
#if defined(_WIN32) |
|
||||||
#define HS_BUILD_FOR_WIN32 1 |
|
||||||
#elif defined(__unix__) |
|
||||||
#define HS_BUILD_FOR_UNIX 1 |
|
||||||
#endif |
|
||||||
|
|
||||||
#define HS_SCALAR_IS_FIXED !(HS_SCALAR_IS_FLOAT) |
|
||||||
#define HS_NEVER_USE_FLOAT !(HS_CAN_USE_FLOAT) |
|
||||||
|
|
||||||
#if HS_DEBUG_MATH_OVERFLOW && !(HS_PIN_MATH_OVERFLOW) |
|
||||||
#error "Can't debug overflow unless HS_PIN_MATH_OVERFLOW is ON" |
|
||||||
#endif |
|
||||||
|
|
||||||
|
|
||||||
///////////////////////Windows Specific Defines /////////////////////////////
|
|
||||||
|
|
||||||
#if HS_BUILD_FOR_WIN32 |
|
||||||
|
|
||||||
// 4244: Conversion
|
|
||||||
// 4305: Truncation
|
|
||||||
// 4503: 'identifier' : decorated name length exceeded, name was truncated
|
|
||||||
// 4018: signed/unsigned mismatch
|
|
||||||
// 4786: 255 character debug limit
|
|
||||||
// 4284: STL template defined operator-> for a class it doesn't make sense for (int, etc)
|
|
||||||
// 4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
|
|
||||||
#ifdef _MSC_VER |
|
||||||
#pragma warning( disable : 4305 4503 4018 4786 4284 4800) |
|
||||||
#endif |
|
||||||
|
|
||||||
// VC++ version greater than 6.0, must be building for .NET
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER > 1200) |
|
||||||
#define HS_BUILD_FOR_WIN32_NET |
|
||||||
#endif |
|
||||||
|
|
||||||
#pragma optimize( "y", off ) |
|
||||||
|
|
||||||
#endif |
|
||||||
|
|
||||||
|
|
||||||
#ifdef HS_BUILD_FOR_WIN32 |
|
||||||
# ifndef CDECL |
|
||||||
# define CDECL __cdecl |
|
||||||
# endif |
|
||||||
#else |
|
||||||
# define CDECL |
|
||||||
#endif |
|
||||||
|
|
||||||
|
|
||||||
/////////////////////Debugging Defines ///////////////////////////////////
|
|
||||||
|
|
||||||
#if (defined(_DEBUG)||defined(UNIX_DEBUG)) && !defined(HS_DISABLE_ASSERT) |
|
||||||
#define HS_DEBUGGING |
|
||||||
#if (!defined(HS_NO_MEM_TRACKER)) |
|
||||||
#define HS_FIND_MEM_LEAKS |
|
||||||
#endif |
|
||||||
#endif |
|
||||||
|
|
||||||
|
|
||||||
///////////////////// Required facilities ///////////////////////////////
|
|
||||||
#ifndef HeadSpinHDefined |
|
||||||
#include "HeadSpin.h" |
|
||||||
#endif |
|
||||||
|
|
||||||
#endif // hsConfigDefined
|
|
@ -1,120 +0,0 @@ |
|||||||
/*==LICENSE==*
|
|
||||||
|
|
||||||
CyanWorlds.com Engine - MMOG client, server and tools |
|
||||||
Copyright (C) 2011 Cyan Worlds, Inc. |
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify |
|
||||||
it under the terms of the GNU General Public License as published by |
|
||||||
the Free Software Foundation, either version 3 of the License, or |
|
||||||
(at your option) any later version. |
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, |
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
GNU General Public License for more details. |
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License |
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
#ifndef hsFixedTypesDefined |
|
||||||
#define hsFixedTypesDefined |
|
||||||
|
|
||||||
#include "hsTypes.h" |
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
extern "C" { |
|
||||||
#endif |
|
||||||
|
|
||||||
#define hsIntToFixed(x) ((hsFixed)(x) << 16) |
|
||||||
#define hsFixedToInt(x) ((x) >> 16) |
|
||||||
#define hsFixedRound(x) (((x) + 0x8000) >> 16) |
|
||||||
#define hsFixed1 hsIntToFixed(1) |
|
||||||
#define hsFixedPI (0x3243F) |
|
||||||
#define hsFixedPiOver2 (0x1921F) |
|
||||||
|
|
||||||
#define hsFixedToFract(x) ((hsFract)(x) << 14) |
|
||||||
#define hsFractToFixed(x) ((hsFixed)(x) >> 14) |
|
||||||
#define hsFract1 hsFixedToFract(hsFixed1) |
|
||||||
#define hsFractPiOver2 (0x6487ED34) /* needs some work */ |
|
||||||
|
|
||||||
#define hsFixFloor(x) \ |
|
||||||
(hsFixed)((x) < 0 ? -(hsFixed)((-(x) + 0xFFFF) & 0xFFFF0000) : (x) & 0xFFFF0000) |
|
||||||
|
|
||||||
#define hsFixedToFloorInt(x) \ |
|
||||||
(int)((x) < 0 ? -(int)((-(x) + 0xFFFF) >> 16) : ((x) >> 16)) |
|
||||||
|
|
||||||
#define hsFixCeiling(x) \ |
|
||||||
(hsFixed)((x) < 0 ? -(hsFixed)(-(x) & 0xFFFF0000) : ((x) + 0xFFFF) & 0xFFFF0000) |
|
||||||
|
|
||||||
#define hsFixedToCeilingInt(x) \ |
|
||||||
(int)((x) < 0 ? -(int)(-(x) >> 16) : (((x) + 0xFFFF) >> 16)) |
|
||||||
|
|
||||||
|
|
||||||
#if HS_CAN_USE_FLOAT |
|
||||||
#define hsFixedToFloat(x) ((x) / float(hsFixed1)) |
|
||||||
#define hsFloatToFixed(x) hsFixed((x) * hsFixed1) |
|
||||||
|
|
||||||
#define hsFractToFloat(x) ((x) / float(hsFract1)) |
|
||||||
#define hsFloatToFract(x) hsFract((x) * hsFract1) |
|
||||||
#endif |
|
||||||
|
|
||||||
|
|
||||||
hsFixed hsFixMul(hsFixed a, hsFixed b); |
|
||||||
|
|
||||||
hsFract hsFixDiv(hsFixed a, hsFixed b); |
|
||||||
hsFract hsFracMul(hsFract a, hsFract b); |
|
||||||
hsFract hsFracDiv(hsFract a, hsFract b); |
|
||||||
|
|
||||||
hsFract hsFracSqrt(hsFract value); |
|
||||||
#define hsFixSqrt(value) (hsFracSqrt(value) >> 7) |
|
||||||
hsFract hsFracCubeRoot(hsFract value); |
|
||||||
hsFixed hsFixedSin(hsFixed s); |
|
||||||
hsFixed hsFixedCos(hsFixed s); |
|
||||||
hsFixed hsFixedASin(hsFixed s); |
|
||||||
hsFixed hsFixedACos(hsFixed s); |
|
||||||
|
|
||||||
UInt16 hsSqrt32(UInt32 value); |
|
||||||
UInt16 hsCubeRoot32(UInt32 value); |
|
||||||
Int32 hsMulDiv32(Int32 numer1, Int32 numer2, Int32 denom); |
|
||||||
Int32 hsMagnitude32(Int32 x, Int32 y); |
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
} |
|
||||||
#endif |
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
struct hsFixedPlane { |
|
||||||
hsFixed fA, fB, fC; |
|
||||||
|
|
||||||
void Set(hsFixed a, hsFixed b, hsFixed c) { fA = a; fB = b; fC = c; } |
|
||||||
|
|
||||||
hsFixed FixEval(hsFixed x, hsFixed y) const { return hsFixMul(fA, x) + hsFixMul(fB, y) + fC; } |
|
||||||
Int32 IntEval(Int32 x, Int32 y) const { return fA * x + fB * y + fC; } |
|
||||||
void ShiftDown(UInt32 i) { fA >>= i; fB >>= i; fC >>= i;} |
|
||||||
}; |
|
||||||
#endif |
|
||||||
|
|
||||||
#endif |
|
@ -1,105 +0,0 @@ |
|||||||
/*==LICENSE==*
|
|
||||||
|
|
||||||
CyanWorlds.com Engine - MMOG client, server and tools |
|
||||||
Copyright (C) 2011 Cyan Worlds, Inc. |
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify |
|
||||||
it under the terms of the GNU General Public License as published by |
|
||||||
the Free Software Foundation, either version 3 of the License, or |
|
||||||
(at your option) any later version. |
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, |
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
GNU General Public License for more details. |
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License |
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
#include "hsMMIOStream.h" |
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#if HS_BUILD_FOR_WIN32 |
|
||||||
|
|
||||||
#include "hsExceptions.h" |
|
||||||
|
|
||||||
UInt32 hsMMIOStream::Read(UInt32 bytes, void* buffer) |
|
||||||
{ |
|
||||||
fBytesRead += bytes; |
|
||||||
fPosition += bytes; |
|
||||||
int numItems = ::mmioRead(fHmfr, (char*)buffer, bytes); |
|
||||||
if ((unsigned)numItems < bytes)
|
|
||||||
{ |
|
||||||
if (numItems>=0 && ::mmioSeek(fHmfr,0,SEEK_CUR)==::mmioSeek(fHmfr,0,SEEK_END)) { |
|
||||||
// EOF ocurred
|
|
||||||
char str[128]; |
|
||||||
sprintf(str, "Hit EOF on MMIO Read, only read %d out of requested %d bytes\n", numItems, bytes); |
|
||||||
hsDebugMessage(str, 0); |
|
||||||
} |
|
||||||
else
|
|
||||||
{ |
|
||||||
hsDebugMessage("Error on MMIO Read",0); |
|
||||||
} |
|
||||||
} |
|
||||||
return numItems; |
|
||||||
} |
|
||||||
|
|
||||||
hsBool hsMMIOStream::AtEnd() |
|
||||||
{ |
|
||||||
return (::mmioSeek(fHmfr,0,SEEK_CUR)==::mmioSeek(fHmfr,0,SEEK_END)); |
|
||||||
} |
|
||||||
|
|
||||||
UInt32 hsMMIOStream::Write(UInt32 bytes, const void* buffer) |
|
||||||
{ |
|
||||||
fPosition += bytes; |
|
||||||
return ::mmioWrite(fHmfr,(const char*)buffer,bytes); |
|
||||||
} |
|
||||||
|
|
||||||
void hsMMIOStream::Skip(UInt32 delta) |
|
||||||
{ |
|
||||||
fBytesRead += delta; |
|
||||||
fPosition += delta; |
|
||||||
(void)::mmioSeek(fHmfr, delta, SEEK_CUR); |
|
||||||
} |
|
||||||
|
|
||||||
void hsMMIOStream::Rewind() |
|
||||||
{ |
|
||||||
fBytesRead = 0; |
|
||||||
fPosition = 0; |
|
||||||
(void)::mmioSeek(fHmfr, 0, SEEK_SET); |
|
||||||
} |
|
||||||
|
|
||||||
void hsMMIOStream::FastFwd() |
|
||||||
{ |
|
||||||
fBytesRead = fPosition = ::mmioSeek(fHmfr, 0, SEEK_END); |
|
||||||
} |
|
||||||
|
|
||||||
void hsMMIOStream::Truncate() |
|
||||||
{ |
|
||||||
hsThrow("Truncate unimplemented by subclass of stream"); |
|
||||||
} |
|
||||||
#endif |
|
@ -1,72 +0,0 @@ |
|||||||
/*==LICENSE==*
|
|
||||||
|
|
||||||
CyanWorlds.com Engine - MMOG client, server and tools |
|
||||||
Copyright (C) 2011 Cyan Worlds, Inc. |
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify |
|
||||||
it under the terms of the GNU General Public License as published by |
|
||||||
the Free Software Foundation, either version 3 of the License, or |
|
||||||
(at your option) any later version. |
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, |
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
GNU General Public License for more details. |
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License |
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
#ifndef hsMMIOStream_inc |
|
||||||
#define hsMMIOStream_inc |
|
||||||
|
|
||||||
#include "hsWindows.h" |
|
||||||
#include "hsStream.h" |
|
||||||
|
|
||||||
#if HS_BUILD_FOR_WIN32 |
|
||||||
#include <mmsystem.h> |
|
||||||
|
|
||||||
class hsMMIOStream: public hsStream |
|
||||||
{
|
|
||||||
HMMIO fHmfr; |
|
||||||
public: |
|
||||||
|
|
||||||
virtual hsBool Open(const char *, const char *) { hsAssert(0, "hsMMIOStream::Open NotImplemented"); return false; } |
|
||||||
virtual hsBool Close() { hsAssert(0, "hsMMIOStream::Close NotImplemented"); return false; } |
|
||||||
|
|
||||||
virtual hsBool AtEnd(); |
|
||||||
virtual UInt32 Read(UInt32 byteCount, void* buffer); |
|
||||||
virtual UInt32 Write(UInt32 byteCount, const void* buffer); |
|
||||||
virtual void Skip(UInt32 deltaByteCount); |
|
||||||
virtual void Rewind(); |
|
||||||
virtual void FastFwd(); |
|
||||||
virtual void Truncate(); |
|
||||||
|
|
||||||
HMMIO GetHandle() { return fHmfr; } |
|
||||||
void SetHandle(HMMIO handle) { fHmfr = handle; } |
|
||||||
}; |
|
||||||
#endif |
|
||||||
|
|
||||||
#endif // hsMMIOStream_inc
|
|
@ -1,56 +0,0 @@ |
|||||||
/*==LICENSE==*
|
|
||||||
|
|
||||||
CyanWorlds.com Engine - MMOG client, server and tools |
|
||||||
Copyright (C) 2011 Cyan Worlds, Inc. |
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify |
|
||||||
it under the terms of the GNU General Public License as published by |
|
||||||
the Free Software Foundation, either version 3 of the License, or |
|
||||||
(at your option) any later version. |
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, |
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
GNU General Public License for more details. |
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License |
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
/*****************************************************************************
|
|
||||||
* |
|
||||||
* $/Plasma20/Sources/Plasma/CoreLib/hsMalloc.cpp |
|
||||||
*
|
|
||||||
***/ |
|
||||||
|
|
||||||
#include "HeadSpin.h" |
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* |
|
||||||
* Exports |
|
||||||
* |
|
||||||
***/ |
|
||||||
|
|
@ -1,205 +0,0 @@ |
|||||||
/*==LICENSE==*
|
|
||||||
|
|
||||||
CyanWorlds.com Engine - MMOG client, server and tools |
|
||||||
Copyright (C) 2011 Cyan Worlds, Inc. |
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify |
|
||||||
it under the terms of the GNU General Public License as published by |
|
||||||
the Free Software Foundation, either version 3 of the License, or |
|
||||||
(at your option) any later version. |
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, |
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
GNU General Public License for more details. |
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License |
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
/*****************************************************************************
|
|
||||||
* |
|
||||||
* $/Plasma20/Sources/Plasma/CoreLib/hsMalloc.h |
|
||||||
*
|
|
||||||
***/ |
|
||||||
|
|
||||||
#ifndef PLASMA20_SOURCES_PLASMA_CORELIB_HSMALLOC_H |
|
||||||
#define PLASMA20_SOURCES_PLASMA_CORELIB_HSMALLOC_H |
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* |
|
||||||
* Allocation functions |
|
||||||
* |
|
||||||
***/ |
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
extern "C" { |
|
||||||
#endif |
|
||||||
|
|
||||||
// MemAlloc flags
|
|
||||||
extern const unsigned kMemReallocInPlaceOnly; // use _expand when realloc'ing
|
|
||||||
extern const unsigned kMemZero; // fill allocated memory with zeros
|
|
||||||
extern const unsigned kMemIgnoreBlock; // don't track this allocation
|
|
||||||
|
|
||||||
|
|
||||||
void * MemAlloc (unsigned bytes, unsigned flags, const char file[], int line); |
|
||||||
void * MemDup (const void * ptr, unsigned bytes, unsigned flags, const char file[], int line); |
|
||||||
void MemFree (void * ptr, unsigned flags); |
|
||||||
void * MemRealloc (void * ptr, unsigned bytes, unsigned flags, const char file[], int line); |
|
||||||
unsigned MemSize (void * ptr); |
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* |
|
||||||
* Manipulation functions |
|
||||||
* |
|
||||||
***/ |
|
||||||
|
|
||||||
int MemCmp (const void * buf1, const void * buf2, unsigned bytes); |
|
||||||
void MemCopy (void * dest, const void * source, unsigned bytes); |
|
||||||
void MemMove (void * dest, const void * source, unsigned bytes); |
|
||||||
void MemSet (void * dest, unsigned value, unsigned bytes); |
|
||||||
void MemZero (void * dest, unsigned bytes); |
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* |
|
||||||
* Debugging functions |
|
||||||
* |
|
||||||
***/ |
|
||||||
|
|
||||||
void MemDumpAllocReport (); |
|
||||||
void MemDumpUsageReport (); |
|
||||||
void MemValidateNow (); |
|
||||||
void MemSetValidation (unsigned on); |
|
||||||
void MemPushDisableTracking (); |
|
||||||
void MemPopDisableTracking (); |
|
||||||
void MemSetColor (unsigned short color); |
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
} |
|
||||||
#endif |
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* |
|
||||||
* C++ Operators |
|
||||||
* |
|
||||||
***/ |
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
|
|
||||||
#include <new> |
|
||||||
|
|
||||||
#ifndef _MSC_VER |
|
||||||
#define THROW(x) throw(x) |
|
||||||
#define THROW_EMPTY throw() |
|
||||||
#else |
|
||||||
#define THROW(x) |
|
||||||
#define THROW_EMPTY |
|
||||||
#endif |
|
||||||
|
|
||||||
// standard new and delete
|
|
||||||
inline void* CDECL operator new (size_t bytes) THROW(std::bad_alloc) |
|
||||||
{ return MemAlloc((unsigned)bytes, 0, __FILE__, __LINE__); } |
|
||||||
inline void* CDECL operator new [](size_t bytes) THROW(std::bad_alloc) |
|
||||||
{ return MemAlloc((unsigned)bytes, 0, __FILE__, __LINE__); } |
|
||||||
inline void CDECL operator delete (void * ptr) THROW_EMPTY |
|
||||||
{ MemFree(ptr, 0); } |
|
||||||
inline void CDECL operator delete [](void * ptr) THROW_EMPTY |
|
||||||
{ MemFree(ptr, 0); } |
|
||||||
|
|
||||||
// memcheck-friendly new
|
|
||||||
inline void* CDECL operator new (size_t bytes, const char file[], unsigned line) |
|
||||||
{ return MemAlloc((unsigned)bytes, 0, file, line); } |
|
||||||
inline void* CDECL operator new [](size_t bytes, const char file[], unsigned line) |
|
||||||
{ return MemAlloc((unsigned)bytes, 0, file, line); } |
|
||||||
inline void CDECL operator delete (void * ptr, const char [], unsigned) |
|
||||||
{ return MemFree(ptr, 0); } |
|
||||||
inline void CDECL operator delete [](void * ptr, const char [], unsigned) |
|
||||||
{ return MemFree(ptr, 0); } |
|
||||||
#define TRACKED_NEW new(__FILE__, __LINE__) |
|
||||||
|
|
||||||
|
|
||||||
// placement new
|
|
||||||
#if defined(_MSC_VER) && !defined(__PLACEMENT_NEW_INLINE) |
|
||||||
#define __PLACEMENT_NEW_INLINE |
|
||||||
inline void* CDECL operator new (size_t, void * ptr) { return ptr; } |
|
||||||
inline void CDECL operator delete (void *, void *) {} |
|
||||||
#endif // ifndef __PLACEMENT_NEW_INLINE
|
|
||||||
|
|
||||||
#endif // ifdef __cplusplus
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* |
|
||||||
* Macros |
|
||||||
* |
|
||||||
***/ |
|
||||||
|
|
||||||
#define ALLOC(b) MemAlloc(b, 0, __FILE__, __LINE__) |
|
||||||
#define ALLOCZERO(b) MemAlloc(b, kMemZero, __FILE__, __LINE__) |
|
||||||
#define ALLOCFLAGS(b, f) MemAlloc(b, (f), __FILE__, __LINE__) |
|
||||||
#define FREE(p) MemFree(p, 0) |
|
||||||
#define FREEFLAGS(p, f) MemFree(p, (f)) |
|
||||||
#define REALLOC(p, b) MemRealloc(p, b, 0, __FILE__, __LINE__) |
|
||||||
#define REALLOCFLAGS(p, b, f) MemRealloc(p, b, (f), __FILE__, __LINE__) |
|
||||||
#define CALLOC(n, s) MemAlloc((n)*(s), kMemZero, __FILE__, __LINE__) |
|
||||||
#define MEMDUP(s, b) MemDup(s, b, 0, __FILE__, __LINE__) |
|
||||||
#define ZERO(s) MemSet(&s, 0, sizeof(s)) |
|
||||||
#define ZEROPTR(p) MemSet(p, 0, sizeof(*p)) |
|
||||||
// Client must #include <malloc.h>
|
|
||||||
#define ALLOCA(t, n) (t *)_alloca((n) * sizeof(t)) |
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
|
|
||||||
#define NEW(t) new(MemAlloc(sizeof(t), 0, __FILE__, __LINE__)) t |
|
||||||
#define NEWFLAGS(t, f) new(MemAlloc(sizeof(t), (f), __FILE__, __LINE__)) t |
|
||||||
#define NEWZERO(t) new(MemAlloc(sizeof(t), kMemZero, __FILE__, __LINE__)) t |
|
||||||
#define DEL(t) delete (t) |
|
||||||
|
|
||||||
#endif // __cplusplus
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* |
|
||||||
* TypeInfo |
|
||||||
* (needed for memory leak reporting) |
|
||||||
* |
|
||||||
***/ |
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
|
|
||||||
#if !defined(HS_NO_TYPEINFO) |
|
||||||
#include <typeinfo> |
|
||||||
#endif |
|
||||||
|
|
||||||
#endif // ifdef __cplusplus
|
|
||||||
|
|
||||||
#endif // PLASMA20_SOURCES_PLASMA_CORELIB_HSMALLOC_H
|
|
@ -1,369 +0,0 @@ |
|||||||
/*==LICENSE==*
|
|
||||||
|
|
||||||
CyanWorlds.com Engine - MMOG client, server and tools |
|
||||||
Copyright (C) 2011 Cyan Worlds, Inc. |
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify |
|
||||||
it under the terms of the GNU General Public License as published by |
|
||||||
the Free Software Foundation, either version 3 of the License, or |
|
||||||
(at your option) any later version. |
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, |
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
GNU General Public License for more details. |
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License |
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
#ifndef hsQueue_Defined |
|
||||||
#define hsQueue_Defined |
|
||||||
|
|
||||||
#include "hsTypes.h" |
|
||||||
|
|
||||||
template <class T> class hsQueue { |
|
||||||
private: |
|
||||||
|
|
||||||
int fArraySize; |
|
||||||
T *fArray; |
|
||||||
int fHead; // Index of first element in the queue
|
|
||||||
int fTail; // Index of next free spot in the queue
|
|
||||||
int fLook; // Index of look pointer
|
|
||||||
hsBool fFull; // Is queue full?
|
|
||||||
hsBool fEmpty; // Is queue empty?
|
|
||||||
|
|
||||||
void Inc(int *index); |
|
||||||
int Inc(int index); |
|
||||||
|
|
||||||
void Dec(int *index); |
|
||||||
int Dec(int index); |
|
||||||
|
|
||||||
public: |
|
||||||
hsQueue( int size ); |
|
||||||
~hsQueue(); |
|
||||||
hsBool Append(const T &newTail); // Add to end of line
|
|
||||||
hsBool Remove(const T &someElement); // Find and remove element in the line
|
|
||||||
hsBool Pop(T *headElement); // Remove and return the head of the line
|
|
||||||
hsBool StartLook(T *headElement); // Return the head of the line w/out removing it
|
|
||||||
hsBool NextLook(T *nextElement); // Return the head of the line w/out removing it
|
|
||||||
hsBool IsEmpty(void) { return fEmpty; } |
|
||||||
hsBool IsFull(void) { return fFull; } |
|
||||||
}; |
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor
|
|
||||||
// Allocate array, init head/tail indices
|
|
||||||
//
|
|
||||||
template <class T> hsQueue<T>::hsQueue( int size ) |
|
||||||
{ |
|
||||||
fArraySize = size; |
|
||||||
fArray = TRACKED_NEW T[ size ]; |
|
||||||
fHead = -1; |
|
||||||
fTail = -1; |
|
||||||
fLook = -1; |
|
||||||
fEmpty = true; |
|
||||||
fFull = false; |
|
||||||
} |
|
||||||
|
|
||||||
//
|
|
||||||
// Destructor. free array
|
|
||||||
//
|
|
||||||
template <class T> hsQueue<T>::~hsQueue() |
|
||||||
{ |
|
||||||
delete [] fArray; |
|
||||||
} |
|
||||||
|
|
||||||
//
|
|
||||||
// Wrap index on increment
|
|
||||||
//
|
|
||||||
template <class T> void hsQueue<T>::Inc( int *index ) |
|
||||||
{ |
|
||||||
(*index) ++; |
|
||||||
if ((*index) == fArraySize) { |
|
||||||
*index = 0; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
//
|
|
||||||
// Wrap index on increment
|
|
||||||
//
|
|
||||||
template <class T> int hsQueue<T>::Inc( int index ) |
|
||||||
{ |
|
||||||
(index) ++; |
|
||||||
if ((index) == fArraySize) { |
|
||||||
index = 0; |
|
||||||
} |
|
||||||
return index; |
|
||||||
} |
|
||||||
|
|
||||||
//
|
|
||||||
// Wrap index on decrement
|
|
||||||
//
|
|
||||||
template <class T> void hsQueue<T>::Dec( int *index ) |
|
||||||
{ |
|
||||||
(*index) --; |
|
||||||
if ((*index) < 0) { |
|
||||||
*index = fArraySize-1; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
//
|
|
||||||
// Wrap index on decrement
|
|
||||||
//
|
|
||||||
template <class T> int hsQueue<T>::Dec( int index ) |
|
||||||
{ |
|
||||||
(index) --; |
|
||||||
if ((index) < 0) { |
|
||||||
index = fArraySize-1; |
|
||||||
} |
|
||||||
return index; |
|
||||||
} |
|
||||||
|
|
||||||
//
|
|
||||||
// Add copy of item to the array.
|
|
||||||
//
|
|
||||||
template <class T> hsBool hsQueue<T>::Append(const T &thing) |
|
||||||
{ |
|
||||||
if (fHead == -1 && fTail == -1) { |
|
||||||
// init case
|
|
||||||
fHead = 0; |
|
||||||
fTail = 0; |
|
||||||
} |
|
||||||
|
|
||||||
if (fFull) { |
|
||||||
// Queue is full
|
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
if ( (fHead<0 || fHead>=fArraySize) ) { |
|
||||||
hsIfDebugMessage( (fHead<0 || fHead>=fArraySize), "Append: Illegal head pointer", fHead);
|
|
||||||
} |
|
||||||
|
|
||||||
hsIfDebugMessage( (fTail<0 || fTail>=fArraySize), "Append: Illegal tail pointer", fTail); |
|
||||||
|
|
||||||
// Copy
|
|
||||||
fArray[fTail] = thing; |
|
||||||
fEmpty = false; |
|
||||||
|
|
||||||
// increment tail pointer
|
|
||||||
Inc(&fTail); |
|
||||||
if (fTail == fHead) { |
|
||||||
fFull = true; |
|
||||||
} |
|
||||||
|
|
||||||
return true;
|
|
||||||
} |
|
||||||
|
|
||||||
//
|
|
||||||
// Get a copy of the head of the array
|
|
||||||
//
|
|
||||||
template <class T> hsBool hsQueue<T>::Pop(T *thing) |
|
||||||
{ |
|
||||||
if (fEmpty) { |
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
hsIfDebugMessage( (fHead<0 || fHead>=fArraySize), "Pop: Illegal head pointer", fHead); |
|
||||||
hsIfDebugMessage( (fTail<0 || fTail>=fArraySize), "Pop: Illegal tail pointer", fTail); |
|
||||||
|
|
||||||
// Copy
|
|
||||||
*thing = fArray[fHead]; |
|
||||||
fFull = false; |
|
||||||
|
|
||||||
// Increment head pointer
|
|
||||||
Inc(&fHead); |
|
||||||
if (fHead == fTail) { |
|
||||||
fEmpty = true; |
|
||||||
}
|
|
||||||
|
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
//
|
|
||||||
// Remove item from list
|
|
||||||
//
|
|
||||||
template <class T> hsBool hsQueue<T>::Remove(const T &thing) |
|
||||||
{ |
|
||||||
if (fEmpty) { |
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
hsIfDebugMessage( (fHead<0 || fHead>=fArraySize), "Remove: Illegal head pointer", fHead); |
|
||||||
hsIfDebugMessage( (fTail<0 || fTail>=fArraySize), "Remove: Illegal tail pointer", fTail); |
|
||||||
|
|
||||||
// loop through list, find item
|
|
||||||
int i = fHead; |
|
||||||
do { |
|
||||||
if (fArray[i] == thing) { |
|
||||||
// Found it - now remove it by sliding everything down 1
|
|
||||||
int j=Inc(i); |
|
||||||
while(j!= fTail) { |
|
||||||
if (fLook==j) |
|
||||||
Dec(&fLook); |
|
||||||
fArray[Dec(j)] = fArray[j]; |
|
||||||
Inc(&j); |
|
||||||
} |
|
||||||
if (fLook==fTail) |
|
||||||
Dec(&fLook); |
|
||||||
Dec(&fTail); |
|
||||||
if (fTail == fHead) { |
|
||||||
fEmpty = true; |
|
||||||
} |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
Inc(&i); |
|
||||||
if (i==fTail) { |
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
} while(true); |
|
||||||
} |
|
||||||
|
|
||||||
//
|
|
||||||
// Return pointer to first item in list, without popping it.
|
|
||||||
// Return false if nothing there.
|
|
||||||
//
|
|
||||||
template <class T> hsBool hsQueue<T>::StartLook(T *thing) |
|
||||||
{ |
|
||||||
if (fEmpty) { |
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
hsIfDebugMessage( (fHead<0 || fHead>=fArraySize), "StartLook: Illegal head pointer", fHead); |
|
||||||
hsIfDebugMessage( (fTail<0 || fTail>=fArraySize), "StartLook: Illegal tail pointer", fTail); |
|
||||||
|
|
||||||
fLook = fHead; |
|
||||||
*thing = fArray[fLook]; |
|
||||||
|
|
||||||
// inc look pointer
|
|
||||||
Inc(&fLook); |
|
||||||
|
|
||||||
// success
|
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
//
|
|
||||||
// Return pointer to next item in list, without popping it. Doesn't change head or tail.
|
|
||||||
// Should be called immediately after StartLook.
|
|
||||||
// Return false when at end of list.
|
|
||||||
//
|
|
||||||
template <class T> hsBool hsQueue<T>::NextLook(T *thing) |
|
||||||
{ |
|
||||||
if (fEmpty || fLook == fTail) { |
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
hsAssert(fLook != -1, "Must call StartLook first\n"); |
|
||||||
hsIfDebugMessage( (fHead<0 || fHead>=fArraySize), "NextLook: Illegal head pointer", fHead); |
|
||||||
hsIfDebugMessage( (fTail<0 || fTail>=fArraySize), "NextLook: Illegal tail pointer", fTail); |
|
||||||
|
|
||||||
// Return copy of item without removing it
|
|
||||||
*thing = fArray[fLook];
|
|
||||||
Inc(&fLook); |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Code for threaded message queues - move to another file
|
|
||||||
//
|
|
||||||
#ifdef MQUEUE |
|
||||||
|
|
||||||
#include "hsThread.h" |
|
||||||
#if HS_BUILD_FOR_UNIX |
|
||||||
#include <mqueue.h> |
|
||||||
#endif |
|
||||||
|
|
||||||
class hsListQue { |
|
||||||
public: |
|
||||||
struct Elem { |
|
||||||
Elem* fNext; |
|
||||||
}; |
|
||||||
private: |
|
||||||
Elem* fHead; |
|
||||||
Elem* fTail; |
|
||||||
int fCount; |
|
||||||
public: |
|
||||||
hsListQue(); |
|
||||||
virtual ~hsListQue(); |
|
||||||
|
|
||||||
virtual int Count(); |
|
||||||
virtual void Enqueue(Elem* newItem); |
|
||||||
virtual Elem* Dequeue(); |
|
||||||
}; |
|
||||||
|
|
||||||
class hsMutexQueue : public hsListQue { |
|
||||||
hsMutex fMutex; |
|
||||||
public: |
|
||||||
hsMutexQueue() {} |
|
||||||
|
|
||||||
virtual int Count(); |
|
||||||
virtual void Enqueue(Elem* newItem); |
|
||||||
virtual Elem* Dequeue(); // will return nil if the queue is empty
|
|
||||||
}; |
|
||||||
|
|
||||||
class hsSemaphoreQueue : public hsMutexQueue { |
|
||||||
hsSemaphore fSema; |
|
||||||
public: |
|
||||||
hsSemaphoreQueue() {} |
|
||||||
|
|
||||||
virtual void Enqueue(Elem* newItem); |
|
||||||
virtual Elem* Dequeue(); // never returns nil, it just waits
|
|
||||||
}; |
|
||||||
|
|
||||||
class hsMsgQueue { |
|
||||||
int fMaxSize; |
|
||||||
#if HS_BUILD_FOR_UNIX |
|
||||||
mqd_t fMQ; |
|
||||||
#else |
|
||||||
class hsPrivateMQ* fMQ; |
|
||||||
UInt32 fAccess; |
|
||||||
#endif |
|
||||||
public: |
|
||||||
enum { |
|
||||||
kRead = 0x0001, |
|
||||||
kWrite = 0x0002, |
|
||||||
kBlock = 0x0004 |
|
||||||
}; |
|
||||||
|
|
||||||
hsMsgQueue(); |
|
||||||
virtual ~hsMsgQueue(); |
|
||||||
|
|
||||||
hsBool Create(const char name[], int maxSize, UInt32 access); |
|
||||||
hsBool Open(const char name[], UInt32 access); |
|
||||||
void Close(); |
|
||||||
|
|
||||||
int GetMaxSize() const { return fMaxSize; } |
|
||||||
hsBool Send(const void* data, int size = 0); |
|
||||||
int Receive(void* data); // returns actual size or 0
|
|
||||||
|
|
||||||
static void Delete(const char name[]); |
|
||||||
}; |
|
||||||
#endif // MQUEUE
|
|
||||||
|
|
||||||
#endif |
|
||||||
|
|
@ -1,200 +0,0 @@ |
|||||||
/*==LICENSE==*
|
|
||||||
|
|
||||||
CyanWorlds.com Engine - MMOG client, server and tools |
|
||||||
Copyright (C) 2011 Cyan Worlds, Inc. |
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify |
|
||||||
it under the terms of the GNU General Public License as published by |
|
||||||
the Free Software Foundation, either version 3 of the License, or |
|
||||||
(at your option) any later version. |
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, |
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
GNU General Public License for more details. |
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License |
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
#ifndef hsScalarMacrosDefined |
|
||||||
#define hsScalarMacrosDefined |
|
||||||
|
|
||||||
#include "hsFixedTypes.h" |
|
||||||
|
|
||||||
#ifndef HS_SCALAR_IS_FLOAT |
|
||||||
#define HS_SCALAR_IS_FIXED 0 |
|
||||||
#define HS_SCALAR_IS_FLOAT 1 |
|
||||||
#define HS_NEVER_USE_FLOAT 0 |
|
||||||
#endif |
|
||||||
|
|
||||||
#if HS_SCALAR_IS_FLOAT && HS_NEVER_USE_FLOAT |
|
||||||
#error "can't define HS_SCALAR_IS_FLOAT and HS_NEVER_USE_FLOAT" |
|
||||||
#endif |
|
||||||
|
|
||||||
#if HS_SCALAR_IS_FLOAT |
|
||||||
#include <math.h> |
|
||||||
#endif |
|
||||||
|
|
||||||
#define hsScalarDegToRad(deg) hsScalarMul(deg, hsScalarPI / 180) |
|
||||||
#define hsScalarRadToDeg(rad) hsScalarMul(rad, 180 / hsScalarPI) |
|
||||||
|
|
||||||
#if HS_SCALAR_IS_FIXED |
|
||||||
typedef hsFixed hsScalar; |
|
||||||
|
|
||||||
#define hsScalar1 hsFixed1 |
|
||||||
#define hsScalarHalf (hsFixed1 >> 1) |
|
||||||
#define hsScalarPI (hsFixedPI) |
|
||||||
#define hsScalarMax (0x7fffffff) |
|
||||||
|
|
||||||
#if HS_CAN_USE_FLOAT |
|
||||||
#define hsFloatToScalar(x) hsFixed((x) * float(hsFixed1)) |
|
||||||
#define hsScalarToFloat(x) ((x) / float(hsFixed1)) |
|
||||||
#endif |
|
||||||
|
|
||||||
#define hsIntToScalar(x) hsIntToFixed(x) |
|
||||||
#define hsScalarToInt(x) hsFixedToInt(x) |
|
||||||
#define hsScalarRound(x) hsFixedRound(x) |
|
||||||
|
|
||||||
#define hsFixedToScalar(x) (x) |
|
||||||
#define hsScalarToFixed(x) (x) |
|
||||||
|
|
||||||
#define hsFractToScalar(x) hsFractToFixed(x) |
|
||||||
#define hsScalarToFract(x) hsFixedToFract(x) |
|
||||||
|
|
||||||
#define hsScalarMul(a, b) hsFixMul(a, b) |
|
||||||
#define hsScalarMul2(a) ((a) << 1) |
|
||||||
#define hsScalarDiv(a, b) hsFixDiv(a, b) |
|
||||||
#define hsScalarDiv2(a) ((a) >> 1) |
|
||||||
#define hsScalarInvert(a) hsFixDiv(hsFixed1, a) |
|
||||||
#define hsScalarMod(a,b) ((a) % (b)) |
|
||||||
#define hsScalarMulDiv(n1, n2, d) hsMulDiv32(n1, n2, d) |
|
||||||
#define hsScalarMulAdd(a, b, c) (hsFixMul(a, b) + (c)) |
|
||||||
|
|
||||||
#define hsSquareRoot(scalar) hsFixSqrt(scalar) |
|
||||||
#define hsSine(angle) hsFixedSin(angle) |
|
||||||
#define hsCosine(angle) hsFixedCos(angle) |
|
||||||
#define hsTan(angle) (hsSine(angle)/hsCosine(angle)) |
|
||||||
#define hsASine(value) hsFixedASin(value) |
|
||||||
#define hsACosine(value) hsFixedACos(value) |
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
inline hsScalar hsScalarAverage(hsScalar a, hsScalar b) { return a + b >> 1; } |
|
||||||
inline hsScalar hsScalarAverage(hsScalar a, hsScalar b, hsScalar t) |
|
||||||
{ |
|
||||||
return a + hsFixMul(t, b - a); |
|
||||||
} |
|
||||||
|
|
||||||
#if HS_CAN_USE_FLOAT |
|
||||||
inline hsScalar hsPow(hsScalar base, hsScalar exponent) |
|
||||||
{ |
|
||||||
return hsFloatToScalar(powf(hsScalarToFloat(base), hsScalarToFloat(exponent))); |
|
||||||
} |
|
||||||
inline hsScalar hsATan2(hsScalar y, hsScalar x) |
|
||||||
{ |
|
||||||
return hsFloatToScalar(atan2f(hsScalarToFloat(y), hsScalarToFloat(x))); |
|
||||||
} |
|
||||||
#endif |
|
||||||
inline hsScalar hsCeil(hsScalar x) { return (x + 0xFFFF) & 0xFFFF0000; } |
|
||||||
inline hsScalar hsFloor(hsScalar x) { return x & 0xFFFF0000; } |
|
||||||
#endif |
|
||||||
#endif |
|
||||||
#if HS_SCALAR_IS_FLOAT |
|
||||||
typedef float hsScalar; |
|
||||||
|
|
||||||
#define hsScalar1 float(1) |
|
||||||
#define hsScalarHalf float(0.5) |
|
||||||
#define hsScalarPI float(HS_PI) |
|
||||||
#define hsScalarMax float(3.402823466e+38F) |
|
||||||
|
|
||||||
#define hsFloatToScalar(x) float(x) |
|
||||||
#define hsScalarToFloat(x) float(x) |
|
||||||
|
|
||||||
#define hsIntToScalar(x) float(x) |
|
||||||
#define hsScalarToInt(x) Int32(x) |
|
||||||
|
|
||||||
|
|
||||||
#define hsFixedToScalar(x) ((hsScalar)(x) / float(hsFixed1)) |
|
||||||
#define hsScalarToFixed(x) hsFixed((x) * float(hsFixed1)) |
|
||||||
|
|
||||||
#define hsFractToScalar(x) ((x) / float(hsFract1)) |
|
||||||
#define hsScalarToFract(x) hsFract((x) * float(hsFract1)) |
|
||||||
#ifdef __cplusplus |
|
||||||
|
|
||||||
#define hsScalarMod(a,b) fmodf(a, b) |
|
||||||
#define hsScalarMulAdd(a, b, c) ((a) * (b) + (c)) |
|
||||||
#define hsScalarMul(a,b) ((a) * (b)) |
|
||||||
#define hsScalarMul2(a) ((a) * 2) |
|
||||||
#define hsScalarDiv(a,b) ((a) / (b)) |
|
||||||
#define hsScalarDiv2(a) ((a) * float(0.5)) |
|
||||||
#define hsScalarInvert(a) (float(1) / (a)) |
|
||||||
#define hsScalarMulDiv(n1,n2,d) ((n1) * (n2) / (d)) |
|
||||||
|
|
||||||
#ifndef HS_DEBUGGING /* mf horse testing defines vs inlines for VC++5.0 performance */ |
|
||||||
|
|
||||||
#define hsScalarRound(x) Int32((x) + ((x) < 0 ? -hsScalarHalf : hsScalarHalf)) |
|
||||||
|
|
||||||
#else /* HS_DEBUGGING - use inlines for type-checking etc...and all */ |
|
||||||
inline Int32 hsScalarRound(float x) |
|
||||||
{ |
|
||||||
float half = hsScalarHalf; |
|
||||||
if (x < 0) |
|
||||||
half = -half; |
|
||||||
return Int32(x + half); |
|
||||||
} |
|
||||||
#endif /* HS_DEBUGGING - use inlines for type-checking etc...and all */ |
|
||||||
|
|
||||||
inline float hsScalarAverage(float a, float b) { return (a + b) * float(0.5); } |
|
||||||
inline float hsScalarAverage(float a, float b, float t) { return a + t * (b - a); } |
|
||||||
|
|
||||||
inline hsScalar hsSquareRoot(hsScalar scalar) { return sqrtf(scalar); } |
|
||||||
inline hsScalar hsSine(hsScalar angle) { return sinf(angle); } |
|
||||||
inline hsScalar hsCosine(hsScalar angle) { return cosf(angle); } |
|
||||||
inline hsScalar hsTan(hsScalar rads) { return tanf(rads); } |
|
||||||
inline hsScalar hsASine(hsScalar value) { return asinf(value); } |
|
||||||
inline hsScalar hsACosine(hsScalar value) { return acosf(value); } |
|
||||||
inline hsScalar hsPow(hsScalar base, hsScalar exponent) { return powf(base, exponent); } |
|
||||||
inline hsScalar hsATan2(hsScalar y, hsScalar x) { return atan2f(y, x); } |
|
||||||
inline hsScalar hsCeil(hsScalar x) { return ceilf(x); } |
|
||||||
inline hsScalar hsFloor(hsScalar x) { return floorf(x); } |
|
||||||
#endif /* HS_SCALAR_IS_FLOAT */ |
|
||||||
#endif /* __CPLUSPLUS */ |
|
||||||
|
|
||||||
//
|
|
||||||
// Macros for enabling double precision math ops
|
|
||||||
// require #include <float.h>
|
|
||||||
//
|
|
||||||
#if HS_BUILD_FOR_WIN32 |
|
||||||
#define hsDoublePrecBegin \ |
|
||||||
unsigned int fpc=_controlfp( 0, 0); \
|
|
||||||
_controlfp( _PC_64, MCW_PC );
|
|
||||||
#define hsDoublePrecEnd \ |
|
||||||
_controlfp( fpc, 0xfffff );
|
|
||||||
#else |
|
||||||
#define hsDoublePrecBegin |
|
||||||
#define hsDoublePrecEnd |
|
||||||
#endif |
|
||||||
|
|
||||||
#endif |
|
@ -1,174 +0,0 @@ |
|||||||
/*==LICENSE==*
|
|
||||||
|
|
||||||
CyanWorlds.com Engine - MMOG client, server and tools |
|
||||||
Copyright (C) 2011 Cyan Worlds, Inc. |
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify |
|
||||||
it under the terms of the GNU General Public License as published by |
|
||||||
the Free Software Foundation, either version 3 of the License, or |
|
||||||
(at your option) any later version. |
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, |
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
GNU General Public License for more details. |
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License |
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
|
|
||||||
#ifndef hsTempPointer_inc |
|
||||||
#define hsTempPointer_inc |
|
||||||
|
|
||||||
#include "hsMemory.h" |
|
||||||
#include "hsExceptions.h" |
|
||||||
|
|
||||||
template <class T> class hsTempPointer { |
|
||||||
private: |
|
||||||
T** fArray; |
|
||||||
|
|
||||||
UInt32 fCurrBlock; |
|
||||||
UInt32 fNumBlockAlloc; |
|
||||||
|
|
||||||
UInt32 fCurrElem; |
|
||||||
UInt32 fNumElemAlloc; |
|
||||||
|
|
||||||
UInt32 fGrowBy; // def = 0, to double
|
|
||||||
UInt32 fMinSize; // def = 1
|
|
||||||
|
|
||||||
hsTempPointer<T>& operator=(const hsTempPointer<T>&); |
|
||||||
|
|
||||||
void IConsolidate(); |
|
||||||
void IGrow(); |
|
||||||
|
|
||||||
public: |
|
||||||
hsTempPointer(UInt32 minSize = 1, UInt32 growBy = 0); |
|
||||||
~hsTempPointer(); |
|
||||||
|
|
||||||
void Reset(); |
|
||||||
|
|
||||||
T* Next(); |
|
||||||
T* Array(int n); |
|
||||||
}; |
|
||||||
|
|
||||||
template <class T> |
|
||||||
hsTempPointer<T>::~hsTempPointer() |
|
||||||
{ |
|
||||||
int i; |
|
||||||
for( i = 0; i <= fCurrBlock; i++ ) |
|
||||||
delete [] fArray[i]; |
|
||||||
delete [] fArray; |
|
||||||
} |
|
||||||
|
|
||||||
template <class T> |
|
||||||
hsTempPointer<T>::hsTempPointer(UInt32 minSize, UInt32 growBy) |
|
||||||
{ |
|
||||||
fGrowBy = growBy; |
|
||||||
fMinSize = minSize; |
|
||||||
|
|
||||||
fArray = TRACKED_NEW T*[2]; |
|
||||||
fNumBlockAlloc = 2; |
|
||||||
fCurrBlock = 0; |
|
||||||
|
|
||||||
fArray[fCurrBlock] = TRACKED_NEW T[fMinSize]; |
|
||||||
fNumElemAlloc = minSize; |
|
||||||
|
|
||||||
fCurrElem = 0; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
template <class T> |
|
||||||
void hsTempPointer<T>::IConsolidate() |
|
||||||
{ |
|
||||||
hsAssert(fCurrBlock > 0, "Shouldn't consolidate when nothing to do"); |
|
||||||
|
|
||||||
UInt32 numUsed = fCurrBlock * fNumElemAlloc + fCurrElem; |
|
||||||
|
|
||||||
UInt32 newSize = fNumElemAlloc; |
|
||||||
if( !fGrowBy ) |
|
||||||
{ |
|
||||||
while( newSize <= numUsed ) |
|
||||||
newSize <<= 1; |
|
||||||
} |
|
||||||
else |
|
||||||
{ |
|
||||||
while( newSize <= numUsed ) |
|
||||||
newSize += fGrowBy; |
|
||||||
} |
|
||||||
int i; |
|
||||||
for( i = 0; i <= fCurrBlock; i++ ) |
|
||||||
delete [] fArray[i]; |
|
||||||
|
|
||||||
fArray[0] = TRACKED_NEW T[newSize]; |
|
||||||
fNumElemAlloc = newSize; |
|
||||||
fCurrElem = 0; |
|
||||||
fCurrBlock = 0; |
|
||||||
} |
|
||||||
|
|
||||||
template <class T> |
|
||||||
void hsTempPointer<T>::IGrow() |
|
||||||
{ |
|
||||||
if( ++fCurrBlock >= fNumBlockAlloc ) |
|
||||||
{ |
|
||||||
T** newBlockArray = TRACKED_NEW T*[fNumBlockAlloc <<= 1]; |
|
||||||
HSMemory::BlockMove(fArray, newBlockArray, fCurrBlock * sizeof(*fArray)); |
|
||||||
delete [] fArray; |
|
||||||
fArray = newBlockArray; |
|
||||||
} |
|
||||||
fArray[fCurrBlock] = TRACKED_NEW T[fNumElemAlloc]; |
|
||||||
fCurrElem = 0; |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
template <class T> |
|
||||||
T* hsTempPointer<T>::Next() |
|
||||||
{ |
|
||||||
if( fCurrElem >= fNumElemAlloc ) |
|
||||||
IGrow(); |
|
||||||
return fArray[fCurrBlock] + fCurrElem++; |
|
||||||
} |
|
||||||
|
|
||||||
template <class T> |
|
||||||
T* hsTempPointer<T>::Array(int n) |
|
||||||
{ |
|
||||||
// minSize (on constructor) should be greater than max n
|
|
||||||
hsDebugCode(hsThrowIfBadParam((UInt32)n > (UInt32)fNumElemAlloc);) |
|
||||||
if( fCurrElem + n >= fNumElemAlloc ) |
|
||||||
IGrow(); |
|
||||||
int idx = fCurrElem; |
|
||||||
fCurrElem += n; |
|
||||||
return fArray[fCurrBlock] + idx; |
|
||||||
} |
|
||||||
|
|
||||||
template <class T> |
|
||||||
void hsTempPointer<T>::Reset() |
|
||||||
{ |
|
||||||
if( fCurrBlock > 0 ) |
|
||||||
IConsolidate(); |
|
||||||
fCurrElem = 0; |
|
||||||
} |
|
||||||
|
|
||||||
#endif // hsTempPointer_inc
|
|
@ -1,54 +0,0 @@ |
|||||||
/*==LICENSE==*
|
|
||||||
|
|
||||||
CyanWorlds.com Engine - MMOG client, server and tools |
|
||||||
Copyright (C) 2011 Cyan Worlds, Inc. |
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify |
|
||||||
it under the terms of the GNU General Public License as published by |
|
||||||
the Free Software Foundation, either version 3 of the License, or |
|
||||||
(at your option) any later version. |
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, |
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
GNU General Public License for more details. |
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License |
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Additional permissions under GNU GPL version 3 section 7 |
|
||||||
|
|
||||||
If you modify this Program, or any covered work, by linking or |
|
||||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
|
||||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
|
||||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
|
||||||
(or a modified version of those libraries), |
|
||||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
|
||||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
|
||||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
|
||||||
licensors of this Program grant you additional |
|
||||||
permission to convey the resulting work. Corresponding Source for a |
|
||||||
non-source form of such a combination shall include the source code for |
|
||||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
|
||||||
work. |
|
||||||
|
|
||||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
||||||
or by snail mail at: |
|
||||||
Cyan Worlds, Inc. |
|
||||||
14617 N Newport Hwy |
|
||||||
Mead, WA 99021 |
|
||||||
|
|
||||||
*==LICENSE==*/ |
|
||||||
#ifndef HSWINDOWHNDL_inc |
|
||||||
#define HSWINDOWHNDL_inc |
|
||||||
|
|
||||||
#include "HeadSpin.h" |
|
||||||
|
|
||||||
// decide what hsWindowHndl is
|
|
||||||
#if HS_BUILD_FOR_WIN32 |
|
||||||
typedef struct HWND__ * hsWindowHndl; |
|
||||||
#elif HS_BUILD_FOR_UNIX |
|
||||||
typedef int* hsWindowHndl; |
|
||||||
#endif |
|
||||||
|
|
||||||
#endif |
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue