mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
@ -169,7 +169,7 @@ static plAudioSystem* gAudio = nil;
|
||||
extern ITaskbarList3* gTaskbarList;
|
||||
#endif
|
||||
|
||||
hsBool plClient::fDelayMS = false;
|
||||
bool plClient::fDelayMS = false;
|
||||
|
||||
plClient* plClient::fInstance=nil;
|
||||
|
||||
@ -255,7 +255,7 @@ plClient::~plClient()
|
||||
#include "plGImage/plAVIWriter.h"
|
||||
#include "pfCharacter/pfMarkerMgr.h"
|
||||
|
||||
hsBool plClient::Shutdown()
|
||||
bool plClient::Shutdown()
|
||||
{
|
||||
plSynchEnabler ps(false); // disable dirty state tracking during shutdown
|
||||
delete fProgressBar;
|
||||
@ -482,7 +482,7 @@ void plClient::ISetGraphicsDefaults()
|
||||
plDynamicCamMap::SetEnabled(plPipeline::fDefaultPipeParams.PlanarReflections ? true : false);
|
||||
}
|
||||
|
||||
hsBool plClient::InitPipeline()
|
||||
bool plClient::InitPipeline()
|
||||
{
|
||||
hsStatusMessage("InitPipeline client\n");
|
||||
HWND hWnd = fWindowHndl;
|
||||
@ -615,7 +615,7 @@ void plClient::IDispatchMsgReceiveCallback()
|
||||
|
||||
|
||||
//============================================================================
|
||||
hsBool plClient::MsgReceive(plMessage* msg)
|
||||
bool plClient::MsgReceive(plMessage* msg)
|
||||
{
|
||||
if (plGenRefMsg * genRefMsg = plGenRefMsg::ConvertNoRef(msg)) {
|
||||
// do nothing, we just use the client's key to ref vault image nodes.
|
||||
@ -658,7 +658,7 @@ hsBool plClient::MsgReceive(plMessage* msg)
|
||||
if (pRefMsg->GetContext() & plRefMsg::kOnCreate ||
|
||||
pRefMsg->GetContext() & plRefMsg::kOnRequest)
|
||||
{
|
||||
hsBool found=false;
|
||||
bool found=false;
|
||||
plSceneNode *pNode = plSceneNode::ConvertNoRef(pRefMsg->GetRef());
|
||||
int i;
|
||||
for (i = 0; i < fRooms.Count(); i++)
|
||||
@ -876,7 +876,7 @@ hsBool plClient::MsgReceive(plMessage* msg)
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
hsBool plClient::IHandleMovieMsg(plMovieMsg* mov)
|
||||
bool plClient::IHandleMovieMsg(plMovieMsg* mov)
|
||||
{
|
||||
if( !(mov->GetFileName() && *mov->GetFileName()) )
|
||||
return true;
|
||||
@ -1015,7 +1015,7 @@ void plClient::IQueueRoomLoad(const std::vector<plLocation>& locs, bool hold)
|
||||
|
||||
fLoadRooms.push_back(new LoadRequest(loc, hold));
|
||||
|
||||
if (!lastAgeName || hsStrEQ(info->GetAge(), lastAgeName))
|
||||
if (!lastAgeName || strcmp(info->GetAge(), lastAgeName) == 0)
|
||||
lastAgeName = info->GetAge();
|
||||
else
|
||||
allSameAge = false;
|
||||
@ -1040,7 +1040,7 @@ void plClient::ILoadNextRoom()
|
||||
fLoadRooms.pop_front();
|
||||
|
||||
bool alreadyLoaded = (IFindRoomByLoc(req->loc) != -1);
|
||||
hsBool isLoading = IIsRoomLoading(req->loc);
|
||||
bool isLoading = IIsRoomLoading(req->loc);
|
||||
if (alreadyLoaded || isLoading)
|
||||
{
|
||||
delete req;
|
||||
@ -1152,7 +1152,7 @@ void plClient::IRoomLoaded(plSceneNode* node, bool hold)
|
||||
{
|
||||
fCurrentNode = node;
|
||||
// make sure we don't already have this room in the list:
|
||||
hsBool bAppend = true;
|
||||
bool bAppend = true;
|
||||
for (int i = 0; i < fRooms.Count(); i++)
|
||||
{
|
||||
if (fRooms[i].fNode == fCurrentNode)
|
||||
@ -1208,7 +1208,7 @@ void plClient::IRoomLoaded(plSceneNode* node, bool hold)
|
||||
int numMsgs = 0;
|
||||
for (int i = 0; i < sizeof(ageMsgCount)/sizeof(AgeMsgCount); i++)
|
||||
{
|
||||
if (hsStrEQ(ageMsgCount[i].AgeName, name))
|
||||
if (strcmp(ageMsgCount[i].AgeName, name) == 0)
|
||||
{
|
||||
numMsgs = ageMsgCount[i].NumMsgs;
|
||||
break;
|
||||
@ -1397,7 +1397,7 @@ void plClient::IStopProgress( void )
|
||||
*
|
||||
***/
|
||||
|
||||
extern hsBool gDataServerLocal;
|
||||
extern bool gDataServerLocal;
|
||||
|
||||
#include "plQuality.h"
|
||||
#include "plLoadMask.h"
|
||||
@ -1470,7 +1470,7 @@ private:
|
||||
#endif
|
||||
|
||||
//============================================================================
|
||||
hsBool plClient::StartInit()
|
||||
bool plClient::StartInit()
|
||||
{
|
||||
hsStatusMessage("Init client\n");
|
||||
fFlags.SetBit( kFlagIniting );
|
||||
@ -1669,7 +1669,7 @@ void plClient::ShutdownDLLs()
|
||||
fLoadedDLLs.Reset();
|
||||
}
|
||||
|
||||
hsBool plClient::MainLoop()
|
||||
bool plClient::MainLoop()
|
||||
{
|
||||
#if defined(HAVE_CYPYTHONIDE) && !defined(PLASMA_EXTERNAL_RELEASE)
|
||||
if (PythonInterface::UsePythonDebugger())
|
||||
@ -1745,7 +1745,7 @@ plProfile_CreateTimer("ScreenElem", "Render", ScreenElem);
|
||||
plProfile_CreateTimer("EndRender", "Render", EndRender);
|
||||
|
||||
|
||||
hsBool plClient::IUpdate()
|
||||
bool plClient::IUpdate()
|
||||
{
|
||||
plProfile_BeginTiming(UpdateTime);
|
||||
|
||||
@ -1839,7 +1839,7 @@ hsBool plClient::IUpdate()
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool plClient::IDrawProgress() {
|
||||
bool plClient::IDrawProgress() {
|
||||
// HACK: Don't draw while we're caching some room loads, otherwise the
|
||||
// progress bar will jump around while we're calculating the size
|
||||
if (fHoldLoadRequests)
|
||||
@ -1871,7 +1871,7 @@ hsBool plClient::IDrawProgress() {
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool plClient::IDraw()
|
||||
bool plClient::IDraw()
|
||||
{
|
||||
// If we're shutting down, don't attempt to draw. Doing so
|
||||
// tends to cause a device reload each frame.
|
||||
@ -1990,7 +1990,7 @@ void plClient::IKillMovies()
|
||||
fMovies.Reset();
|
||||
}
|
||||
|
||||
hsBool plClient::IPlayIntroBink(const char* movieName, float endDelay, float posX, float posY, float scaleX, float scaleY, float volume /* = 1.0 */)
|
||||
bool plClient::IPlayIntroBink(const char* movieName, float endDelay, float posX, float posY, float scaleX, float scaleY, float volume /* = 1.0 */)
|
||||
{
|
||||
SetQuitIntro(false);
|
||||
plBinkPlayer player;
|
||||
@ -2022,7 +2022,7 @@ hsBool plClient::IPlayIntroBink(const char* movieName, float endDelay, float pos
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool done = false;
|
||||
bool done = false;
|
||||
if( !fPipeline->BeginRender() )
|
||||
{
|
||||
fPipeline->ClearRenderTarget();
|
||||
@ -2039,7 +2039,7 @@ hsBool plClient::IPlayIntroBink(const char* movieName, float endDelay, float pos
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool plClient::IFlushRenderRequests()
|
||||
bool plClient::IFlushRenderRequests()
|
||||
{
|
||||
// For those requesting ack's, we could go through and send them
|
||||
// mail telling them their request was ill-timed. But hopefully,
|
||||
@ -2109,7 +2109,7 @@ hsG3DDeviceModeRecord plClient::ILoadDevMode(const char* devModeFile)
|
||||
HWND hWnd = fWindowHndl;
|
||||
|
||||
hsUNIXStream stream;
|
||||
hsBool gottaCreate = false;
|
||||
bool gottaCreate = false;
|
||||
|
||||
// If DevModeFind is specified, use the old method
|
||||
// if ((GetGameFlags() & kDevModeFind))
|
||||
@ -2175,7 +2175,7 @@ hsG3DDeviceModeRecord plClient::ILoadDevMode(const char* devModeFile)
|
||||
return dmr;
|
||||
}
|
||||
|
||||
void plClient::ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync)
|
||||
void plClient::ResetDisplayDevice(int Width, int Height, int ColorDepth, bool Windowed, int NumAASamples, int MaxAnisotropicSamples, bool VSync)
|
||||
{
|
||||
if(!fPipeline) return;
|
||||
|
||||
@ -2188,7 +2188,7 @@ void plClient::ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool
|
||||
WindowActivate(true);
|
||||
}
|
||||
|
||||
void plClient::ResizeDisplayDevice(int Width, int Height, hsBool Windowed)
|
||||
void plClient::ResizeDisplayDevice(int Width, int Height, bool Windowed)
|
||||
{
|
||||
|
||||
if (plMouseDevice::Instance())
|
||||
@ -2231,7 +2231,7 @@ void plClient::ResizeDisplayDevice(int Width, int Height, hsBool Windowed)
|
||||
SetWindowPos( fWindowHndl, insertAfter, 0, 0, OutsideWidth, OutsideHeight, flags );
|
||||
}
|
||||
|
||||
void WriteBool(hsStream *stream, char *name, hsBool on )
|
||||
void WriteBool(hsStream *stream, char *name, bool on )
|
||||
{
|
||||
char command[256];
|
||||
sprintf(command, "%s %s\r\n", name, on ? "true" : "false");
|
||||
@ -2256,7 +2256,7 @@ void WriteString(hsStream *stream, const char *name, const char *val)
|
||||
void plClient::IDetectAudioVideoSettings()
|
||||
{
|
||||
// Setup default pipeline settings
|
||||
hsBool devmode = true;
|
||||
bool devmode = true;
|
||||
hsG3DDeviceModeRecord dmr;
|
||||
hsG3DDeviceSelector devSel;
|
||||
devSel.Enumerate(fWindowHndl);
|
||||
@ -2267,10 +2267,10 @@ void plClient::IDetectAudioVideoSettings()
|
||||
hsG3DDeviceRecord *rec = (hsG3DDeviceRecord *)dmr.GetDevice();
|
||||
const hsG3DDeviceMode *mode = dmr.GetMode();
|
||||
|
||||
hsBool pixelshaders = rec->GetCap(hsG3DDeviceSelector::kCapsPixelShader);
|
||||
bool pixelshaders = rec->GetCap(hsG3DDeviceSelector::kCapsPixelShader);
|
||||
int psMajor = 0, psMinor = 0;
|
||||
rec->GetPixelShaderVersion(psMajor, psMinor);
|
||||
hsBool refDevice = false;
|
||||
bool refDevice = false;
|
||||
if(rec->GetG3DHALorHEL() == hsG3DDeviceSelector::kHHD3DRefDev)
|
||||
refDevice = true;
|
||||
|
||||
@ -2367,18 +2367,13 @@ void plClient::IDetectAudioVideoSettings()
|
||||
stream = plEncryptedStream::OpenEncryptedFileWrite(audioIniFile);
|
||||
|
||||
plAudioCaps caps = plAudioCapsDetector::Detect(false, true);
|
||||
val = 6;
|
||||
if( (hsPhysicalMemory() < 256) || plProfileManager::Instance().GetProcessorSpeed() < 1350000000)
|
||||
{
|
||||
val = 3;
|
||||
}
|
||||
|
||||
char deviceName[256];
|
||||
sprintf(deviceName, "\"%s\"", DEFAULT_AUDIO_DEVICE_NAME);
|
||||
|
||||
WriteBool(stream, "Audio.Initialize", caps.IsAvailable());
|
||||
WriteBool(stream, "Audio.UseEAX", false);
|
||||
WriteInt(stream, "Audio.SetPriorityCutoff", val);
|
||||
WriteInt(stream, "Audio.SetPriorityCutoff", 6);
|
||||
WriteInt(stream, "Audio.MuteAll", false);
|
||||
WriteInt(stream, "Audio.SetChannelVolume SoundFX", 1);
|
||||
WriteInt(stream, "Audio.SetChannelVolume BgndMusic", 1);
|
||||
|
@ -124,8 +124,8 @@ protected:
|
||||
|
||||
pfKI *fKIGUIGlue;
|
||||
|
||||
hsBool fDone;
|
||||
hsBool fWindowActive;
|
||||
bool fDone;
|
||||
bool fWindowActive;
|
||||
|
||||
hsWindowHndl fWindowHndl;
|
||||
|
||||
@ -136,20 +136,20 @@ protected:
|
||||
|
||||
virtual hsG3DDeviceModeRecord ILoadDevMode(const char* devModeFile);
|
||||
|
||||
hsBool IUpdate();
|
||||
hsBool IDraw();
|
||||
hsBool IDrawProgress();
|
||||
bool IUpdate();
|
||||
bool IDraw();
|
||||
bool IDrawProgress();
|
||||
|
||||
plVirtualCam1* fNewCamera;
|
||||
|
||||
static plClient* fInstance;
|
||||
char * fpAuxInitDir;
|
||||
static hsBool fDelayMS;
|
||||
static bool fDelayMS;
|
||||
|
||||
int fClampCap;
|
||||
int fQuality;
|
||||
|
||||
hsBool fQuitIntro;
|
||||
bool fQuitIntro;
|
||||
hsTArray<plBinkPlayer*> fMovies;
|
||||
|
||||
plMessagePumpProc fMessagePumpProc;
|
||||
@ -184,14 +184,14 @@ protected:
|
||||
void IHandleNetCommAuthMsg (plNetCommAuthMsg * msg);
|
||||
bool IHandleAgeLoaded2Msg (plAgeLoaded2Msg * msg);
|
||||
|
||||
hsBool IFlushRenderRequests();
|
||||
bool IFlushRenderRequests();
|
||||
void IProcessPreRenderRequests();
|
||||
void IProcessPostRenderRequests();
|
||||
void IProcessRenderRequests(hsTArray<plRenderRequest*>& reqs);
|
||||
void IAddRenderRequest(plRenderRequest* req);
|
||||
|
||||
hsBool IPlayIntroBink(const char* movieName, float endDelay, float posX, float posY, float scaleX, float scaleY, float volume = 1.0);
|
||||
hsBool IHandleMovieMsg(plMovieMsg* mov);
|
||||
bool IPlayIntroBink(const char* movieName, float endDelay, float posX, float posY, float scaleX, float scaleY, float volume = 1.0);
|
||||
bool IHandleMovieMsg(plMovieMsg* mov);
|
||||
void IKillMovies();
|
||||
void IServiceMovies();
|
||||
|
||||
@ -225,9 +225,9 @@ public:
|
||||
static plClient* GetInstance() { return fInstance; }
|
||||
static void SetInstance(plClient* v) { fInstance=v; }
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
|
||||
hsBool InitPipeline();
|
||||
bool InitPipeline();
|
||||
|
||||
void InitInputs();
|
||||
|
||||
@ -236,12 +236,12 @@ public:
|
||||
|
||||
void InitAuxInits();
|
||||
|
||||
virtual hsBool StartInit();
|
||||
virtual hsBool Shutdown();
|
||||
virtual hsBool MainLoop();
|
||||
virtual bool StartInit();
|
||||
virtual bool Shutdown();
|
||||
virtual bool MainLoop();
|
||||
|
||||
plClient& SetDone(hsBool done) { fDone = done; return *this; }
|
||||
hsBool GetDone() { return fDone; }
|
||||
plClient& SetDone(bool done) { fDone = done; return *this; }
|
||||
bool GetDone() { return fDone; }
|
||||
|
||||
// Set this to true to queue any room load requests that come in. Set it to false to process them.
|
||||
void SetHoldLoadRequests(bool hold);
|
||||
@ -255,8 +255,8 @@ public:
|
||||
kFlagGlobalDataLoaded,
|
||||
};
|
||||
|
||||
hsBool HasFlag(int f) const { return fFlags.IsBitSet(f); }
|
||||
void SetFlag(int f, hsBool on=true) { fFlags.SetBit(f, on); }
|
||||
bool HasFlag(int f) const { return fFlags.IsBitSet(f); }
|
||||
void SetFlag(int f, bool on=true) { fFlags.SetBit(f, on); }
|
||||
|
||||
virtual plClient& SetWindowHandle(hsWindowHndl hndl) { fWindowHndl=hndl; return *this; }
|
||||
hsWindowHndl GetWindowHandle() { return fWindowHndl; }
|
||||
@ -280,20 +280,20 @@ public:
|
||||
void SetQuality(int q) { fQuality = q; }
|
||||
int GetQuality() const { return fQuality; }
|
||||
|
||||
hsBool GetQuitIntro() const { return fQuitIntro; }
|
||||
void SetQuitIntro(hsBool on) { fQuitIntro = on; }
|
||||
bool GetQuitIntro() const { return fQuitIntro; }
|
||||
void SetQuitIntro(bool on) { fQuitIntro = on; }
|
||||
|
||||
void SetClearColor( hsColorRGBA &color );
|
||||
hsColorRGBA GetClearColor() const { return fClearColor; }
|
||||
|
||||
// The client window has focus (true) or lost it (false)
|
||||
virtual void WindowActivate(bool active);
|
||||
virtual hsBool WindowActive() const { return fWindowActive; }
|
||||
virtual bool WindowActive() const { return fWindowActive; }
|
||||
|
||||
void FlashWindow();
|
||||
void SetMessagePumpProc( plMessagePumpProc proc ) { fMessagePumpProc = proc; }
|
||||
void ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync = false);
|
||||
void ResizeDisplayDevice(int Width, int Height, hsBool Windowed);
|
||||
void ResetDisplayDevice(int Width, int Height, int ColorDepth, bool Windowed, int NumAASamples, int MaxAnisotropicSamples, bool VSync = false);
|
||||
void ResizeDisplayDevice(int Width, int Height, bool Windowed);
|
||||
void IDetectAudioVideoSettings();
|
||||
void IWriteDefaultGraphicsSettings(const wchar_t* destFile);
|
||||
|
||||
|
@ -92,10 +92,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
hsBool gHasMouse = false;
|
||||
bool gHasMouse = false;
|
||||
ITaskbarList3* gTaskbarList = nil; // NT 6.1+ taskbar stuff
|
||||
|
||||
extern hsBool gDataServerLocal;
|
||||
extern bool gDataServerLocal;
|
||||
|
||||
enum
|
||||
{
|
||||
@ -1047,7 +1047,7 @@ static void SaveUserPass (LoginDialogParam *pLoginParam, char *password)
|
||||
{
|
||||
stream->Write(sizeof(cryptKey), cryptKey);
|
||||
stream->WriteSafeString(pLoginParam->username);
|
||||
stream->Writebool(pLoginParam->remember);
|
||||
stream->WriteBool(pLoginParam->remember);
|
||||
if (pLoginParam->remember)
|
||||
stream->Write(sizeof(pLoginParam->namePassHash), pLoginParam->namePassHash);
|
||||
stream->Close();
|
||||
@ -1092,7 +1092,7 @@ static void LoadUserPass (LoginDialogParam *pLoginParam)
|
||||
delete temp;
|
||||
}
|
||||
|
||||
pLoginParam->remember = stream->Readbool();
|
||||
pLoginParam->remember = stream->ReadBool();
|
||||
|
||||
if (pLoginParam->remember)
|
||||
{
|
||||
|
@ -62,37 +62,38 @@ void print_help() {
|
||||
printf("\t-v|--version\t - Prints build version information\n");
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
bool encrypt = true;
|
||||
const char* dir = ".";
|
||||
|
||||
#define ARGCMP(y) (strcmp(argv[1], y) == 0)
|
||||
if (argc > 1)
|
||||
{
|
||||
if (hsStrEQ(argv[1], "encrypt") || hsStrEQ(argv[1], "-e") )
|
||||
if (ARGCMP("encrypt") || ARGCMP("-e") )
|
||||
{
|
||||
if (argc > 2)
|
||||
dir = argv[2];
|
||||
encrypt = true;
|
||||
}
|
||||
else if (hsStrEQ(argv[1], "decrypt") || hsStrEQ(argv[1], "-d"))
|
||||
else if (ARGCMP("decrypt") || ARGCMP("-d"))
|
||||
{
|
||||
if (argc > 2)
|
||||
dir = argv[2];
|
||||
encrypt = false;
|
||||
}
|
||||
else if(hsStrEQ(argv[1], "--help") || hsStrEQ(argv[1], "-h") || hsStrEQ(argv[1], "-?") || hsStrEQ(argv[1], "/?"))
|
||||
else if(ARGCMP("--help") || ARGCMP("-h") || ARGCMP("-?") || ARGCMP("/?"))
|
||||
{
|
||||
print_help();
|
||||
return 0;
|
||||
}
|
||||
else if (hsStrEQ(argv[1], "-v") || hsStrEQ(argv[1], "--version"))
|
||||
else if (ARGCMP("-v") || ARGCMP("--version"))
|
||||
{
|
||||
print_version();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#undef ARGCMP
|
||||
|
||||
EncryptFiles(dir, ".age", encrypt);
|
||||
EncryptFiles(dir, ".fni", encrypt);
|
||||
|
@ -95,7 +95,7 @@ int PrintHelp( void )
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc >= 1 && hsStrEQ(argv[1], "-v"))
|
||||
if (argc >= 1 && strcmp(argv[1], "-v") == 0)
|
||||
{
|
||||
PrintVersion();
|
||||
return 0;
|
||||
@ -110,9 +110,9 @@ int main(int argc, char* argv[])
|
||||
int arg = 1;
|
||||
for (arg = 1; arg < argc; arg++)
|
||||
{
|
||||
if (hsStrEQ(argv[arg], "-s"))
|
||||
if (strcmp(argv[arg], "-s") == 0)
|
||||
sounds = true;
|
||||
else if (hsStrEQ(argv[arg], "-i"))
|
||||
else if (strcmp(argv[arg], "-i") == 0)
|
||||
stats = true;
|
||||
else
|
||||
break;
|
||||
@ -157,7 +157,7 @@ public:
|
||||
plSoundBufferCollector(hsTArray<plKey>& keyArray)
|
||||
: plKeyCollector(keyArray) {}
|
||||
|
||||
hsBool EatPage(plRegistryPageNode* page)
|
||||
bool EatPage(plRegistryPageNode* page)
|
||||
{
|
||||
page->LoadKeys();
|
||||
return page->IterateKeys(this, plSoundBuffer::Index());
|
||||
@ -226,7 +226,7 @@ protected:
|
||||
public:
|
||||
plStatDumpIterator(const char* outputDir) : fOutputDir(outputDir) {}
|
||||
|
||||
hsBool EatKey(const plKey& key)
|
||||
bool EatKey(const plKey& key)
|
||||
{
|
||||
plKeyImp* imp = (plKey)key;
|
||||
|
||||
@ -244,7 +244,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool EatPage(plRegistryPageNode* page)
|
||||
bool EatPage(plRegistryPageNode* page)
|
||||
{
|
||||
const plPageInfo& info = page->GetPageInfo();
|
||||
|
||||
|
@ -76,7 +76,7 @@ void plPageOptimizer::IFindLoc()
|
||||
public:
|
||||
plLocation fLoc;
|
||||
|
||||
virtual hsBool EatPage(plRegistryPageNode* keyNode)
|
||||
virtual bool EatPage(plRegistryPageNode* keyNode)
|
||||
{
|
||||
fLoc = keyNode->GetPageInfo().GetLocation();
|
||||
return true;
|
||||
@ -95,7 +95,7 @@ void plPageOptimizer::Optimize()
|
||||
// Get the location of the page we're optimizing
|
||||
IFindLoc();
|
||||
|
||||
hsBool loaded = true;
|
||||
bool loaded = true;
|
||||
|
||||
// Get the key for the scene node, we'll load it to force a load on all the objects
|
||||
plKey snKey = plKeyFinder::Instance().FindSceneNodeKey(fLoc);
|
||||
@ -111,7 +111,7 @@ void plPageOptimizer::Optimize()
|
||||
public:
|
||||
KeyVec& fKeys;
|
||||
plVecKeyCollector(KeyVec& keys) : fKeys(keys) {}
|
||||
virtual hsBool EatKey(const plKey& key) { fKeys.push_back(key); return true; }
|
||||
virtual bool EatKey(const plKey& key) { fKeys.push_back(key); return true; }
|
||||
};
|
||||
plVecKeyCollector keyIt(fAllKeys);
|
||||
fResMgr->IterateKeys(&keyIt);
|
||||
@ -238,7 +238,7 @@ void plPageOptimizer::IRewritePage()
|
||||
// some reason), put them at the end
|
||||
for (int i = 0; i < fAllKeys.size(); i++)
|
||||
{
|
||||
hsBool found = (fLoadedKeys.find(fAllKeys[i]) != fLoadedKeys.end());
|
||||
bool found = (fLoadedKeys.find(fAllKeys[i]) != fLoadedKeys.end());
|
||||
if (!found)
|
||||
IWriteKeyData(&oldPage, &newPage, fAllKeys[i]);
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ PyObject* PythonInterface::CompileString(const char *command, const char* filena
|
||||
//
|
||||
// PURPOSE : marshals an object into a char string
|
||||
//
|
||||
hsBool PythonInterface::DumpObject(PyObject* pyobj, char** pickle, int32_t* size)
|
||||
bool PythonInterface::DumpObject(PyObject* pyobj, char** pickle, int32_t* size)
|
||||
{
|
||||
PyObject *s; // the python string object where the marsalled object wil go
|
||||
// convert object to a marshalled string python object
|
||||
@ -255,7 +255,7 @@ PyObject* PythonInterface::CreateModule(const char* module)
|
||||
//
|
||||
// PURPOSE : run a compiled python code in a specific module name
|
||||
//
|
||||
hsBool PythonInterface::RunPYC(PyObject* code, PyObject* module)
|
||||
bool PythonInterface::RunPYC(PyObject* code, PyObject* module)
|
||||
{
|
||||
PyObject *d, *v;
|
||||
// make sure that we're given a good module... or at least one with an address
|
||||
|
@ -52,9 +52,9 @@ namespace PythonInterface
|
||||
void addPythonPath(std::string dir);
|
||||
|
||||
PyObject* CompileString(const char *command, const char* filename);
|
||||
hsBool DumpObject(PyObject* pyobj, char** pickle, int32_t* size);
|
||||
bool DumpObject(PyObject* pyobj, char** pickle, int32_t* size);
|
||||
int getOutputAndReset(char** line=nil);
|
||||
PyObject* CreateModule(const char* module);
|
||||
hsBool RunPYC(PyObject* code, PyObject* module);
|
||||
bool RunPYC(PyObject* code, PyObject* module);
|
||||
PyObject* GetModuleItem(const char* item, PyObject* module);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s)
|
||||
// next we need to:
|
||||
// - create instance of class
|
||||
PyObject* getID = PythonInterface::GetModuleItem("glue_getBlockID",fModule);
|
||||
hsBool foundID = false;
|
||||
bool foundID = false;
|
||||
if ( getID!=nil && PyCallable_Check(getID) )
|
||||
{
|
||||
PyObject* id = PyObject_CallFunction(getID,nil);
|
||||
|
@ -208,7 +208,7 @@ static void LogV (ELogSev sev, const wchar_t fmt[], va_list args) {
|
||||
{ stdout, L"Inf" },
|
||||
{ stderr, L"Err" },
|
||||
};
|
||||
COMPILER_ASSERT(arrsize(s_log) == kNumLogSev);
|
||||
static_assert(arrsize(s_log) == kNumLogSev, "Log severity array and enum have different sizes");
|
||||
|
||||
fwprintf (s_log[sev].file, L"%s: ", s_log[sev].pre);
|
||||
vfwprintf(s_log[sev].file, fmt, args);
|
||||
|
@ -24,6 +24,7 @@ set(CoreLib_SOURCES
|
||||
hsMatrix44.cpp
|
||||
hsMemory.cpp
|
||||
hsQuat.cpp
|
||||
hsRefCnt.cpp
|
||||
hsSafeRefCnt.cpp
|
||||
hsSTLStream.cpp
|
||||
hsStlUtils.cpp
|
||||
@ -31,7 +32,6 @@ set(CoreLib_SOURCES
|
||||
hsStringTokenizer.cpp
|
||||
hsTemplates.cpp
|
||||
hsThread.cpp
|
||||
hsUtils.cpp
|
||||
hsWide.cpp
|
||||
pcSmallRect.cpp
|
||||
plGeneric.cpp
|
||||
@ -77,15 +77,11 @@ set(CoreLib_HEADERS
|
||||
hsStringTokenizer.h
|
||||
hsTemplates.h
|
||||
hsThread.h
|
||||
hsTypes.h
|
||||
hsUtils.h
|
||||
hsWide.h
|
||||
hsWindows.h
|
||||
pcSmallRect.h
|
||||
plGeneric.h
|
||||
plLoadMask.h
|
||||
plQuality.h
|
||||
plRefCnt.h
|
||||
plString.h
|
||||
plTweak.h
|
||||
plViewTransform.h
|
||||
|
@ -40,15 +40,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "HeadSpin.h"
|
||||
#include "hsRefCnt.h"
|
||||
#include "hsStlUtils.h"
|
||||
#include "hsExceptions.h"
|
||||
#include <math.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
#include "hsStlUtils.h"
|
||||
#include "hsTemplates.h"
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/////////////////// For Status Messages ///////////////////////////////////
|
||||
@ -122,7 +121,7 @@ void ErrorAssert(int line, const char file[], const char fmt[], ...)
|
||||
{
|
||||
if(_CrtDbgReport(_CRT_ASSERT, file, line, NULL, msg))
|
||||
DebugBreak();
|
||||
} else
|
||||
} else
|
||||
#endif // HS_DEBUGGING
|
||||
if (DebugIsDebuggerPresent()) {
|
||||
char str[] = "-------\nASSERTION FAILED:\nFile: %s Line: %i\nMessage: %s\n-------";
|
||||
@ -146,7 +145,7 @@ bool DebugIsDebuggerPresent()
|
||||
void DebugBreakIfDebuggerPresent()
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
__try
|
||||
__try
|
||||
{
|
||||
__debugbreak();
|
||||
} __except(EXCEPTION_EXECUTE_HANDLER) {
|
||||
@ -175,30 +174,6 @@ void DebugMsg(const char fmt[], ...)
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
hsRefCnt::~hsRefCnt()
|
||||
{
|
||||
hsDebugCode(hsThrowIfFalse(fRefCnt == 1);)
|
||||
}
|
||||
|
||||
void hsRefCnt::Ref()
|
||||
{
|
||||
fRefCnt++;
|
||||
}
|
||||
|
||||
void hsRefCnt::UnRef()
|
||||
{
|
||||
hsDebugCode(hsThrowIfFalse(fRefCnt >= 1);)
|
||||
|
||||
if (fRefCnt == 1) // don't decrement if we call delete
|
||||
delete this;
|
||||
else
|
||||
--fRefCnt;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
@ -237,4 +212,383 @@ void hsStatusMessageF(const char * fmt, ...)
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
char * hsFormatStr(const char * fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,fmt);
|
||||
char * result = hsFormatStrV(fmt,args);
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
|
||||
char * hsFormatStrV(const char * fmt, va_list args)
|
||||
{
|
||||
std::string buf;
|
||||
xtl::formatv(buf,fmt,args);
|
||||
return hsStrcpy(buf.c_str());
|
||||
}
|
||||
|
||||
static char hsStrBuf[100];
|
||||
|
||||
char *hsScalarToStr(float s)
|
||||
{
|
||||
sprintf(hsStrBuf, "%f", s);
|
||||
return hsStrBuf;
|
||||
}
|
||||
|
||||
class hsMinimizeClientGuard
|
||||
{
|
||||
#ifdef CLIENT
|
||||
hsWindowHndl fWnd;
|
||||
|
||||
public:
|
||||
hsMinimizeClientGuard()
|
||||
{
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
fWnd = GetActiveWindow();
|
||||
// If the application's topmost window is fullscreen, minimize it before displaying an error
|
||||
if ((GetWindowLong(fWnd, GWL_STYLE) & WS_POPUP) != 0)
|
||||
ShowWindow(fWnd, SW_MINIMIZE);
|
||||
#endif // HS_BUILD_FOR_WIN32
|
||||
}
|
||||
|
||||
~hsMinimizeClientGuard()
|
||||
{
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
ShowWindow(fWnd, SW_RESTORE);
|
||||
#endif // HS_BUILD_FOR_WIN32
|
||||
}
|
||||
#endif // CLIENT
|
||||
};
|
||||
|
||||
bool hsMessageBox_SuppressPrompts = false;
|
||||
|
||||
int hsMessageBoxWithOwner(hsWindowHndl owner, const char message[], const char caption[], int kind, int icon)
|
||||
{
|
||||
if (hsMessageBox_SuppressPrompts)
|
||||
return hsMBoxOk;
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
uint32_t flags = 0;
|
||||
|
||||
if (kind == hsMessageBoxNormal)
|
||||
flags |= MB_OK;
|
||||
else if (kind == hsMessageBoxAbortRetyIgnore)
|
||||
flags |= MB_ABORTRETRYIGNORE;
|
||||
else if (kind == hsMessageBoxOkCancel)
|
||||
flags |= MB_OKCANCEL;
|
||||
else if (kind == hsMessageBoxRetryCancel)
|
||||
flags |= MB_RETRYCANCEL;
|
||||
else if (kind == hsMessageBoxYesNo)
|
||||
flags |= MB_YESNO;
|
||||
else if (kind == hsMessageBoxYesNoCancel)
|
||||
flags |= MB_YESNOCANCEL;
|
||||
else
|
||||
flags |= MB_OK;
|
||||
|
||||
if (icon == hsMessageBoxIconError)
|
||||
flags |= MB_ICONERROR;
|
||||
else if (icon == hsMessageBoxIconQuestion)
|
||||
flags |= MB_ICONQUESTION;
|
||||
else if (icon == hsMessageBoxIconExclamation)
|
||||
flags |= MB_ICONEXCLAMATION;
|
||||
else if (icon == hsMessageBoxIconAsterisk)
|
||||
flags |= MB_ICONASTERISK;
|
||||
else
|
||||
flags |= MB_ICONERROR;
|
||||
|
||||
hsMinimizeClientGuard guard;
|
||||
int ans = MessageBox(owner, message, caption, flags);
|
||||
|
||||
switch (ans)
|
||||
{
|
||||
case IDOK: return hsMBoxOk;
|
||||
case IDCANCEL: return hsMBoxCancel;
|
||||
case IDABORT: return hsMBoxAbort;
|
||||
case IDRETRY: return hsMBoxRetry;
|
||||
case IDIGNORE: return hsMBoxIgnore;
|
||||
case IDYES: return hsMBoxYes;
|
||||
case IDNO: return hsMBoxNo;
|
||||
default: return hsMBoxCancel;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int hsMessageBoxWithOwner(hsWindowHndl owner, const wchar_t message[], const wchar_t caption[], int kind, int icon)
|
||||
{
|
||||
if (hsMessageBox_SuppressPrompts)
|
||||
return hsMBoxOk;
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
uint32_t flags = 0;
|
||||
|
||||
if (kind == hsMessageBoxNormal)
|
||||
flags |= MB_OK;
|
||||
else if (kind == hsMessageBoxAbortRetyIgnore)
|
||||
flags |= MB_ABORTRETRYIGNORE;
|
||||
else if (kind == hsMessageBoxOkCancel)
|
||||
flags |= MB_OKCANCEL;
|
||||
else if (kind == hsMessageBoxRetryCancel)
|
||||
flags |= MB_RETRYCANCEL;
|
||||
else if (kind == hsMessageBoxYesNo)
|
||||
flags |= MB_YESNO;
|
||||
else if (kind == hsMessageBoxYesNoCancel)
|
||||
flags |= MB_YESNOCANCEL;
|
||||
else
|
||||
flags |= MB_OK;
|
||||
|
||||
if (icon == hsMessageBoxIconError)
|
||||
flags |= MB_ICONERROR;
|
||||
else if (icon == hsMessageBoxIconQuestion)
|
||||
flags |= MB_ICONQUESTION;
|
||||
else if (icon == hsMessageBoxIconExclamation)
|
||||
flags |= MB_ICONEXCLAMATION;
|
||||
else if (icon == hsMessageBoxIconAsterisk)
|
||||
flags |= MB_ICONASTERISK;
|
||||
else
|
||||
flags |= MB_ICONERROR;
|
||||
|
||||
hsMinimizeClientGuard guard;
|
||||
int ans = MessageBoxW(owner, message, caption, flags);
|
||||
|
||||
switch (ans)
|
||||
{
|
||||
case IDOK: return hsMBoxOk;
|
||||
case IDCANCEL: return hsMBoxCancel;
|
||||
case IDABORT: return hsMBoxAbort;
|
||||
case IDRETRY: return hsMBoxRetry;
|
||||
case IDIGNORE: return hsMBoxIgnore;
|
||||
case IDYES: return hsMBoxYes;
|
||||
case IDNO: return hsMBoxNo;
|
||||
default: return hsMBoxCancel;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int hsMessageBox(const char message[], const char caption[], int kind, int icon)
|
||||
{
|
||||
return hsMessageBoxWithOwner((hsWindowHndl)nil,message,caption,kind,icon);
|
||||
}
|
||||
|
||||
int hsMessageBox(const wchar_t message[], const wchar_t caption[], int kind, int icon)
|
||||
{
|
||||
return hsMessageBoxWithOwner((hsWindowHndl)nil,message,caption,kind,icon);
|
||||
}
|
||||
|
||||
/**************************************/
|
||||
char* hsStrcpy(char dst[], const char src[])
|
||||
{
|
||||
if (src)
|
||||
{
|
||||
if (dst == nil)
|
||||
{
|
||||
int count = strlen(src);
|
||||
dst = (char *)malloc(count + 1);
|
||||
memcpy(dst, src, count);
|
||||
dst[count] = 0;
|
||||
return dst;
|
||||
}
|
||||
|
||||
int32_t i;
|
||||
for (i = 0; src[i] != 0; i++)
|
||||
dst[i] = src[i];
|
||||
dst[i] = 0;
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
void hsStrLower(char *s)
|
||||
{
|
||||
if (s)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < strlen(s); i++)
|
||||
s[i] = tolower(s[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//// IStringToWString /////////////////////////////////////////////////////////
|
||||
// Converts a char * string to a wchar_t * string
|
||||
|
||||
wchar_t *hsStringToWString( const char *str )
|
||||
{
|
||||
// convert the char string to a wchar_t string
|
||||
int len = strlen(str);
|
||||
wchar_t *wideString = new wchar_t[len+1];
|
||||
for (int i=0; i<len; i++)
|
||||
wideString[i] = btowc(str[i]);
|
||||
wideString[len] = L'\0';
|
||||
return wideString;
|
||||
}
|
||||
|
||||
//// IWStringToString /////////////////////////////////////////////////////////
|
||||
// Converts a wchar_t * string to a char * string
|
||||
|
||||
char *hsWStringToString( const wchar_t *str )
|
||||
{
|
||||
// convert the wchar_t string to a char string
|
||||
int len = wcslen(str);
|
||||
char *sStr = new char[len+1];
|
||||
|
||||
int i;
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
char temp = wctob(str[i]);
|
||||
if (temp == WEOF)
|
||||
{
|
||||
sStr[i] = '\0';
|
||||
i = len;
|
||||
}
|
||||
else
|
||||
sStr[i] = temp;
|
||||
}
|
||||
sStr[len] = '\0';
|
||||
|
||||
return sStr;
|
||||
}
|
||||
|
||||
//
|
||||
// Microsoft SAMPLE CODE
|
||||
// returns array of allocated version info strings or nil
|
||||
//
|
||||
char** DisplaySystemVersion()
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
#ifndef VER_SUITE_PERSONAL
|
||||
#define VER_SUITE_PERSONAL 0x200
|
||||
#endif
|
||||
hsTArray<char*> versionStrs;
|
||||
OSVERSIONINFOEX osvi;
|
||||
BOOL bOsVersionInfoEx;
|
||||
|
||||
// Try calling GetVersionEx using the OSVERSIONINFOEX structure.
|
||||
//
|
||||
// If that fails, try using the OSVERSIONINFO structure.
|
||||
|
||||
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
|
||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
||||
|
||||
if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) )
|
||||
{
|
||||
// If OSVERSIONINFOEX doesn't work, try OSVERSIONINFO.
|
||||
|
||||
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
|
||||
if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
switch (osvi.dwPlatformId)
|
||||
{
|
||||
case VER_PLATFORM_WIN32_NT:
|
||||
|
||||
// Test for the product.
|
||||
|
||||
if ( osvi.dwMajorVersion <= 4 )
|
||||
versionStrs.Append(hsStrcpy("Microsoft Windows NT "));
|
||||
|
||||
if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )
|
||||
versionStrs.Append(hsStrcpy ("Microsoft Windows 2000 "));
|
||||
|
||||
if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
|
||||
versionStrs.Append(hsStrcpy ("Microsoft Windows XP "));
|
||||
|
||||
// Test for product type.
|
||||
|
||||
if( bOsVersionInfoEx )
|
||||
{
|
||||
if ( osvi.wProductType == VER_NT_WORKSTATION )
|
||||
{
|
||||
if( osvi.wSuiteMask & VER_SUITE_PERSONAL )
|
||||
versionStrs.Append(hsStrcpy ( "Personal " ));
|
||||
else
|
||||
versionStrs.Append(hsStrcpy ( "Professional " ));
|
||||
}
|
||||
|
||||
else if ( osvi.wProductType == VER_NT_SERVER )
|
||||
{
|
||||
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
|
||||
versionStrs.Append(hsStrcpy ( "DataCenter Server " ));
|
||||
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
|
||||
versionStrs.Append(hsStrcpy ( "Advanced Server " ));
|
||||
else
|
||||
versionStrs.Append(hsStrcpy ( "Server " ));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HKEY hKey;
|
||||
char szProductType[80];
|
||||
DWORD dwBufLen;
|
||||
|
||||
RegOpenKeyEx( HKEY_LOCAL_MACHINE,
|
||||
"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
|
||||
0, KEY_QUERY_VALUE, &hKey );
|
||||
RegQueryValueEx( hKey, "ProductType", NULL, NULL,
|
||||
(LPBYTE) szProductType, &dwBufLen);
|
||||
RegCloseKey( hKey );
|
||||
if ( lstrcmpi( "WINNT", szProductType) == 0 )
|
||||
versionStrs.Append(hsStrcpy( "Professional " ));
|
||||
if ( lstrcmpi( "LANMANNT", szProductType) == 0 )
|
||||
versionStrs.Append(hsStrcpy( "Server " ));
|
||||
if ( lstrcmpi( "SERVERNT", szProductType) == 0 )
|
||||
versionStrs.Append(hsStrcpy( "Advanced Server " ));
|
||||
}
|
||||
|
||||
// Display version, service pack (if any), and build number.
|
||||
|
||||
if ( osvi.dwMajorVersion <= 4 )
|
||||
{
|
||||
versionStrs.Append(hsStrcpy (xtl::format("version %d.%d %s (Build %d)\n",
|
||||
osvi.dwMajorVersion,
|
||||
osvi.dwMinorVersion,
|
||||
osvi.szCSDVersion,
|
||||
osvi.dwBuildNumber & 0xFFFF).c_str()));
|
||||
}
|
||||
else
|
||||
{
|
||||
versionStrs.Append(hsStrcpy (xtl::format("%s (Build %d)\n",
|
||||
osvi.szCSDVersion,
|
||||
osvi.dwBuildNumber & 0xFFFF).c_str()));
|
||||
}
|
||||
break;
|
||||
|
||||
case VER_PLATFORM_WIN32_WINDOWS:
|
||||
|
||||
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
|
||||
{
|
||||
versionStrs.Append(hsStrcpy ("Microsoft Windows 95 "));
|
||||
if ( osvi.szCSDVersion[1] == 'C' || osvi.szCSDVersion[1] == 'B' )
|
||||
versionStrs.Append(hsStrcpy("OSR2 " ));
|
||||
}
|
||||
|
||||
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
|
||||
{
|
||||
versionStrs.Append(hsStrcpy ("Microsoft Windows 98 "));
|
||||
if ( osvi.szCSDVersion[1] == 'A' )
|
||||
versionStrs.Append(hsStrcpy("SE " ));
|
||||
}
|
||||
|
||||
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
|
||||
{
|
||||
versionStrs.Append(hsStrcpy ("Microsoft Windows Me "));
|
||||
}
|
||||
break;
|
||||
|
||||
case VER_PLATFORM_WIN32s:
|
||||
|
||||
versionStrs.Append(hsStrcpy ("Microsoft Win32s "));
|
||||
break;
|
||||
}
|
||||
|
||||
versionStrs.Append(nil); // terminator
|
||||
|
||||
return versionStrs.DetachArray();
|
||||
#else
|
||||
return nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // not PLASMA_EXTERNAL_RELEASE
|
||||
|
@ -46,10 +46,522 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
# define HS_DEBUGGING
|
||||
#endif // defined(_DEBUG) || defined(UNIX_DENUG)
|
||||
|
||||
// Internal Headers
|
||||
// These are only ever included here :)
|
||||
#include "hsTypes.h"
|
||||
#include "hsWindows.h"
|
||||
#include "hsUtils.h"
|
||||
//======================================
|
||||
// Winblows Hacks
|
||||
//======================================
|
||||
#ifdef 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 // _MSC_VER
|
||||
|
||||
// Terrible hacks for MinGW because they don't have a reasonable
|
||||
// default for the Windows version. We cheat and say it's XP.
|
||||
# ifdef __MINGW32__
|
||||
# undef _WIN32_WINNT
|
||||
# define _WIN32_WINNT 0x501
|
||||
# undef _WIN32_IE
|
||||
# define _WIN32_IE 0x400
|
||||
# endif
|
||||
|
||||
// Windows.h includes winsock.h (winsocks 1), so we need to manually include winsock2
|
||||
// and tell Windows.h to only bring in modern headers
|
||||
# include <WinSock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# ifndef NOMINMAX
|
||||
# define NOMINMAX // Needed to prevent NxMath conflicts
|
||||
# endif
|
||||
# include <Windows.h>
|
||||
|
||||
// Just some fun typedefs...
|
||||
typedef HWND hsWindowHndl;
|
||||
typedef HINSTANCE hsWindowInst;
|
||||
#else
|
||||
typedef int32_t* hsWindowHndl;
|
||||
typedef int32_t* hsWindowInst;
|
||||
#endif // HS_BUILD_FOR_WIN32
|
||||
|
||||
//======================================
|
||||
// We don't want the Windows.h min/max!
|
||||
//======================================
|
||||
#ifdef max
|
||||
# undef max
|
||||
#endif
|
||||
|
||||
#ifdef min
|
||||
# undef min
|
||||
#endif
|
||||
|
||||
//======================================
|
||||
// Some standard includes
|
||||
//======================================
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cctype>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
//======================================
|
||||
// Basic macros
|
||||
//======================================
|
||||
#ifdef __cplusplus
|
||||
#define hsCTypeDefStruct(foo)
|
||||
#else
|
||||
#define hsCTypeDefStruct(foo) typedef struct foo foo;
|
||||
#endif
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
# ifndef CDECL
|
||||
# define CDECL __cdecl
|
||||
# endif
|
||||
#else
|
||||
# define CDECL
|
||||
#endif
|
||||
|
||||
#define kPosInfinity16 (32767)
|
||||
#define kNegInfinity16 (-32768)
|
||||
|
||||
#define kPosInfinity32 (0x7fffffff)
|
||||
#define kNegInfinity32 (0x80000000)
|
||||
|
||||
#ifndef M_PI
|
||||
# define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#ifndef nil
|
||||
# define nil (0)
|
||||
#endif
|
||||
|
||||
typedef int32_t hsError;
|
||||
typedef uint32_t hsGSeedValue;
|
||||
|
||||
#define hsOK 0
|
||||
#define hsFail -1
|
||||
#define hsFailed(r) ((hsError)(r)<hsOK)
|
||||
#define hsSucceeded(r) ((hsError)(r)>=hsOK)
|
||||
|
||||
#define hsLongAlign(n) (((n) + 3) & ~3L)
|
||||
|
||||
#define hsMaximum(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define hsMinimum(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define hsABS(x) ((x) < 0 ? -(x) : (x))
|
||||
#define hsSGN(x) (((x) < 0) ? -1 : ( ((x) > 0) ? 1 : 0 ))
|
||||
|
||||
#define hsBitTst2Bool(value, mask) (((value) & (mask)) != 0)
|
||||
|
||||
#define hsFourByteTag(a, b, c, d) (((uint32_t)(a) << 24) | ((uint32_t)(b) << 16) | ((uint32_t)(c) << 8) | (d))
|
||||
|
||||
|
||||
//======================================
|
||||
// Endian swap funcitions
|
||||
//======================================
|
||||
inline uint16_t hsSwapEndian16(uint16_t value)
|
||||
{
|
||||
return (value >> 8) | (value << 8);
|
||||
}
|
||||
inline uint32_t hsSwapEndian32(uint32_t value)
|
||||
{
|
||||
return ((value) << 24) |
|
||||
((value & 0x0000ff00) << 8) |
|
||||
((value & 0x00ff0000) >> 8) |
|
||||
((value) >> 24);
|
||||
}
|
||||
inline uint64_t hsSwapEndian64(uint64_t value)
|
||||
{
|
||||
return ((value) << 56) |
|
||||
((value & 0x000000000000ff00) << 40) |
|
||||
((value & 0x0000000000ff0000) << 24) |
|
||||
((value & 0x00000000ff000000) << 8) |
|
||||
((value & 0x000000ff00000000) >> 8) |
|
||||
((value & 0x0000ff0000000000) >> 24) |
|
||||
((value & 0x00ff000000000000) >> 40) |
|
||||
((value) >> 56);
|
||||
}
|
||||
inline float hsSwapEndianFloat(float fvalue)
|
||||
{
|
||||
uint32_t value = *(uint32_t*)&fvalue;
|
||||
value = hsSwapEndian32(value);
|
||||
return *(float*)&value;
|
||||
}
|
||||
inline double hsSwapEndianDouble(double dvalue)
|
||||
{
|
||||
uint64_t value = *(uint64_t*)&dvalue;
|
||||
value = hsSwapEndian64(value);
|
||||
return *(double*)&value;
|
||||
}
|
||||
|
||||
#if LITTLE_ENDIAN
|
||||
#define hsToBE16(n) hsSwapEndian16(n)
|
||||
#define hsToBE32(n) hsSwapEndian32(n)
|
||||
#define hsToBE64(n) hsSwapEndian64(n)
|
||||
#define hsToBEFloat(n) hsSwapEndianFloat(n)
|
||||
#define hsToBEDouble(n) hsSwapEndianDouble(n)
|
||||
#define hsToLE16(n) (n)
|
||||
#define hsToLE32(n) (n)
|
||||
#define hsToLE64(n) (n)
|
||||
#define hsToLEFloat(n) (n)
|
||||
#define hsToLEDouble(n) (n)
|
||||
#else
|
||||
#define hsToBE16(n) (n)
|
||||
#define hsToBE32(n) (n)
|
||||
#define hsToBE64(n) (n)
|
||||
#define hsToBEFloat(n) (n)
|
||||
#define hsToBEDouble(n) (n)
|
||||
#define hsToLE16(n) hsSwapEndian16(n)
|
||||
#define hsToLE32(n) hsSwapEndian32(n)
|
||||
#define hsToLE64(n) hsSwapEndian64(n)
|
||||
#define hsToLEFloat(n) hsSwapEndianFloat(n)
|
||||
#define hsToLEDouble(n) hsSwapEndianDouble(n)
|
||||
#endif
|
||||
|
||||
inline void hsSwap(int32_t& a, int32_t& b)
|
||||
{
|
||||
int32_t c = a;
|
||||
a = b;
|
||||
b = c;
|
||||
}
|
||||
|
||||
inline void hsSwap(uint32_t& a, uint32_t& b)
|
||||
{
|
||||
uint32_t c = a;
|
||||
a = b;
|
||||
b = c;
|
||||
}
|
||||
|
||||
inline void hsSwap(float& a, float& b)
|
||||
{
|
||||
float c = a;
|
||||
a = b;
|
||||
b = c;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Define a NOOP (null) statement
|
||||
//===========================================================================
|
||||
#ifdef _MSC_VER
|
||||
# define NULL_STMT __noop
|
||||
#else
|
||||
# define NULL_STMT ((void)0)
|
||||
#endif
|
||||
|
||||
//===========================================================================
|
||||
template<class T>
|
||||
inline T max (const T & a, const T & b) {
|
||||
return (a > b) ? a : b;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
inline unsigned max (int a, unsigned b) {
|
||||
return ((unsigned)a > b) ? a : b;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
inline unsigned max (unsigned a, int b) {
|
||||
return (a > (unsigned)b) ? a : b;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
template<class T>
|
||||
inline T min (const T & a, const T & b) {
|
||||
return (a < b) ? a : b;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
inline unsigned min (int a, unsigned b) {
|
||||
return ((unsigned)a < b) ? a : b;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
inline unsigned min (unsigned a, int b) {
|
||||
return (a < (unsigned)b) ? a : b;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* MAX/MIN macros
|
||||
* These are less safe than the inline function versions, since they
|
||||
* evaluate parameters twice. However, they can be used to produce
|
||||
* compile-time constants.
|
||||
*
|
||||
***/
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* SWAP
|
||||
* Swaps the values of two variables
|
||||
*
|
||||
***/
|
||||
|
||||
//===========================================================================
|
||||
template<class T>
|
||||
void SWAP (T & a, T & b) {
|
||||
T temp = a;
|
||||
a = b;
|
||||
b = temp;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* AUTO_INIT_FUNC
|
||||
* Declares a function that is automatically called at program startup time
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* AUTO_INIT_FUNC(BuildLookupTables) {
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
***/
|
||||
|
||||
#define AUTO_INIT_FUNC(name) namespace { struct name { name (); } name##_instance; } name::name ()
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* arrsize
|
||||
* arrsize returns the number of elements in an array variable
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* StrPrintf(buffer, arrsize(buffer), "%u", value);
|
||||
*
|
||||
***/
|
||||
#define arrsize(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* IS_POW2
|
||||
*
|
||||
***/
|
||||
#define IS_POW2(val) (!((val) & ((val) - 1)))
|
||||
|
||||
#ifdef PLASMA_EXTERNAL_RELEASE
|
||||
# define hsStatusMessage(x) NULL_STMT
|
||||
# define hsStatusMessageF(x, ...) NULL_STMT
|
||||
#else
|
||||
void hsStatusMessage(const char message[]);
|
||||
void hsStatusMessageF(const char * fmt, ...);
|
||||
#endif // PLASMA_EXTERNAL_RELEASE
|
||||
|
||||
char* hsStrcpy(char dstOrNil[], const char src[]);
|
||||
void hsStrLower(char *s);
|
||||
char * hsFormatStr(const char * fmt, ...); // You are responsible for returned memory.
|
||||
char * hsFormatStrV(const char * fmt, va_list args); // You are responsible for returned memory.
|
||||
|
||||
// Use "correct" stricmp based on the selected compiler / library
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
# define stricmp _stricmp
|
||||
# define strnicmp _strnicmp
|
||||
# define wcsicmp _wcsicmp
|
||||
# define wcsnicmp _wcsnicmp
|
||||
# define strlwr _strlwr
|
||||
#else
|
||||
# define stricmp strcasecmp
|
||||
# define strnicmp strncasecmp
|
||||
# define wcsicmp wcscasecmp
|
||||
# define wcsnicmp wcsncasecmp
|
||||
# define strlwr hsStrLower
|
||||
#endif
|
||||
|
||||
inline char* hsStrcpy(const char src[])
|
||||
{
|
||||
return hsStrcpy(nil, src);
|
||||
}
|
||||
|
||||
inline char *hsStrncpy(char *strDest, const char *strSource, size_t count)
|
||||
{
|
||||
char *temp = strncpy(strDest, strSource, count-1);
|
||||
strDest[count-1] = 0;
|
||||
return temp;
|
||||
}
|
||||
|
||||
wchar_t *hsStringToWString( const char *str );
|
||||
char *hsWStringToString( const wchar_t *str );
|
||||
|
||||
enum { // Kind of MessageBox...passed to hsMessageBox
|
||||
hsMessageBoxAbortRetyIgnore,
|
||||
hsMessageBoxNormal, // Just Ok
|
||||
hsMessageBoxOkCancel,
|
||||
hsMessageBoxRetryCancel,
|
||||
hsMessageBoxYesNo,
|
||||
hsMessageBoxYesNoCancel,
|
||||
};
|
||||
|
||||
enum {
|
||||
hsMessageBoxIconError,
|
||||
hsMessageBoxIconQuestion,
|
||||
hsMessageBoxIconExclamation,
|
||||
hsMessageBoxIconAsterisk,
|
||||
};
|
||||
|
||||
enum { // RETURN VALUES FROM hsMessageBox
|
||||
hsMBoxOk = 1, // OK button was selected.
|
||||
hsMBoxCancel, // Cancel button was selected.
|
||||
hsMBoxAbort, // Abort button was selected.
|
||||
hsMBoxRetry, // Retry button was selected.
|
||||
hsMBoxIgnore, // Ignore button was selected.
|
||||
hsMBoxYes, // Yes button was selected.
|
||||
hsMBoxNo // No button was selected.
|
||||
};
|
||||
|
||||
extern bool hsMessageBox_SuppressPrompts;
|
||||
int hsMessageBox(const char message[], const char caption[], int kind, int icon=hsMessageBoxIconAsterisk);
|
||||
int hsMessageBox(const wchar_t message[], const wchar_t caption[], int kind, int icon=hsMessageBoxIconAsterisk);
|
||||
int hsMessageBoxWithOwner(hsWindowHndl owner, const char message[], const char caption[], int kind, int icon=hsMessageBoxIconAsterisk);
|
||||
int hsMessageBoxWithOwner(hsWindowHndl owner, const wchar_t message[], const wchar_t caption[], int kind, int icon=hsMessageBoxIconAsterisk);
|
||||
|
||||
// flag testing / clearing
|
||||
#define hsCheckBits(f,c) ((f & c)==c)
|
||||
#define hsTestBits(f,b) ( (f) & (b) )
|
||||
#define hsSetBits(f,b) ( (f) |= (b) )
|
||||
#define hsClearBits(f,b) ( (f) &= ~(b) )
|
||||
#define hsToggleBits(f,b) ( (f) ^= (b) )
|
||||
#define hsChangeBits(f,b,t) ( t ? hsSetBits(f,b) : hsClearBits(f,b) )
|
||||
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
// This is for Windows
|
||||
# define hsVsnprintf _vsnprintf
|
||||
# define hsVsnwprintf _vsnwprintf
|
||||
# define hsSnprintf _snprintf
|
||||
# define hsSnwprintf _snwprintf
|
||||
|
||||
# define snprintf _snprintf
|
||||
# define snwprintf _snwprintf
|
||||
# define swprintf _snwprintf
|
||||
|
||||
# ifndef fileno
|
||||
# define fileno(__F) _fileno(__F)
|
||||
# endif
|
||||
|
||||
# define hsWFopen(name, mode) _wfopen(name, mode)
|
||||
#else
|
||||
// This is for Unix, Linux, OSX, etc.
|
||||
# define hsVsnprintf vsnprintf
|
||||
# define hsVsnwprintf vswprintf
|
||||
# define hsSnprintf snprintf
|
||||
# define hsSnwprintf swprintf
|
||||
|
||||
# define hsWFopen(name, mode) fopen(hsWStringToString(name), hsWStringToString(mode))
|
||||
|
||||
# include <limits.h>
|
||||
# define MAX_PATH PATH_MAX
|
||||
#endif
|
||||
|
||||
// Useful floating point utilities
|
||||
inline float hsDegreesToRadians(float deg) { return float(deg * (M_PI / 180)); }
|
||||
inline float hsRadiansToDegrees(float rad) { return float(rad * (180 / M_PI)); }
|
||||
#define hsInvert(a) (1 / (a))
|
||||
|
||||
#include <new>
|
||||
#define NEWZERO(t) new(calloc(sizeof(t), 1)) t
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define ALIGN(n) __declspec(align(n))
|
||||
#else
|
||||
# define ALIGN(n) __atribute__(aligned(n))
|
||||
#endif
|
||||
|
||||
#define hsFopen(name, mode) fopen(name, mode)
|
||||
|
||||
char** DisplaySystemVersion();
|
||||
|
||||
/************************ Debug/Error Macros **************************/
|
||||
|
||||
typedef void (*hsDebugMessageProc)(const char message[]);
|
||||
extern hsDebugMessageProc gHSDebugProc;
|
||||
#define HSDebugProc(m) { if (gHSDebugProc) gHSDebugProc(m); }
|
||||
hsDebugMessageProc hsSetDebugMessageProc(hsDebugMessageProc newProc);
|
||||
|
||||
extern hsDebugMessageProc gHSStatusProc;
|
||||
hsDebugMessageProc hsSetStatusMessageProc(hsDebugMessageProc newProc);
|
||||
|
||||
void ErrorEnableGui (bool enabled);
|
||||
void ErrorAssert (int line, const char file[], const char fmt[], ...);
|
||||
|
||||
bool DebugIsDebuggerPresent ();
|
||||
void DebugBreakIfDebuggerPresent ();
|
||||
void DebugMsg(const char fmt[], ...);
|
||||
|
||||
#ifdef HS_DEBUGGING
|
||||
|
||||
void hsDebugMessage(const char message[], long refcon);
|
||||
#define hsDebugCode(code) code
|
||||
#define hsIfDebugMessage(expr, msg, ref) (void)( ((expr) != 0) || (hsDebugMessage(msg, ref), 0) )
|
||||
#define hsAssert(expr, msg) (void)( ((expr) != 0) || (ErrorAssert(__LINE__, __FILE__, msg), 0) )
|
||||
#define ASSERT(expr) (void)( ((expr) != 0) || (ErrorAssert(__LINE__, __FILE__, #expr), 0) )
|
||||
#define ASSERTMSG(expr, msg) (void)( ((expr) != 0) || (ErrorAssert(__LINE__, __FILE__, msg), 0) )
|
||||
#define FATAL(msg) ErrorAssert(__LINE__, __FILE__, msg)
|
||||
#define DEBUG_MSG DebugMsg
|
||||
#define DEBUG_BREAK_IF_DEBUGGER_PRESENT DebugBreakIfDebuggerPresent
|
||||
|
||||
#else /* Not debugging */
|
||||
|
||||
#define hsDebugMessage(message, refcon) NULL_STMT
|
||||
#define hsDebugCode(code) /* empty */
|
||||
#define hsIfDebugMessage(expr, msg, ref) NULL_STMT
|
||||
#define hsAssert(expr, msg) NULL_STMT
|
||||
#define ASSERT(expr) NULL_STMT
|
||||
#define ASSERTMSG(expr, msg) NULL_STMT
|
||||
#define FATAL(msg) NULL_STMT
|
||||
#define DEBUG_MSG (void)
|
||||
#define DEBUG_MSGV NULL_STMT
|
||||
#define DEBUG_BREAK_IF_DEBUGGER_PRESENT NULL_STMT
|
||||
|
||||
#endif // HS_DEBUGGING
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define DEFAULT_FATAL(var) default: FATAL("No valid case for switch variable '" #var "'"); __assume(0); break;
|
||||
#else
|
||||
#define DEFAULT_FATAL(var) default: FATAL("No valid case for switch variable '" #var "'"); break;
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Atomic Operations
|
||||
*
|
||||
***/
|
||||
|
||||
// *value += increment; return original value of *value; thread safe
|
||||
inline long AtomicAdd(long* value, long increment)
|
||||
{
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
return InterlockedExchangeAdd(value, increment);
|
||||
#elif __GNUC__
|
||||
return __sync_fetch_and_add(value, increment);
|
||||
#else
|
||||
# error "No Atomic Set support on this architecture"
|
||||
#endif
|
||||
}
|
||||
|
||||
// *value = value; return original value of *value; thread safe
|
||||
inline long AtomicSet(long* value, long set)
|
||||
{
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
return InterlockedExchange(value, set);
|
||||
#elif __GNUC__
|
||||
return __sync_lock_test_and_set(value, set);
|
||||
#else
|
||||
# error "No Atomic Set support on this architecture"
|
||||
#endif
|
||||
}
|
||||
|
||||
#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);
|
||||
|
@ -45,6 +45,39 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "hsStream.h"
|
||||
|
||||
struct hsColor32 {
|
||||
|
||||
uint8_t b, g, r, a;
|
||||
|
||||
inline void SetARGB(uint8_t aa, uint8_t rr, uint8_t gg, uint8_t bb)
|
||||
{
|
||||
this->a = aa;
|
||||
this->r = rr;
|
||||
this->g = gg;
|
||||
this->b = bb;
|
||||
}
|
||||
|
||||
// Compatibility inlines, should be depricated
|
||||
inline void Set(uint8_t rr, uint8_t gg, uint8_t bb)
|
||||
{
|
||||
this->r = rr;
|
||||
this->g = gg;
|
||||
this->b = bb;
|
||||
}
|
||||
inline void Set(uint8_t aa, uint8_t rr, uint8_t gg, uint8_t bb)
|
||||
{
|
||||
this->SetARGB(aa, rr, gg, bb);
|
||||
}
|
||||
|
||||
int operator==(const hsColor32& aa) const
|
||||
{
|
||||
return *(uint32_t*)&aa == *(uint32_t*)this;
|
||||
}
|
||||
int operator!=(const hsColor32& aa) { return !(aa == *this); }
|
||||
};
|
||||
hsCTypeDefStruct(hsColor32)
|
||||
typedef hsColor32 hsRGBAColor32;
|
||||
|
||||
struct hsColorRGBA {
|
||||
float r,g,b,a;
|
||||
|
||||
@ -52,8 +85,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 +212,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); }
|
||||
|
@ -39,51 +39,27 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plRefCnt_Defined
|
||||
#define plRefCnt_Defined
|
||||
|
||||
#include "HeadSpin.h"
|
||||
#include "hsExceptions.h"
|
||||
#include "hsRefCnt.h"
|
||||
|
||||
// plRef count addes refcount abilities to any plCreatable
|
||||
hsRefCnt::~hsRefCnt()
|
||||
{
|
||||
hsDebugCode(hsThrowIfFalse(fRefCnt == 1);)
|
||||
}
|
||||
|
||||
class plRefCnt
|
||||
{ uint32_t fRefCnt;
|
||||
public:
|
||||
plRefCnt() : fRefCnt(1){}
|
||||
~plRefCnt(){}
|
||||
hsBool TimeToDelete() { return (fRefCnt == 1); }
|
||||
void Incr() { fRefCnt++; }
|
||||
void Decr() { fRefCnt--; }
|
||||
};
|
||||
void hsRefCnt::Ref()
|
||||
{
|
||||
fRefCnt++;
|
||||
}
|
||||
|
||||
void hsRefCnt::UnRef()
|
||||
{
|
||||
hsDebugCode(hsThrowIfFalse(fRefCnt >= 1);)
|
||||
|
||||
#define DEFINE_REF_COUNT plRefCnt fMyRef;\
|
||||
virtual void UnRef() { /*hsDebugCode(hsThrowIfFalse(fRefCnt >= 1);)*/if (fMyRef.TimeToDelete()) delete this; else fMyRef.Decr(); }\
|
||||
virtual void Ref() { fMyRef.Incr(); }
|
||||
/*
|
||||
class hsRefCnt {
|
||||
private:
|
||||
int32_t fRefCnt;
|
||||
public:
|
||||
hsRefCnt() : fRefCnt(1) {}
|
||||
virtual ~hsRefCnt();
|
||||
|
||||
int32_t RefCnt() const { return fRefCnt; }
|
||||
virtual void UnRef();
|
||||
virtual void Ref();
|
||||
};
|
||||
|
||||
#define hsRefCnt_SafeRef(obj) do { if (obj) (obj)->Ref(); } while (0)
|
||||
#define hsRefCnt_SafeUnRef(obj) do { if (obj) (obj)->UnRef(); } while (0)
|
||||
|
||||
#define hsRefCnt_SafeAssign(dst, src) \
|
||||
do { \
|
||||
hsRefCnt_SafeRef(src); \
|
||||
hsRefCnt_SafeUnRef(dst); \
|
||||
dst = src; \
|
||||
} while (0)
|
||||
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
if (fRefCnt == 1) // don't decrement if we call delete
|
||||
delete this;
|
||||
else
|
||||
--fRefCnt;
|
||||
}
|
@ -54,7 +54,7 @@ hsVectorStream::~hsVectorStream()
|
||||
{
|
||||
}
|
||||
|
||||
hsBool hsVectorStream::AtEnd()
|
||||
bool hsVectorStream::AtEnd()
|
||||
{
|
||||
return (fBytesRead >= fEnd);
|
||||
}
|
||||
@ -153,241 +153,3 @@ const void *hsVectorStream::GetData()
|
||||
else
|
||||
return nil;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
|
||||
hsNamedPipeStream::hsNamedPipeStream(uint8_t flags, uint32_t timeout) :
|
||||
fFlags(flags),
|
||||
fPipe(INVALID_HANDLE_VALUE),
|
||||
fReadMode(false),
|
||||
fTimeout(timeout)
|
||||
{
|
||||
memset(&fOverlap, 0, sizeof(OVERLAPPED));
|
||||
fOverlap.hEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
|
||||
}
|
||||
|
||||
hsNamedPipeStream::~hsNamedPipeStream()
|
||||
{
|
||||
CloseHandle(fOverlap.hEvent);
|
||||
fOverlap.hEvent = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::WaitForClientConnect()
|
||||
{
|
||||
// Look for a client connect (this should return zero since it's overlapped)
|
||||
BOOL ret = ConnectNamedPipe(fPipe, &fOverlap);
|
||||
if (ret)
|
||||
return true;
|
||||
else
|
||||
{
|
||||
switch (GetLastError())
|
||||
{
|
||||
// Waiting for client to connect
|
||||
case ERROR_IO_PENDING:
|
||||
if (WaitForSingleObject(fOverlap.hEvent, fTimeout) == WAIT_OBJECT_0)
|
||||
return true;
|
||||
break;
|
||||
|
||||
// Client is already connected
|
||||
case ERROR_PIPE_CONNECTED:
|
||||
// if (SetEvent(fOverlap.hEvent))
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::Open(const char *name, const char *mode)
|
||||
{
|
||||
wchar_t* wName = hsStringToWString(name);
|
||||
wchar_t* wMode = hsStringToWString(mode);
|
||||
hsBool ret = Open(wName, wMode);
|
||||
delete [] wName;
|
||||
delete [] wMode;
|
||||
return ret;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::Open(const wchar_t *name, const wchar_t *mode)
|
||||
{
|
||||
if (wcschr(mode, L'w'))
|
||||
{
|
||||
fReadMode = false;
|
||||
|
||||
// Try to create the pipe
|
||||
fPipe = CreateNamedPipeW(name,
|
||||
PIPE_ACCESS_OUTBOUND | FILE_FLAG_OVERLAPPED,
|
||||
PIPE_TYPE_BYTE,
|
||||
1,
|
||||
1024,
|
||||
1024,
|
||||
fTimeout,
|
||||
NULL);
|
||||
|
||||
if (fPipe != INVALID_HANDLE_VALUE)
|
||||
return true;
|
||||
}
|
||||
else if (wcschr(mode, L'r'))
|
||||
{
|
||||
fReadMode = true;
|
||||
|
||||
fPipe = CreateFileW(name,
|
||||
GENERIC_READ,
|
||||
0, // no sharing
|
||||
NULL, // no security attributes
|
||||
OPEN_EXISTING, // opens existing pipe
|
||||
FILE_FLAG_OVERLAPPED, // default attributes
|
||||
NULL); // no template file
|
||||
|
||||
if (fPipe != INVALID_HANDLE_VALUE)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::Close()
|
||||
{
|
||||
if (fPipe == INVALID_HANDLE_VALUE)
|
||||
return false;
|
||||
|
||||
if (fReadMode)
|
||||
{
|
||||
CloseHandle(fPipe); // Close our end of the pipe
|
||||
fPipe = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
FlushFileBuffers(fPipe); // Make sure the client is done reading
|
||||
DisconnectNamedPipe(fPipe); // Disconnect the pipe from the client
|
||||
CloseHandle(fPipe); // Close our end of the pipe
|
||||
fPipe = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::ICheckOverlappedResult(BOOL result, uint32_t &numTransferred)
|
||||
{
|
||||
// Read/Write succeeded, return now
|
||||
if (result)
|
||||
return true;
|
||||
// Read failed because the operation is taking a while. Wait for it
|
||||
else if (GetLastError() == ERROR_IO_PENDING)
|
||||
{
|
||||
if (WaitForSingleObject(fOverlap.hEvent, fTimeout) == WAIT_OBJECT_0)
|
||||
{
|
||||
BOOL oResult = GetOverlappedResult(fPipe, &fOverlap, (LPDWORD)&numTransferred, FALSE);
|
||||
if (oResult)
|
||||
return true;
|
||||
hsAssert(oResult, "GetOverlappedResult failed");
|
||||
}
|
||||
else
|
||||
hsAssert(0, "Wait failed");
|
||||
}
|
||||
else
|
||||
hsAssert(0, "Read/Write failed");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::IRead(uint32_t byteCount, void *buffer, uint32_t &numRead)
|
||||
{
|
||||
numRead = 0;
|
||||
|
||||
if (fPipe != INVALID_HANDLE_VALUE && fReadMode)
|
||||
{
|
||||
BOOL result = ReadFile(fPipe, buffer, byteCount, (LPDWORD)&numRead, &fOverlap);
|
||||
if (ICheckOverlappedResult(result, numRead))
|
||||
return true;
|
||||
}
|
||||
|
||||
// If we got here, the pipe is probably broken. Throw if it is enabled.
|
||||
if (fFlags & kThrowOnError)
|
||||
throw this;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::IWrite(uint32_t byteCount, const void *buffer, uint32_t &numWritten)
|
||||
{
|
||||
numWritten = 0;
|
||||
|
||||
if (fPipe != INVALID_HANDLE_VALUE && !fReadMode)
|
||||
{
|
||||
BOOL result = WriteFile(fPipe, buffer, byteCount, (LPDWORD)&numWritten, &fOverlap);
|
||||
if (ICheckOverlappedResult(result, numWritten))
|
||||
return true;
|
||||
}
|
||||
|
||||
// If we got here, the pipe is probably broken. Throw if it is enabled.
|
||||
if (fFlags & kThrowOnError)
|
||||
throw this;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t hsNamedPipeStream::Read(uint32_t byteCount, void *buffer)
|
||||
{
|
||||
uint32_t totalRead = 0;
|
||||
|
||||
// Read until we get all our data or an error
|
||||
uint32_t numRead = 0;
|
||||
while (IRead(byteCount-totalRead, (void*)((uint32_t)buffer+totalRead), numRead))
|
||||
{
|
||||
totalRead += numRead;
|
||||
|
||||
if (totalRead >= byteCount)
|
||||
return totalRead;
|
||||
}
|
||||
|
||||
return totalRead;
|
||||
}
|
||||
|
||||
uint32_t hsNamedPipeStream::Write(uint32_t byteCount, const void *buffer)
|
||||
{
|
||||
uint32_t totalWritten = 0;
|
||||
|
||||
// Write until we get all our data or an error
|
||||
uint32_t numWritten = 0;
|
||||
while (IWrite(byteCount-totalWritten, (const void*)((uint32_t)buffer+totalWritten), numWritten))
|
||||
{
|
||||
totalWritten += numWritten;
|
||||
|
||||
if (totalWritten >= byteCount)
|
||||
return totalWritten;
|
||||
}
|
||||
|
||||
return totalWritten;
|
||||
}
|
||||
|
||||
#ifdef __SGI_STL_PORT
|
||||
using std::min;
|
||||
#endif
|
||||
|
||||
void hsNamedPipeStream::Skip(uint32_t deltaByteCount)
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
// Read until we get all our data or an error
|
||||
uint32_t totalRead = 0;
|
||||
uint32_t numRead = 0;
|
||||
while (IRead(min((uint32_t)256L, deltaByteCount-totalRead), buf, numRead))
|
||||
{
|
||||
totalRead += numRead;
|
||||
|
||||
if (totalRead >= deltaByteCount)
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void hsNamedPipeStream::Rewind()
|
||||
{
|
||||
hsAssert(0, "Rewind not allowed on a pipe");
|
||||
}
|
||||
|
||||
#endif // HS_BUILD_FOR_WIN32
|
||||
|
@ -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);
|
||||
@ -82,48 +82,3 @@ public:
|
||||
// In case you want to try and be efficient with your memory allocations
|
||||
void Reserve(uint32_t bytes) { fVector.reserve(bytes); }
|
||||
};
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
|
||||
|
||||
|
||||
class hsNamedPipeStream : public hsStream
|
||||
{
|
||||
protected:
|
||||
HANDLE fPipe;
|
||||
OVERLAPPED fOverlap;
|
||||
hsBool 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);
|
||||
|
||||
public:
|
||||
enum { kThrowOnError = 1 }; // Throws if a read or write operation fails
|
||||
|
||||
hsNamedPipeStream(uint8_t flags=0, uint32_t timeout=INFINITE);
|
||||
virtual ~hsNamedPipeStream();
|
||||
|
||||
// The server (writer) and client (reader) need to open the same file.
|
||||
// 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 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();
|
||||
|
||||
// - 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();
|
||||
};
|
||||
|
||||
#endif // HS_BUILD_FOR_WIN32
|
||||
|
@ -118,7 +118,9 @@ hsStream::~hsStream()
|
||||
|
||||
uint32_t hsStream::WriteString(const char cstring[])
|
||||
{
|
||||
return Write(hsStrlen(cstring), cstring);
|
||||
if (cstring)
|
||||
return Write(strlen(cstring), cstring);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t hsStream::WriteFmt(const char * fmt, ...)
|
||||
@ -139,7 +141,9 @@ uint32_t hsStream::WriteFmtV(const char * fmt, va_list av)
|
||||
|
||||
uint32_t hsStream::WriteSafeStringLong(const char *string)
|
||||
{
|
||||
uint32_t len = hsStrlen(string);
|
||||
uint32_t len = 0;
|
||||
if (string)
|
||||
len = strlen(string);
|
||||
WriteLE32(len);
|
||||
if (len > 0)
|
||||
{
|
||||
@ -222,7 +226,9 @@ wchar_t *hsStream::ReadSafeWStringLong()
|
||||
|
||||
uint32_t hsStream::WriteSafeString(const char *string)
|
||||
{
|
||||
int len = hsStrlen(string);
|
||||
int len = 0;
|
||||
if (string)
|
||||
len = strlen(string);
|
||||
hsAssert(len<0xf000, xtl::format("string len of %d is too long for WriteSafeString %s, use WriteSafeStringLong",
|
||||
string, len).c_str() );
|
||||
|
||||
@ -271,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
|
||||
@ -348,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)
|
||||
@ -356,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)
|
||||
@ -364,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)
|
||||
@ -372,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()
|
||||
@ -403,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;
|
||||
@ -464,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;
|
||||
@ -592,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)
|
||||
@ -705,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;
|
||||
@ -787,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;
|
||||
@ -832,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)
|
||||
@ -879,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);
|
||||
@ -987,7 +976,7 @@ void plReadOnlySubStream::IFixPosition( void )
|
||||
fPosition = fBase->GetPosition() - fOffset;
|
||||
}
|
||||
|
||||
hsBool plReadOnlySubStream::AtEnd()
|
||||
bool plReadOnlySubStream::AtEnd()
|
||||
{
|
||||
if( fPosition >= fLength )
|
||||
return true;
|
||||
@ -1068,7 +1057,7 @@ void hsRAMStream::Reset()
|
||||
fIter.ResetToHead(&fAppender);
|
||||
}
|
||||
|
||||
hsBool hsRAMStream::AtEnd()
|
||||
bool hsRAMStream::AtEnd()
|
||||
{
|
||||
return (fBytesRead >= fAppender.Count() * fAppender.ElemSize());
|
||||
}
|
||||
@ -1157,7 +1146,7 @@ void hsNullStream::Truncate()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
hsBool hsReadOnlyStream::AtEnd()
|
||||
bool hsReadOnlyStream::AtEnd()
|
||||
{
|
||||
return fData >= fStop;
|
||||
}
|
||||
@ -1331,7 +1320,7 @@ void hsQueueStream::FastFwd()
|
||||
fReadCursor = fWriteCursor;
|
||||
}
|
||||
|
||||
hsBool hsQueueStream::AtEnd()
|
||||
bool hsQueueStream::AtEnd()
|
||||
{
|
||||
return fReadCursor == fWriteCursor;
|
||||
}
|
||||
@ -1387,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);
|
||||
@ -1407,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)
|
||||
@ -1550,7 +1539,7 @@ uint32_t hsBufferedStream::Write(uint32_t bytes, const void* buffer)
|
||||
return amtWritten;
|
||||
}
|
||||
|
||||
hsBool hsBufferedStream::AtEnd()
|
||||
bool hsBufferedStream::AtEnd()
|
||||
{
|
||||
if (fWriteBufferUsed)
|
||||
{
|
||||
|
@ -48,9 +48,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "hsMemory.h"
|
||||
#include "plString.h"
|
||||
|
||||
namespace hsPackFileSys {
|
||||
struct FileEntry;
|
||||
}
|
||||
|
||||
// Define this for use of Streams with Logging (commonly used w/ a packet sniffer)
|
||||
// These streams log their reads to an event list
|
||||
@ -77,32 +74,28 @@ enum {
|
||||
kEolnCode = '\n',
|
||||
kComment = '#'
|
||||
};
|
||||
enum VDB_Type {// Virtual Database type
|
||||
kVDB_GroupObject,
|
||||
kVDB_Mesh
|
||||
};
|
||||
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 +114,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 +143,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[]);
|
||||
@ -285,9 +280,6 @@ public:
|
||||
void WriteLE(uint32_t* tag, uint32_t size) { WriteLEAtom(*tag, size); }
|
||||
void ReadLE(uint32_t* tag, uint32_t *size) { *tag = ReadLEAtom(size); }
|
||||
/* Overloaded End */
|
||||
virtual void VirtualSetPosition(uint32_t pos, VDB_Type ){ SetPosition(pos); };
|
||||
virtual hsPackFileSys::FileEntry *GetFileEntry() { return nil; } // Streams from Packfiles can return a FileEntry
|
||||
|
||||
};
|
||||
|
||||
class hsStreamable {
|
||||
@ -302,18 +294,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 +319,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 +354,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 +377,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 +398,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 +422,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 +443,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 +464,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 +493,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 +507,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;
|
||||
|
@ -1,414 +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==*/
|
||||
|
||||
#ifdef _HSTYPES_H
|
||||
# error "Do not include hsTypes.h directly--use HeadSpin.h"
|
||||
#endif // _HSTYPES_H
|
||||
#define _HSTYPES_H
|
||||
|
||||
|
||||
/************************** Other Includes *****************************/
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <cstddef>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
/************************** Basic Macros *****************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define hsCTypeDefStruct(foo)
|
||||
#else
|
||||
#define hsCTypeDefStruct(foo) typedef struct foo foo;
|
||||
#endif
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
# ifndef CDECL
|
||||
# define CDECL __cdecl
|
||||
# endif
|
||||
#else
|
||||
# define CDECL
|
||||
#endif
|
||||
|
||||
/************************** Basic Types *****************************/
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1600
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed short int int16_t;
|
||||
typedef unsigned short int uint16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed long long int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#define kPosInfinity16 (32767)
|
||||
#define kNegInfinity16 (-32768)
|
||||
|
||||
#define kPosInfinity32 (0x7fffffff)
|
||||
#define kNegInfinity32 (0x80000000)
|
||||
|
||||
#ifndef M_PI
|
||||
# define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
typedef int hsBool;
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef nil
|
||||
#define nil (0)
|
||||
#endif
|
||||
|
||||
typedef int32_t hsError;
|
||||
typedef uint32_t hsGSeedValue;
|
||||
|
||||
#define hsOK 0
|
||||
#define hsFail -1
|
||||
#define hsFailed(r) ((hsError)(r)<hsOK)
|
||||
#define hsSucceeded(r) ((hsError)(r)>=hsOK)
|
||||
|
||||
#define hsLongAlign(n) (((n) + 3) & ~3L)
|
||||
|
||||
#define hsMaximum(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define hsMinimum(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define hsABS(x) ((x) < 0 ? -(x) : (x))
|
||||
#define hsSGN(x) (((x) < 0) ? -1 : ( ((x) > 0) ? 1 : 0 ))
|
||||
|
||||
#define hsBitTst2Bool(value, mask) (((value) & (mask)) != 0)
|
||||
|
||||
#define hsFourByteTag(a, b, c, d) (((uint32_t)(a) << 24) | ((uint32_t)(b) << 16) | ((uint32_t)(c) << 8) | (d))
|
||||
|
||||
|
||||
/************************** Swap Macros *****************************/
|
||||
|
||||
inline uint16_t hsSwapEndian16(uint16_t value)
|
||||
{
|
||||
return (value >> 8) | (value << 8);
|
||||
}
|
||||
inline uint32_t hsSwapEndian32(uint32_t value)
|
||||
{
|
||||
return ((value) << 24) |
|
||||
((value & 0x0000ff00) << 8) |
|
||||
((value & 0x00ff0000) >> 8) |
|
||||
((value) >> 24);
|
||||
}
|
||||
inline uint64_t hsSwapEndian64(uint64_t value)
|
||||
{
|
||||
return ((value) << 56) |
|
||||
((value & 0x000000000000ff00) << 40) |
|
||||
((value & 0x0000000000ff0000) << 24) |
|
||||
((value & 0x00000000ff000000) << 8) |
|
||||
((value & 0x000000ff00000000) >> 8) |
|
||||
((value & 0x0000ff0000000000) >> 24) |
|
||||
((value & 0x00ff000000000000) >> 40) |
|
||||
((value) >> 56);
|
||||
}
|
||||
inline float hsSwapEndianFloat(float fvalue)
|
||||
{
|
||||
uint32_t value = *(uint32_t*)&fvalue;
|
||||
value = hsSwapEndian32(value);
|
||||
return *(float*)&value;
|
||||
}
|
||||
inline double hsSwapEndianDouble(double dvalue)
|
||||
{
|
||||
uint64_t value = *(uint64_t*)&dvalue;
|
||||
value = hsSwapEndian64(value);
|
||||
return *(double*)&value;
|
||||
}
|
||||
|
||||
#if LITTLE_ENDIAN
|
||||
#define hsToBE16(n) hsSwapEndian16(n)
|
||||
#define hsToBE32(n) hsSwapEndian32(n)
|
||||
#define hsToBE64(n) hsSwapEndian64(n)
|
||||
#define hsToBEFloat(n) hsSwapEndianFloat(n)
|
||||
#define hsToBEDouble(n) hsSwapEndianDouble(n)
|
||||
#define hsToLE16(n) (n)
|
||||
#define hsToLE32(n) (n)
|
||||
#define hsToLE64(n) (n)
|
||||
#define hsToLEFloat(n) (n)
|
||||
#define hsToLEDouble(n) (n)
|
||||
#else
|
||||
#define hsToBE16(n) (n)
|
||||
#define hsToBE32(n) (n)
|
||||
#define hsToBE64(n) (n)
|
||||
#define hsToBEFloat(n) (n)
|
||||
#define hsToBEDouble(n) (n)
|
||||
#define hsToLE16(n) hsSwapEndian16(n)
|
||||
#define hsToLE32(n) hsSwapEndian32(n)
|
||||
#define hsToLE64(n) hsSwapEndian64(n)
|
||||
#define hsToLEFloat(n) hsSwapEndianFloat(n)
|
||||
#define hsToLEDouble(n) hsSwapEndianDouble(n)
|
||||
#endif
|
||||
|
||||
inline void hsSwap(int32_t& a, int32_t& b)
|
||||
{
|
||||
int32_t c = a;
|
||||
a = b;
|
||||
b = c;
|
||||
}
|
||||
|
||||
inline void hsSwap(uint32_t& a, uint32_t& b)
|
||||
{
|
||||
uint32_t c = a;
|
||||
a = b;
|
||||
b = c;
|
||||
}
|
||||
|
||||
inline void hsSwap(float& a, float& b)
|
||||
{
|
||||
float c = a;
|
||||
a = b;
|
||||
b = c;
|
||||
}
|
||||
|
||||
/************************** Color32 Type *****************************/
|
||||
|
||||
struct hsColor32 {
|
||||
|
||||
uint8_t b, g, r, a;
|
||||
|
||||
void SetARGB(uint8_t aa, uint8_t rr, uint8_t gg, uint8_t bb)
|
||||
{
|
||||
this->a = aa; this->r = rr; this->g = gg; this->b = bb;
|
||||
}
|
||||
|
||||
// Compatibility inlines, should be depricated
|
||||
void Set(uint8_t rr, uint8_t gg, uint8_t bb)
|
||||
{
|
||||
this->r = rr; this->g = gg; this->b = bb;
|
||||
}
|
||||
void Set(uint8_t aa, uint8_t rr, uint8_t gg, uint8_t bb)
|
||||
{
|
||||
this->SetARGB(aa, rr, gg, bb);
|
||||
}
|
||||
|
||||
int operator==(const hsColor32& aa) const
|
||||
{
|
||||
return *(uint32_t*)&aa == *(uint32_t*)this;
|
||||
}
|
||||
int operator!=(const hsColor32& aa) { return !(aa == *this); }
|
||||
};
|
||||
hsCTypeDefStruct(hsColor32)
|
||||
|
||||
typedef hsColor32 hsRGBAColor32;
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* NULL_STMT
|
||||
* Declares a null statement
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* for (; *str && (*str != ch); ++str)
|
||||
* NULL_STMT;
|
||||
*
|
||||
***/
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define NULL_STMT __noop
|
||||
#else
|
||||
# define NULL_STMT ((void)0)
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* UNIQUE_SYMBOL
|
||||
* Creates a symbol that is unique within a file
|
||||
*
|
||||
***/
|
||||
|
||||
#define UNIQUE_SYMBOL_EXPAND_1(prefix,line) UNIQUE_SYMBOL_##prefix##_##line
|
||||
#define UNIQUE_SYMBOL_EXPAND_0(prefix,line) UNIQUE_SYMBOL_EXPAND_1(prefix,line)
|
||||
#define UNIQUE_SYMBOL(prefix) UNIQUE_SYMBOL_EXPAND_0(prefix,__LINE__)
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* COMPILER_ASSERT
|
||||
* Performs a "compile-time" assertion
|
||||
* Can be used at function or file scope
|
||||
* Upon assertion failure, creates a negative subscript error
|
||||
* Use COMPILER_ASSERT_HEADER in header files to prevent symbol collision
|
||||
*
|
||||
***/
|
||||
|
||||
#define COMPILER_ASSERT(expr) static char UNIQUE_SYMBOL(a)[(expr) ? 1 : -1]
|
||||
#define COMPILER_ASSERT_HEADER(prefix,expr) static char UNIQUE_SYMBOL(prefix)[(expr) ? 1 : -1]
|
||||
#define COMPILER_ASSERT_SYMBOL(symbol,expr) static char symbol[(expr) ? 1 : -1]
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* max/min inline functions
|
||||
*
|
||||
***/
|
||||
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
|
||||
//===========================================================================
|
||||
template<class T>
|
||||
inline T max (const T & a, const T & b) {
|
||||
return (a > b) ? a : b;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
inline unsigned max (int a, unsigned b) {
|
||||
return ((unsigned)a > b) ? a : b;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
inline unsigned max (unsigned a, int b) {
|
||||
return (a > (unsigned)b) ? a : b;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
template<class T>
|
||||
inline T min (const T & a, const T & b) {
|
||||
return (a < b) ? a : b;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
inline unsigned min (int a, unsigned b) {
|
||||
return ((unsigned)a < b) ? a : b;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
inline unsigned min (unsigned a, int b) {
|
||||
return (a < (unsigned)b) ? a : b;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* MAX/MIN macros
|
||||
* These are less safe than the inline function versions, since they
|
||||
* evaluate parameters twice. However, they can be used to produce
|
||||
* compile-time constants.
|
||||
*
|
||||
***/
|
||||
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* SWAP
|
||||
* Swaps the values of two variables
|
||||
*
|
||||
***/
|
||||
|
||||
//===========================================================================
|
||||
template<class T>
|
||||
void SWAP (T & a, T & b) {
|
||||
T temp = a;
|
||||
a = b;
|
||||
b = temp;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* AUTO_INIT_FUNC
|
||||
* Declares a function that is automatically called at program startup time
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* AUTO_INIT_FUNC(BuildLookupTables) {
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
***/
|
||||
|
||||
#define AUTO_INIT_FUNC(name) namespace { struct name { name (); } name##_instance; } name::name ()
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* arrsize
|
||||
* arrsize returns the number of elements in an array variable
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* StrPrintf(buffer, arrsize(buffer), "%u", value);
|
||||
*
|
||||
***/
|
||||
|
||||
#define arrsize(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* IS_POW2
|
||||
*
|
||||
***/
|
||||
|
||||
#define IS_POW2(val) (!((val) & ((val) - 1)))
|
||||
|
||||
#ifdef PLASMA_EXTERNAL_RELEASE
|
||||
|
||||
#define hsStatusMessage(x) NULL_STMT
|
||||
#define hsStatusMessageF(x, ...) NULL_STMT
|
||||
|
||||
#else /* Not external release */
|
||||
|
||||
void hsStatusMessage(const char message[]);
|
||||
void hsStatusMessageF(const char * fmt, ...);
|
||||
|
||||
#endif // PLASMA_EXTERNAL_RELEASE
|
||||
|
@ -1,591 +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"
|
||||
#include "hsStlUtils.h"
|
||||
#include "hsTemplates.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
char * hsFormatStr(const char * fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,fmt);
|
||||
char * result = hsFormatStrV(fmt,args);
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
|
||||
char * hsFormatStrV(const char * fmt, va_list args)
|
||||
{
|
||||
std::string buf;
|
||||
xtl::formatv(buf,fmt,args);
|
||||
return hsStrcpy(buf.c_str());
|
||||
}
|
||||
|
||||
static char hsStrBuf[100];
|
||||
|
||||
char *hsScalarToStr(float s)
|
||||
{
|
||||
sprintf(hsStrBuf, "%f", s);
|
||||
return hsStrBuf;
|
||||
}
|
||||
|
||||
class hsMinimizeClientGuard
|
||||
{
|
||||
#ifdef CLIENT
|
||||
hsWindowHndl fWnd;
|
||||
|
||||
public:
|
||||
hsMinimizeClientGuard()
|
||||
{
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
fWnd = GetActiveWindow();
|
||||
// If the application's topmost window is fullscreen, minimize it before displaying an error
|
||||
if ((GetWindowLong(fWnd, GWL_STYLE) & WS_POPUP) != 0)
|
||||
ShowWindow(fWnd, SW_MINIMIZE);
|
||||
#endif // HS_BUILD_FOR_WIN32
|
||||
}
|
||||
|
||||
~hsMinimizeClientGuard()
|
||||
{
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
ShowWindow(fWnd, SW_RESTORE);
|
||||
#endif // HS_BUILD_FOR_WIN32
|
||||
}
|
||||
#endif // CLIENT
|
||||
};
|
||||
|
||||
bool hsMessageBox_SuppressPrompts = false;
|
||||
|
||||
int hsMessageBoxWithOwner(hsWindowHndl owner, const char message[], const char caption[], int kind, int icon)
|
||||
{
|
||||
if (hsMessageBox_SuppressPrompts)
|
||||
return hsMBoxOk;
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
uint32_t flags = 0;
|
||||
|
||||
if (kind == hsMessageBoxNormal)
|
||||
flags |= MB_OK;
|
||||
else if (kind == hsMessageBoxAbortRetyIgnore)
|
||||
flags |= MB_ABORTRETRYIGNORE;
|
||||
else if (kind == hsMessageBoxOkCancel)
|
||||
flags |= MB_OKCANCEL;
|
||||
else if (kind == hsMessageBoxRetryCancel)
|
||||
flags |= MB_RETRYCANCEL;
|
||||
else if (kind == hsMessageBoxYesNo)
|
||||
flags |= MB_YESNO;
|
||||
else if (kind == hsMessageBoxYesNoCancel)
|
||||
flags |= MB_YESNOCANCEL;
|
||||
else
|
||||
flags |= MB_OK;
|
||||
|
||||
if (icon == hsMessageBoxIconError)
|
||||
flags |= MB_ICONERROR;
|
||||
else if (icon == hsMessageBoxIconQuestion)
|
||||
flags |= MB_ICONQUESTION;
|
||||
else if (icon == hsMessageBoxIconExclamation)
|
||||
flags |= MB_ICONEXCLAMATION;
|
||||
else if (icon == hsMessageBoxIconAsterisk)
|
||||
flags |= MB_ICONASTERISK;
|
||||
else
|
||||
flags |= MB_ICONERROR;
|
||||
|
||||
hsMinimizeClientGuard guard;
|
||||
int ans = MessageBox(owner, message, caption, flags);
|
||||
|
||||
switch (ans)
|
||||
{
|
||||
case IDOK: return hsMBoxOk;
|
||||
case IDCANCEL: return hsMBoxCancel;
|
||||
case IDABORT: return hsMBoxAbort;
|
||||
case IDRETRY: return hsMBoxRetry;
|
||||
case IDIGNORE: return hsMBoxIgnore;
|
||||
case IDYES: return hsMBoxYes;
|
||||
case IDNO: return hsMBoxNo;
|
||||
default: return hsMBoxCancel;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int hsMessageBoxWithOwner(hsWindowHndl owner, const wchar_t message[], const wchar_t caption[], int kind, int icon)
|
||||
{
|
||||
if (hsMessageBox_SuppressPrompts)
|
||||
return hsMBoxOk;
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
uint32_t flags = 0;
|
||||
|
||||
if (kind == hsMessageBoxNormal)
|
||||
flags |= MB_OK;
|
||||
else if (kind == hsMessageBoxAbortRetyIgnore)
|
||||
flags |= MB_ABORTRETRYIGNORE;
|
||||
else if (kind == hsMessageBoxOkCancel)
|
||||
flags |= MB_OKCANCEL;
|
||||
else if (kind == hsMessageBoxRetryCancel)
|
||||
flags |= MB_RETRYCANCEL;
|
||||
else if (kind == hsMessageBoxYesNo)
|
||||
flags |= MB_YESNO;
|
||||
else if (kind == hsMessageBoxYesNoCancel)
|
||||
flags |= MB_YESNOCANCEL;
|
||||
else
|
||||
flags |= MB_OK;
|
||||
|
||||
if (icon == hsMessageBoxIconError)
|
||||
flags |= MB_ICONERROR;
|
||||
else if (icon == hsMessageBoxIconQuestion)
|
||||
flags |= MB_ICONQUESTION;
|
||||
else if (icon == hsMessageBoxIconExclamation)
|
||||
flags |= MB_ICONEXCLAMATION;
|
||||
else if (icon == hsMessageBoxIconAsterisk)
|
||||
flags |= MB_ICONASTERISK;
|
||||
else
|
||||
flags |= MB_ICONERROR;
|
||||
|
||||
hsMinimizeClientGuard guard;
|
||||
int ans = MessageBoxW(owner, message, caption, flags);
|
||||
|
||||
switch (ans)
|
||||
{
|
||||
case IDOK: return hsMBoxOk;
|
||||
case IDCANCEL: return hsMBoxCancel;
|
||||
case IDABORT: return hsMBoxAbort;
|
||||
case IDRETRY: return hsMBoxRetry;
|
||||
case IDIGNORE: return hsMBoxIgnore;
|
||||
case IDYES: return hsMBoxYes;
|
||||
case IDNO: return hsMBoxNo;
|
||||
default: return hsMBoxCancel;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int hsMessageBox(const char message[], const char caption[], int kind, int icon)
|
||||
{
|
||||
return hsMessageBoxWithOwner((hsWindowHndl)nil,message,caption,kind,icon);
|
||||
}
|
||||
|
||||
int hsMessageBox(const wchar_t message[], const wchar_t caption[], int kind, int icon)
|
||||
{
|
||||
return hsMessageBoxWithOwner((hsWindowHndl)nil,message,caption,kind,icon);
|
||||
}
|
||||
|
||||
inline hsBool hsCompare(float a, float b, float delta)
|
||||
{
|
||||
return (fabs(a - b) < delta);
|
||||
}
|
||||
|
||||
|
||||
/* Generic psuedo RNG used in ANSI C. */
|
||||
static unsigned long SEED = 1;
|
||||
int hsRand()
|
||||
{
|
||||
register int temp;
|
||||
SEED = SEED * 1103515245 + 12345;
|
||||
temp = (int)((SEED/65536)&32767);
|
||||
return (temp);
|
||||
}
|
||||
|
||||
void hsRandSeed(int seed)
|
||||
{
|
||||
SEED = seed;
|
||||
}
|
||||
/**************************************/
|
||||
int hsStrlen(const char src[])
|
||||
{
|
||||
if (src==nil)
|
||||
return 0;
|
||||
|
||||
int i = 0;
|
||||
while (src[i])
|
||||
i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
char* hsStrcpy(char dst[], const char src[])
|
||||
{
|
||||
if (src)
|
||||
{
|
||||
if (dst == nil)
|
||||
{
|
||||
int count = hsStrlen(src);
|
||||
dst = (char *)malloc(count + 1);
|
||||
memcpy(dst, src, count);
|
||||
dst[count] = 0;
|
||||
return dst;
|
||||
}
|
||||
|
||||
int32_t i;
|
||||
for (i = 0; src[i] != 0; i++)
|
||||
dst[i] = src[i];
|
||||
dst[i] = 0;
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
bool hsStrEQ(const char s1[], const char s2[])
|
||||
{
|
||||
if (s1 && s2)
|
||||
{
|
||||
while (*s1)
|
||||
if(*s1++ != *s2++)
|
||||
return false;
|
||||
return *s2 == 0;
|
||||
}
|
||||
|
||||
return (!s1 && !s2);
|
||||
}
|
||||
|
||||
bool hsStrCaseEQ(const char* s1, const char* s2)
|
||||
{
|
||||
if (s1 && s2)
|
||||
{
|
||||
while (*s1)
|
||||
if(tolower(*s1++) != tolower(*s2++))
|
||||
return false;
|
||||
return *s2 == 0;
|
||||
}
|
||||
|
||||
return (!s1 && !s2);
|
||||
}
|
||||
|
||||
void hsStrcat(char dst[], const char src[])
|
||||
{
|
||||
if (src && dst)
|
||||
{
|
||||
dst += hsStrlen(dst);
|
||||
while(*src)
|
||||
*dst++ = *src++;
|
||||
*dst = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void hsStrLower(char *s)
|
||||
{
|
||||
if (s)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < hsStrlen(s); i++)
|
||||
s[i] = tolower(s[i]);
|
||||
}
|
||||
}
|
||||
|
||||
char* hsP2CString(const uint8_t pstring[], char cstring[])
|
||||
{
|
||||
char* cstr = cstring;
|
||||
const uint8_t* stop = &pstring[1] + pstring[0];
|
||||
|
||||
pstring += 1; // skip length byte
|
||||
while (pstring < stop)
|
||||
*cstr++ = *pstring++;
|
||||
*cstr = 0;
|
||||
return cstring;
|
||||
}
|
||||
|
||||
uint8_t* hsC2PString(const char cstring[], uint8_t pstring[])
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 1; *cstring; i++)
|
||||
pstring[i] = *cstring++;
|
||||
pstring[0] = i - 1;
|
||||
return pstring;
|
||||
}
|
||||
|
||||
//// IStringToWString /////////////////////////////////////////////////////////
|
||||
// Converts a char * string to a wchar_t * string
|
||||
|
||||
wchar_t *hsStringToWString( const char *str )
|
||||
{
|
||||
// convert the char string to a wchar_t string
|
||||
int len = strlen(str);
|
||||
wchar_t *wideString = new wchar_t[len+1];
|
||||
for (int i=0; i<len; i++)
|
||||
wideString[i] = btowc(str[i]);
|
||||
wideString[len] = L'\0';
|
||||
return wideString;
|
||||
}
|
||||
|
||||
//// IWStringToString /////////////////////////////////////////////////////////
|
||||
// Converts a wchar_t * string to a char * string
|
||||
|
||||
char *hsWStringToString( const wchar_t *str )
|
||||
{
|
||||
// convert the wchar_t string to a char string
|
||||
int len = wcslen(str);
|
||||
char *sStr = new char[len+1];
|
||||
|
||||
int i;
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
char temp = wctob(str[i]);
|
||||
if (temp == WEOF)
|
||||
{
|
||||
sStr[i] = '\0';
|
||||
i = len;
|
||||
}
|
||||
else
|
||||
sStr[i] = temp;
|
||||
}
|
||||
sStr[len] = '\0';
|
||||
|
||||
return sStr;
|
||||
}
|
||||
|
||||
void hsCPathToMacPath(char* dst, char* fname)
|
||||
{
|
||||
int i;
|
||||
|
||||
int offset = 0;
|
||||
hsBool prefix = 1; // Assume its a relative path.
|
||||
|
||||
// KLUDGE: this determines whether a PC path is
|
||||
// relative or absolute. True if relative, therefore
|
||||
// we prefix the pathname with a colon.
|
||||
|
||||
hsStrcpy(dst, "");
|
||||
|
||||
if(strstr(fname, ":"))
|
||||
{
|
||||
prefix = 0;
|
||||
}
|
||||
else if(strstr(fname, "\\\\"))
|
||||
{
|
||||
prefix = 0;
|
||||
offset = 2; // copy fname from 2-Bytes in. This removes
|
||||
// the first two chars...
|
||||
}
|
||||
|
||||
if(prefix)
|
||||
{
|
||||
hsStrcpy(dst, ":");
|
||||
}
|
||||
|
||||
hsStrcat(dst, &fname[offset]);
|
||||
|
||||
// No more slashes? We're done. (Optimization? Not really I guess.)
|
||||
if(!strstr(dst, "\\") && !strstr(dst, "/")) return;
|
||||
|
||||
for(i =0; i < hsStrlen(dst); i++)
|
||||
{
|
||||
if(dst[i] == '\\' || dst[i] == '/')
|
||||
{
|
||||
dst[i] = ':';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int hsRemove(const char * fname)
|
||||
{
|
||||
return remove(fname);
|
||||
|
||||
}
|
||||
|
||||
uint32_t hsPhysicalMemory()
|
||||
{
|
||||
#define HS_ONE_MEGABYTE 1048576 // 1024 * 1024
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
MEMORYSTATUS ms;
|
||||
GlobalMemoryStatus(&ms);
|
||||
return (ms.dwTotalPhys / HS_ONE_MEGABYTE);
|
||||
#endif
|
||||
}
|
||||
|
||||
MemSpec hsMemorySpec()
|
||||
{
|
||||
uint32_t mem = hsPhysicalMemory();
|
||||
|
||||
// Currently adding a little margin of error here
|
||||
// due to the fact that Windows doesn't seem to
|
||||
// be totally accurate in it's calculations.
|
||||
if (mem < 127)
|
||||
return kBlows;
|
||||
else if (mem < 255)
|
||||
return kAcceptable;
|
||||
else
|
||||
return kOptimal;
|
||||
}
|
||||
|
||||
//
|
||||
// Microsoft SAMPLE CODE
|
||||
// returns array of allocated version info strings or nil
|
||||
//
|
||||
char** DisplaySystemVersion()
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
#ifndef VER_SUITE_PERSONAL
|
||||
#define VER_SUITE_PERSONAL 0x200
|
||||
#endif
|
||||
hsTArray<char*> versionStrs;
|
||||
OSVERSIONINFOEX osvi;
|
||||
BOOL bOsVersionInfoEx;
|
||||
|
||||
// Try calling GetVersionEx using the OSVERSIONINFOEX structure.
|
||||
//
|
||||
// If that fails, try using the OSVERSIONINFO structure.
|
||||
|
||||
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
|
||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
||||
|
||||
if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) )
|
||||
{
|
||||
// If OSVERSIONINFOEX doesn't work, try OSVERSIONINFO.
|
||||
|
||||
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
|
||||
if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
switch (osvi.dwPlatformId)
|
||||
{
|
||||
case VER_PLATFORM_WIN32_NT:
|
||||
|
||||
// Test for the product.
|
||||
|
||||
if ( osvi.dwMajorVersion <= 4 )
|
||||
versionStrs.Append(hsStrcpy("Microsoft Windows NT "));
|
||||
|
||||
if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )
|
||||
versionStrs.Append(hsStrcpy ("Microsoft Windows 2000 "));
|
||||
|
||||
if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
|
||||
versionStrs.Append(hsStrcpy ("Microsoft Windows XP "));
|
||||
|
||||
// Test for product type.
|
||||
|
||||
if( bOsVersionInfoEx )
|
||||
{
|
||||
if ( osvi.wProductType == VER_NT_WORKSTATION )
|
||||
{
|
||||
if( osvi.wSuiteMask & VER_SUITE_PERSONAL )
|
||||
versionStrs.Append(hsStrcpy ( "Personal " ));
|
||||
else
|
||||
versionStrs.Append(hsStrcpy ( "Professional " ));
|
||||
}
|
||||
|
||||
else if ( osvi.wProductType == VER_NT_SERVER )
|
||||
{
|
||||
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
|
||||
versionStrs.Append(hsStrcpy ( "DataCenter Server " ));
|
||||
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
|
||||
versionStrs.Append(hsStrcpy ( "Advanced Server " ));
|
||||
else
|
||||
versionStrs.Append(hsStrcpy ( "Server " ));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HKEY hKey;
|
||||
char szProductType[80];
|
||||
DWORD dwBufLen;
|
||||
|
||||
RegOpenKeyEx( HKEY_LOCAL_MACHINE,
|
||||
"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
|
||||
0, KEY_QUERY_VALUE, &hKey );
|
||||
RegQueryValueEx( hKey, "ProductType", NULL, NULL,
|
||||
(LPBYTE) szProductType, &dwBufLen);
|
||||
RegCloseKey( hKey );
|
||||
if ( lstrcmpi( "WINNT", szProductType) == 0 )
|
||||
versionStrs.Append(hsStrcpy( "Professional " ));
|
||||
if ( lstrcmpi( "LANMANNT", szProductType) == 0 )
|
||||
versionStrs.Append(hsStrcpy( "Server " ));
|
||||
if ( lstrcmpi( "SERVERNT", szProductType) == 0 )
|
||||
versionStrs.Append(hsStrcpy( "Advanced Server " ));
|
||||
}
|
||||
|
||||
// Display version, service pack (if any), and build number.
|
||||
|
||||
if ( osvi.dwMajorVersion <= 4 )
|
||||
{
|
||||
versionStrs.Append(hsStrcpy (xtl::format("version %d.%d %s (Build %d)\n",
|
||||
osvi.dwMajorVersion,
|
||||
osvi.dwMinorVersion,
|
||||
osvi.szCSDVersion,
|
||||
osvi.dwBuildNumber & 0xFFFF).c_str()));
|
||||
}
|
||||
else
|
||||
{
|
||||
versionStrs.Append(hsStrcpy (xtl::format("%s (Build %d)\n",
|
||||
osvi.szCSDVersion,
|
||||
osvi.dwBuildNumber & 0xFFFF).c_str()));
|
||||
}
|
||||
break;
|
||||
|
||||
case VER_PLATFORM_WIN32_WINDOWS:
|
||||
|
||||
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
|
||||
{
|
||||
versionStrs.Append(hsStrcpy ("Microsoft Windows 95 "));
|
||||
if ( osvi.szCSDVersion[1] == 'C' || osvi.szCSDVersion[1] == 'B' )
|
||||
versionStrs.Append(hsStrcpy("OSR2 " ));
|
||||
}
|
||||
|
||||
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
|
||||
{
|
||||
versionStrs.Append(hsStrcpy ("Microsoft Windows 98 "));
|
||||
if ( osvi.szCSDVersion[1] == 'A' )
|
||||
versionStrs.Append(hsStrcpy("SE " ));
|
||||
}
|
||||
|
||||
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
|
||||
{
|
||||
versionStrs.Append(hsStrcpy ("Microsoft Windows Me "));
|
||||
}
|
||||
break;
|
||||
|
||||
case VER_PLATFORM_WIN32s:
|
||||
|
||||
versionStrs.Append(hsStrcpy ("Microsoft Win32s "));
|
||||
break;
|
||||
}
|
||||
|
||||
versionStrs.Append(nil); // terminator
|
||||
|
||||
return versionStrs.DetachArray();
|
||||
#else
|
||||
return nil;
|
||||
#endif
|
||||
}
|
@ -1,285 +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==*/
|
||||
|
||||
#ifdef _HSUTILS_H
|
||||
# error "Do not include hsUtils.h directly--use HeadSpin.h"
|
||||
#endif // _HSUTILS_H
|
||||
#define _HSUTILS_H
|
||||
|
||||
#include "HeadSpin.h"
|
||||
#include <cctype>
|
||||
#include <cstring>
|
||||
#include <stdarg.h>
|
||||
|
||||
int hsStrlen(const char src[]);
|
||||
char* hsStrcpy(char dstOrNil[], const char src[]);
|
||||
void hsStrcat(char dst[], const char src[]);
|
||||
bool hsStrEQ(const char s1[], const char s2[]);
|
||||
bool hsStrCaseEQ(const char* s1, const char* s2);
|
||||
char* hsScalarToStr(float);
|
||||
int hsRemove(const char* filename);
|
||||
void hsCPathToMacPath(char* dst, char* fname);
|
||||
void hsStrLower(char *s);
|
||||
char * hsFormatStr(const char * fmt, ...); // You are responsible for returned memory.
|
||||
char * hsFormatStrV(const char * fmt, va_list args); // You are responsible for returned memory.
|
||||
|
||||
// Use "correct" stricmp based on the selected compiler / library
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
# define stricmp _stricmp
|
||||
# define strnicmp _strnicmp
|
||||
# define wcsicmp _wcsicmp
|
||||
# define wcsnicmp _wcsnicmp
|
||||
# define strlwr _strlwr
|
||||
#else
|
||||
# define stricmp strcasecmp
|
||||
# define strnicmp strncasecmp
|
||||
# define wcsicmp wcscasecmp
|
||||
# define wcsnicmp wcsncasecmp
|
||||
# define strlwr hsStrLower
|
||||
#endif
|
||||
|
||||
|
||||
// A pstring has a length uint8_t at the beginning, and no trailing 0
|
||||
char* hsP2CString(const uint8_t pstring[], char cstring[]);
|
||||
uint8_t* hsC2PString(const char cstring[], uint8_t pstring[]);
|
||||
|
||||
inline char* hsStrcpy(const char src[])
|
||||
{
|
||||
return hsStrcpy(nil, src);
|
||||
}
|
||||
|
||||
inline char *hsStrncpy(char *strDest, const char *strSource, size_t count)
|
||||
{
|
||||
char *temp = strncpy(strDest, strSource, count-1);
|
||||
strDest[count-1] = 0;
|
||||
return temp;
|
||||
}
|
||||
|
||||
wchar_t *hsStringToWString( const char *str );
|
||||
char *hsWStringToString( const wchar_t *str );
|
||||
|
||||
enum { // Kind of MessageBox...passed to hsMessageBox
|
||||
hsMessageBoxAbortRetyIgnore,
|
||||
hsMessageBoxNormal, // Just Ok
|
||||
hsMessageBoxOkCancel,
|
||||
hsMessageBoxRetryCancel,
|
||||
hsMessageBoxYesNo,
|
||||
hsMessageBoxYesNoCancel,
|
||||
};
|
||||
|
||||
enum {
|
||||
hsMessageBoxIconError,
|
||||
hsMessageBoxIconQuestion,
|
||||
hsMessageBoxIconExclamation,
|
||||
hsMessageBoxIconAsterisk,
|
||||
};
|
||||
|
||||
enum { // RETURN VALUES FROM hsMessageBox
|
||||
hsMBoxOk = 1, // OK button was selected.
|
||||
hsMBoxCancel, // Cancel button was selected.
|
||||
hsMBoxAbort, // Abort button was selected.
|
||||
hsMBoxRetry, // Retry button was selected.
|
||||
hsMBoxIgnore, // Ignore button was selected.
|
||||
hsMBoxYes, // Yes button was selected.
|
||||
hsMBoxNo // No button was selected.
|
||||
};
|
||||
|
||||
extern bool hsMessageBox_SuppressPrompts;
|
||||
int hsMessageBox(const char message[], const char caption[], int kind, int icon=hsMessageBoxIconAsterisk);
|
||||
int hsMessageBox(const wchar_t message[], const wchar_t caption[], int kind, int icon=hsMessageBoxIconAsterisk);
|
||||
int hsMessageBoxWithOwner(hsWindowHndl owner, const char message[], const char caption[], int kind, int icon=hsMessageBoxIconAsterisk);
|
||||
int hsMessageBoxWithOwner(hsWindowHndl owner, const wchar_t message[], const wchar_t caption[], int kind, int icon=hsMessageBoxIconAsterisk);
|
||||
|
||||
inline hsBool hsCompare(float a, float b, float delta=0.0001);
|
||||
|
||||
// flag testing / clearing
|
||||
#define hsCheckBits(f,c) ((f & c)==c)
|
||||
#define hsTestBits(f,b) ( (f) & (b) )
|
||||
#define hsSetBits(f,b) ( (f) |= (b) )
|
||||
#define hsClearBits(f,b) ( (f) &= ~(b) )
|
||||
#define hsToggleBits(f,b) ( (f) ^= (b) )
|
||||
#define hsChangeBits(f,b,t) ( t ? hsSetBits(f,b) : hsClearBits(f,b) )
|
||||
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
// This is for Windows
|
||||
# define hsVsnprintf _vsnprintf
|
||||
# define hsVsnwprintf _vsnwprintf
|
||||
# define hsSnprintf _snprintf
|
||||
# define hsSnwprintf _snwprintf
|
||||
|
||||
# define snprintf _snprintf
|
||||
# define snwprintf _snwprintf
|
||||
# define swprintf _snwprintf
|
||||
|
||||
# ifndef fileno
|
||||
# define fileno(__F) _fileno(__F)
|
||||
# endif
|
||||
|
||||
# define hsWFopen(name, mode) _wfopen(name, mode)
|
||||
#else
|
||||
// This is for Unix, Linux, OSX, etc.
|
||||
# define hsVsnprintf vsnprintf
|
||||
# define hsVsnwprintf vswprintf
|
||||
# define hsSnprintf snprintf
|
||||
# define hsSnwprintf swprintf
|
||||
|
||||
# define hsWFopen(name, mode) fopen(hsWStringToString(name), hsWStringToString(mode))
|
||||
|
||||
# include <limits.h>
|
||||
# define MAX_PATH PATH_MAX
|
||||
#endif
|
||||
|
||||
// Useful floating point utilities
|
||||
inline float hsDegreesToRadians(float deg) { return float(deg * (M_PI / 180)); }
|
||||
inline float hsRadiansToDegrees(float rad) { return float(rad * (180 / M_PI)); }
|
||||
#define hsInvert(a) (1 / (a))
|
||||
|
||||
#include <new>
|
||||
#define NEWZERO(t) new(calloc(sizeof(t), 1)) t
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define ALIGN(n) __declspec(align(n))
|
||||
#else
|
||||
# define ALIGN(n) __atribute__(aligned(n))
|
||||
#endif
|
||||
|
||||
/////////////////////////////
|
||||
// Physical memory functions
|
||||
/////////////////////////////
|
||||
enum MemSpec
|
||||
{
|
||||
kBlows = 0, // Less than 128
|
||||
kAcceptable, // Less than 256
|
||||
kOptimal // 256 or greater
|
||||
};
|
||||
|
||||
uint32_t hsPhysicalMemory();
|
||||
MemSpec hsMemorySpec();
|
||||
|
||||
inline int hsRandMax() { return 32767; }
|
||||
inline float hsRandNorm() { return 1.f / 32767.f; } // multiply by hsRand to get randoms ranged [0..1]
|
||||
int hsRand(void);
|
||||
void hsRandSeed(int seed);
|
||||
|
||||
#define hsFopen(name, mode) fopen(name, mode)
|
||||
|
||||
char** DisplaySystemVersion();
|
||||
|
||||
/************************ Debug/Error Macros **************************/
|
||||
|
||||
typedef void (*hsDebugMessageProc)(const char message[]);
|
||||
extern hsDebugMessageProc gHSDebugProc;
|
||||
#define HSDebugProc(m) { if (gHSDebugProc) gHSDebugProc(m); }
|
||||
hsDebugMessageProc hsSetDebugMessageProc(hsDebugMessageProc newProc);
|
||||
|
||||
extern hsDebugMessageProc gHSStatusProc;
|
||||
hsDebugMessageProc hsSetStatusMessageProc(hsDebugMessageProc newProc);
|
||||
|
||||
void ErrorEnableGui (bool enabled);
|
||||
void ErrorAssert (int line, const char file[], const char fmt[], ...);
|
||||
|
||||
bool DebugIsDebuggerPresent ();
|
||||
void DebugBreakIfDebuggerPresent ();
|
||||
void DebugMsg(const char fmt[], ...);
|
||||
|
||||
#ifdef HS_DEBUGGING
|
||||
|
||||
void hsDebugMessage(const char message[], long refcon);
|
||||
#define hsDebugCode(code) code
|
||||
#define hsIfDebugMessage(expr, msg, ref) (void)( ((expr) != 0) || (hsDebugMessage(msg, ref), 0) )
|
||||
#define hsAssert(expr, msg) (void)( ((expr) != 0) || (ErrorAssert(__LINE__, __FILE__, msg), 0) )
|
||||
#define ASSERT(expr) (void)( ((expr) != 0) || (ErrorAssert(__LINE__, __FILE__, #expr), 0) )
|
||||
#define ASSERTMSG(expr, msg) (void)( ((expr) != 0) || (ErrorAssert(__LINE__, __FILE__, msg), 0) )
|
||||
#define FATAL(msg) ErrorAssert(__LINE__, __FILE__, msg)
|
||||
#define DEBUG_MSG DebugMsg
|
||||
#define DEBUG_BREAK_IF_DEBUGGER_PRESENT DebugBreakIfDebuggerPresent
|
||||
|
||||
#else /* Not debugging */
|
||||
|
||||
#define hsDebugMessage(message, refcon) NULL_STMT
|
||||
#define hsDebugCode(code) /* empty */
|
||||
#define hsIfDebugMessage(expr, msg, ref) NULL_STMT
|
||||
#define hsAssert(expr, msg) NULL_STMT
|
||||
#define ASSERT(expr) NULL_STMT
|
||||
#define ASSERTMSG(expr, msg) NULL_STMT
|
||||
#define FATAL(msg) NULL_STMT
|
||||
#define DEBUG_MSG (void)
|
||||
#define DEBUG_MSGV NULL_STMT
|
||||
#define DEBUG_BREAK_IF_DEBUGGER_PRESENT NULL_STMT
|
||||
|
||||
#endif // HS_DEBUGGING
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define DEFAULT_FATAL(var) default: FATAL("No valid case for switch variable '" #var "'"); __assume(0); break;
|
||||
#else
|
||||
#define DEFAULT_FATAL(var) default: FATAL("No valid case for switch variable '" #var "'"); break;
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Atomic Operations
|
||||
*
|
||||
***/
|
||||
|
||||
// *value += increment; return original value of *value; thread safe
|
||||
inline long AtomicAdd(long* value, long increment) {
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
return InterlockedExchangeAdd(value, increment);
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
return __sync_fetch_and_add(value, increment);
|
||||
#else
|
||||
#error "No Atomic Set support on this architecture"
|
||||
#endif
|
||||
}
|
||||
|
||||
// *value = value; return original value of *value; thread safe
|
||||
inline long AtomicSet(long* value, long set) {
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
return InterlockedExchange(value, set);
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
return __sync_lock_test_and_set(value, set);
|
||||
#else
|
||||
#error "No Atomic Set support on this architecture"
|
||||
#endif
|
||||
}
|
@ -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));
|
||||
}
|
||||
|
@ -1,101 +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==*/
|
||||
|
||||
#ifdef _HSWINDOWS_H
|
||||
# error "Do not include hsWindows.h directly--use HeadSpin.h"
|
||||
#endif // _HSWINDOWS_H
|
||||
#define _HSWINDOWS_H
|
||||
|
||||
#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 // _MSC_VER
|
||||
|
||||
// Terrible hacks for MinGW because they don't have a reasonable
|
||||
// default for the Windows version. We cheat and say it's XP.
|
||||
# ifdef __MINGW32__
|
||||
# undef _WIN32_WINNT
|
||||
# define _WIN32_WINNT 0x501
|
||||
# undef _WIN32_IE
|
||||
# define _WIN32_IE 0x400
|
||||
# endif
|
||||
|
||||
// Windows.h includes winsock.h (winsocks 1), so we need to manually include winsock2
|
||||
// and tell Windows.h to only bring in modern headers
|
||||
# ifndef MAXPLUGINCODE
|
||||
# include <WinSock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
# endif // MAXPLUGINCODE
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# ifndef NOMINMAX
|
||||
# define NOMINMAX // Needed to prevent NxMath conflicts
|
||||
# endif
|
||||
# include <Windows.h>
|
||||
|
||||
typedef HWND hsWindowHndl;
|
||||
typedef HINSTANCE hsWindowInst;
|
||||
#else
|
||||
typedef int32_t* hsWindowHndl;
|
||||
typedef int32_t* hsWindowInst;
|
||||
#endif // HS_BUILD_FOR_WIN32
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* max/min inline functions
|
||||
*
|
||||
***/
|
||||
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
@ -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[]);
|
||||
};
|
||||
|
@ -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; }
|
||||
|
||||
};
|
||||
|
||||
|
@ -523,7 +523,7 @@ void pfBoid::ISetupToken(pfProximityDatabase &pd)
|
||||
fProximityToken = pd.MakeToken(this);
|
||||
}
|
||||
|
||||
hsBool pfBoid::IInBoidNeighborhood(const pfVehicle &other, const float minDistance, const float maxDistance, const float cosMaxAngle)
|
||||
bool pfBoid::IInBoidNeighborhood(const pfVehicle &other, const float minDistance, const float maxDistance, const float cosMaxAngle)
|
||||
{
|
||||
if (&other == this) // abort if we're looking at ourselves
|
||||
return false;
|
||||
@ -929,7 +929,7 @@ void pfObjectFlocker::SetNumBoids(uint8_t val)
|
||||
fNumBoids = val;
|
||||
}
|
||||
|
||||
hsBool pfObjectFlocker::MsgReceive(plMessage* msg)
|
||||
bool pfObjectFlocker::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plInitialAgeStateLoadedMsg* loadMsg = plInitialAgeStateLoadedMsg::ConvertNoRef(msg);
|
||||
if (loadMsg)
|
||||
@ -979,7 +979,7 @@ hsBool pfObjectFlocker::MsgReceive(plMessage* msg)
|
||||
return plSingleModifier::MsgReceive(msg);
|
||||
}
|
||||
|
||||
hsBool pfObjectFlocker::IEval(double secs, float del, uint32_t dirty)
|
||||
bool pfObjectFlocker::IEval(double secs, float del, uint32_t dirty)
|
||||
{
|
||||
fFlock.Update(fTarget, del);
|
||||
|
||||
|
@ -255,7 +255,7 @@ private:
|
||||
hsPoint3 fCurPos;
|
||||
hsVector3 fForward;
|
||||
float fSpeed; // in meters/sec
|
||||
hsBool fHasLastPos; // does the last position make sense?
|
||||
bool fHasLastPos; // does the last position make sense?
|
||||
public:
|
||||
pfBoidGoal();
|
||||
~pfBoidGoal() {}
|
||||
@ -301,7 +301,7 @@ private:
|
||||
void ISetupToken(pfProximityDatabase &pd);
|
||||
|
||||
// Are we in the neighborhood of another boid?
|
||||
hsBool IInBoidNeighborhood(const pfVehicle &other, const float minDistance, const float maxDistance, const float cosMaxAngle);
|
||||
bool IInBoidNeighborhood(const pfVehicle &other, const float minDistance, const float maxDistance, const float cosMaxAngle);
|
||||
// Wander steering
|
||||
hsVector3 ISteerForWander(float timeDelta);
|
||||
// Seek the target point
|
||||
@ -403,7 +403,7 @@ public:
|
||||
GETINTERFACE_ANY( pfObjectFlocker, plSingleModifier );
|
||||
|
||||
virtual void SetTarget(plSceneObject* so);
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
@ -433,10 +433,10 @@ public:
|
||||
float MinSpeed() const {return fFlock.MinSpeed();}
|
||||
void SetMinSpeed(float minSpeed) {fFlock.SetMinSpeed(minSpeed);}
|
||||
|
||||
hsBool RandomizeAnimStart() const {return fRandomizeAnimationStart;}
|
||||
void SetRandomizeAnimStart(hsBool val) {fRandomizeAnimationStart = val;}
|
||||
hsBool UseTargetRotation() const {return fUseTargetRotation;}
|
||||
void SetUseTargetRotation(hsBool val) {fUseTargetRotation = val;}
|
||||
bool RandomizeAnimStart() const {return fRandomizeAnimationStart;}
|
||||
void SetRandomizeAnimStart(bool val) {fRandomizeAnimationStart = val;}
|
||||
bool UseTargetRotation() const {return fUseTargetRotation;}
|
||||
void SetUseTargetRotation(bool val) {fUseTargetRotation = val;}
|
||||
|
||||
protected:
|
||||
const static int fFileVersion; // so we don't have to update the global version number when we change
|
||||
@ -445,10 +445,10 @@ protected:
|
||||
int fNumBoids;
|
||||
plKey fBoidKey;
|
||||
|
||||
hsBool fUseTargetRotation;
|
||||
hsBool fRandomizeAnimationStart;
|
||||
bool fUseTargetRotation;
|
||||
bool fRandomizeAnimationStart;
|
||||
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty);
|
||||
virtual bool IEval(double secs, float del, uint32_t dirty);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
class plAnimDebugList
|
||||
{
|
||||
public:
|
||||
hsBool fEnabled;
|
||||
bool fEnabled;
|
||||
hsTArray<plKey> fSOKeys;
|
||||
hsTArray<plKey> fMaterialKeys;
|
||||
|
||||
|
@ -145,7 +145,7 @@ void plBlower::IBlow(double secs, float delSecs)
|
||||
fCurrDel = del;
|
||||
}
|
||||
|
||||
hsBool plBlower::IEval(double secs, float delSecs, uint32_t dirty)
|
||||
bool plBlower::IEval(double secs, float delSecs, uint32_t dirty)
|
||||
{
|
||||
const float kMaxDelSecs = 0.1f;
|
||||
if( delSecs > kMaxDelSecs )
|
||||
|
@ -86,7 +86,7 @@ protected:
|
||||
void ISetTargetTransform();
|
||||
void IBlow(double secs, float delSecs);
|
||||
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty);
|
||||
virtual bool IEval(double secs, float del, uint32_t dirty);
|
||||
public:
|
||||
~plBlower();
|
||||
plBlower();
|
||||
|
@ -64,7 +64,7 @@ plFollowMod::~plFollowMod()
|
||||
#include "plProfile.h"
|
||||
plProfile_CreateTimer("FollowMod", "RenderSetup", FollowMod);
|
||||
|
||||
hsBool plFollowMod::MsgReceive(plMessage* msg)
|
||||
bool plFollowMod::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plRenderMsg* rend = plRenderMsg::ConvertNoRef(msg);
|
||||
if( rend )
|
||||
@ -110,7 +110,7 @@ hsBool plFollowMod::MsgReceive(plMessage* msg)
|
||||
return plSingleModifier::MsgReceive(msg);
|
||||
}
|
||||
|
||||
hsBool plFollowMod::ICheckLeader()
|
||||
bool plFollowMod::ICheckLeader()
|
||||
{
|
||||
switch( fLeaderType )
|
||||
{
|
||||
@ -218,7 +218,7 @@ void plFollowMod::IMoveTarget()
|
||||
GetTarget()->SetTransform(l2w, w2l);
|
||||
}
|
||||
|
||||
hsBool plFollowMod::IEval(double secs, float del, uint32_t dirty)
|
||||
bool plFollowMod::IEval(double secs, float del, uint32_t dirty)
|
||||
{
|
||||
if( ICheckLeader() )
|
||||
IMoveTarget();
|
||||
|
@ -84,10 +84,10 @@ protected:
|
||||
hsMatrix44 fLeaderL2W;
|
||||
hsMatrix44 fLeaderW2L;
|
||||
|
||||
hsBool ICheckLeader();
|
||||
bool ICheckLeader();
|
||||
void IMoveTarget();
|
||||
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty);
|
||||
virtual bool IEval(double secs, float del, uint32_t dirty);
|
||||
|
||||
public:
|
||||
plFollowMod();
|
||||
@ -96,7 +96,7 @@ public:
|
||||
CLASSNAME_REGISTER( plFollowMod );
|
||||
GETINTERFACE_ANY( plFollowMod, plSingleModifier );
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
virtual hsBool HasAnima() const { return fColorCtl || fAmbientCtl || fSpecularCtl; }
|
||||
virtual bool HasAnima() const { return fColorCtl || fAmbientCtl || fSpecularCtl; }
|
||||
|
||||
// Export only
|
||||
void SetColorCtl(plController* ctl) { fColorCtl = ctl; }
|
||||
@ -115,7 +115,7 @@ public:
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
virtual hsBool HasAnima() const { return plLightModifier::HasAnima() || fAttenCtl; }
|
||||
virtual bool HasAnima() const { return plLightModifier::HasAnima() || fAttenCtl; }
|
||||
|
||||
// Export Only
|
||||
void SetAttenCtl(plController* ctl) { fAttenCtl = ctl; }
|
||||
@ -128,7 +128,7 @@ class plSpotModifier : public plOmniModifier
|
||||
{
|
||||
protected:
|
||||
|
||||
plSpotLightInfo* fSpot;
|
||||
plSpotLightInfo* fSpot;
|
||||
|
||||
plController* fInnerCtl;
|
||||
plController* fOuterCtl;
|
||||
@ -149,7 +149,7 @@ public:
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
virtual hsBool HasAnima() const { return plOmniModifier::HasAnima() || fInnerCtl || fOuterCtl; }
|
||||
virtual bool HasAnima() const { return plOmniModifier::HasAnima() || fInnerCtl || fOuterCtl; }
|
||||
|
||||
// Export Only
|
||||
void SetInnerCtl(plController* ctl) { fInnerCtl = ctl; }
|
||||
@ -184,7 +184,7 @@ public:
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
virtual hsBool HasAnima() const { return plLightModifier::HasAnima() || fWidthCtl || fHeightCtl || fDepthCtl; }
|
||||
virtual bool HasAnima() const { return plLightModifier::HasAnima() || fWidthCtl || fHeightCtl || fDepthCtl; }
|
||||
|
||||
// Export Only
|
||||
void SetWidthCtl(plController* ctl) { fWidthCtl = ctl; }
|
||||
|
@ -107,7 +107,7 @@ void plLineFollowMod::SetOffsetFeet(float f)
|
||||
}
|
||||
}
|
||||
|
||||
void plLineFollowMod::SetForceToLine(hsBool on)
|
||||
void plLineFollowMod::SetForceToLine(bool on)
|
||||
{
|
||||
if( on )
|
||||
fFollowFlags |= kForceToLine;
|
||||
@ -218,7 +218,7 @@ void plLineFollowMod::Write(hsStream* stream, hsResMgr* mgr)
|
||||
#include "plProfile.h"
|
||||
plProfile_CreateTimer("LineFollow", "RenderSetup", LineFollow);
|
||||
|
||||
hsBool plLineFollowMod::MsgReceive(plMessage* msg)
|
||||
bool plLineFollowMod::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plGenRefMsg* refMsg = plGenRefMsg::ConvertNoRef(msg);
|
||||
if( refMsg )
|
||||
@ -337,7 +337,7 @@ void plLineFollowMod::IRegister()
|
||||
}
|
||||
}
|
||||
|
||||
hsBool plLineFollowMod::IEval(double secs, float del, uint32_t dirty)
|
||||
bool plLineFollowMod::IEval(double secs, float del, uint32_t dirty)
|
||||
{
|
||||
if( !fPath )
|
||||
return false;
|
||||
@ -361,7 +361,7 @@ hsBool plLineFollowMod::IEval(double secs, float del, uint32_t dirty)
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool plLineFollowMod::IOffsetTargetTransform(hsMatrix44& tgtXfm)
|
||||
bool plLineFollowMod::IOffsetTargetTransform(hsMatrix44& tgtXfm)
|
||||
{
|
||||
hsPoint3 tgtPos = tgtXfm.GetTranslate();
|
||||
|
||||
@ -407,7 +407,7 @@ hsBool plLineFollowMod::IOffsetTargetTransform(hsMatrix44& tgtXfm)
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool plLineFollowMod::IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tgtXfm)
|
||||
bool plLineFollowMod::IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tgtXfm)
|
||||
{
|
||||
float t = fPath->GetExtremePoint(searchPos);
|
||||
if( fFollowFlags & kFullMatrix )
|
||||
@ -453,7 +453,7 @@ void plLineFollowMod::ICheckForPop(const hsPoint3& oldPos, const hsPoint3& newPo
|
||||
fFollowFlags &= ~kSearchPosPop;
|
||||
}
|
||||
|
||||
hsBool plLineFollowMod::IGetSearchPos()
|
||||
bool plLineFollowMod::IGetSearchPos()
|
||||
{
|
||||
hsPoint3 oldPos = fSearchPos;
|
||||
if( kFollowObject == fFollowMode )
|
||||
@ -642,7 +642,7 @@ plRailCameraMod::~plRailCameraMod()
|
||||
{
|
||||
}
|
||||
|
||||
hsBool plRailCameraMod::IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tgtXfm)
|
||||
bool plRailCameraMod::IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tgtXfm)
|
||||
{
|
||||
if (fPath->GetFarthest())
|
||||
{
|
||||
|
@ -97,14 +97,14 @@ protected:
|
||||
float fOffsetClamp;
|
||||
float fSpeedClamp;
|
||||
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty);
|
||||
virtual bool IEval(double secs, float del, uint32_t dirty);
|
||||
|
||||
virtual hsBool IGetSearchPos();
|
||||
virtual bool IGetSearchPos();
|
||||
virtual void ISetTargetTransform(int iTarg, const hsMatrix44& tgtXfm);
|
||||
virtual void ISetPathTransform();
|
||||
|
||||
virtual hsBool IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tgtXfm);
|
||||
virtual hsBool IOffsetTargetTransform(hsMatrix44& tgtXfm);
|
||||
virtual bool IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tgtXfm);
|
||||
virtual bool IOffsetTargetTransform(hsMatrix44& tgtXfm);
|
||||
virtual hsMatrix44 ISpeedClamp(plCoordinateInterface* ci, const hsMatrix44& unclTgtXfm);
|
||||
hsMatrix44 IInterpMatrices(const hsMatrix44& m0, const hsMatrix44& m1, float parm);
|
||||
void ICheckForPop(const hsPoint3& oldPos, const hsPoint3& newPos);
|
||||
@ -132,28 +132,28 @@ public:
|
||||
void SetFollowMode(FollowMode f);
|
||||
FollowMode GetFollowMode() const { return fFollowMode; }
|
||||
|
||||
hsBool HasOffsetFeet() const { return 0 != (fFollowFlags & kOffsetFeet); }
|
||||
hsBool HasOffsetDegrees() const { return 0 != (fFollowFlags & kOffsetAng); }
|
||||
hsBool HasOffset() const { return 0 != (fFollowFlags & kOffset); }
|
||||
hsBool HasOffsetClamp() const { return 0 != (fFollowFlags & kOffsetClamp); }
|
||||
hsBool HasSpeedClamp() const { return 0 != (fFollowFlags & kSpeedClamp); }
|
||||
bool HasOffsetFeet() const { return 0 != (fFollowFlags & kOffsetFeet); }
|
||||
bool HasOffsetDegrees() const { return 0 != (fFollowFlags & kOffsetAng); }
|
||||
bool HasOffset() const { return 0 != (fFollowFlags & kOffset); }
|
||||
bool HasOffsetClamp() const { return 0 != (fFollowFlags & kOffsetClamp); }
|
||||
bool HasSpeedClamp() const { return 0 != (fFollowFlags & kSpeedClamp); }
|
||||
|
||||
void SetOffsetFeet(float f);
|
||||
float GetOffsetFeet() const { return fOffset; }
|
||||
float GetOffsetFeet() const { return fOffset; }
|
||||
|
||||
void SetOffsetDegrees(float f);
|
||||
float GetOffsetDegrees() const { return hsRadiansToDegrees(fOffset); }
|
||||
float GetOffsetDegrees() const { return hsRadiansToDegrees(fOffset); }
|
||||
|
||||
void SetOffsetClamp(float f);
|
||||
float GetOffsetClamp() const { return fOffsetClamp; }
|
||||
float GetOffsetClamp() const { return fOffsetClamp; }
|
||||
|
||||
void SetForceToLine(hsBool on);
|
||||
hsBool GetForceToLine() const { return 0 != (fFollowFlags & kForceToLine); }
|
||||
void SetForceToLine(bool on);
|
||||
bool GetForceToLine() const { return 0 != (fFollowFlags & kForceToLine); }
|
||||
|
||||
void SetSpeedClamp(float feetPerSec);
|
||||
float GetSpeedClamp() const { return fSpeedClamp; }
|
||||
float GetSpeedClamp() const { return fSpeedClamp; }
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
bool MsgReceive(plMessage* msg);
|
||||
|
||||
virtual void AddTarget(plSceneObject* so);
|
||||
virtual void RemoveTarget(plSceneObject* so);
|
||||
@ -180,12 +180,12 @@ public:
|
||||
protected:
|
||||
|
||||
virtual void ISetTargetTransform(int iTarg, const hsMatrix44& tgtXfm) {fDesiredMatrix = tgtXfm;}
|
||||
virtual hsBool IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tgtXfm);
|
||||
virtual bool IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tgtXfm);
|
||||
|
||||
hsMatrix44 fDesiredMatrix;
|
||||
float fCurrentTime;
|
||||
float fTargetTime;
|
||||
float fCurrentTime;
|
||||
float fTargetTime;
|
||||
hsPoint3 fGoal;
|
||||
hsBool fFarthest;
|
||||
bool fFarthest;
|
||||
};
|
||||
#endif // plLineFollowMod_inc
|
||||
|
@ -128,7 +128,7 @@ int plRandomCommandMod::IExcludeSelections(int ncmds)
|
||||
|
||||
float plRandomCommandMod::IGetDelay(float len) const
|
||||
{
|
||||
float r = float(hsRand() * kRandNormalize);
|
||||
float r = float(rand() * kRandNormalize);
|
||||
|
||||
float delay = fMinDelay + (fMaxDelay - fMinDelay) * r;
|
||||
|
||||
@ -141,7 +141,7 @@ float plRandomCommandMod::IGetDelay(float len) const
|
||||
return delay;
|
||||
}
|
||||
|
||||
hsBool plRandomCommandMod::ISelectNext(int ncmds)
|
||||
bool plRandomCommandMod::ISelectNext(int ncmds)
|
||||
{
|
||||
if( fMode & kSequential )
|
||||
{
|
||||
@ -156,7 +156,7 @@ hsBool plRandomCommandMod::ISelectNext(int ncmds)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
float r = float(hsRand() * kRandNormalize);
|
||||
float r = float(rand() * kRandNormalize);
|
||||
|
||||
int nSelect = ncmds;
|
||||
|
||||
@ -200,11 +200,6 @@ void plRandomCommandMod::IStop()
|
||||
fState |= kStopped;
|
||||
}
|
||||
|
||||
hsBool plRandomCommandMod::IStopped() const
|
||||
{
|
||||
return 0 != (fState & kStopped);
|
||||
}
|
||||
|
||||
void plRandomCommandMod::IPlayNextIfMaster()
|
||||
{
|
||||
if( !fTarget )
|
||||
@ -219,7 +214,7 @@ void plRandomCommandMod::IPlayNextIfMaster()
|
||||
IPlayNext();
|
||||
}
|
||||
|
||||
hsBool plRandomCommandMod::MsgReceive(plMessage* msg)
|
||||
bool plRandomCommandMod::MsgReceive(plMessage* msg)
|
||||
{
|
||||
// plAnimCmdMsg - interpret start/stop appropriately.
|
||||
// could overinterpret set loop points to limit range of
|
||||
|
@ -78,7 +78,7 @@ protected:
|
||||
|
||||
void IStart();
|
||||
virtual void IStop();
|
||||
hsBool IStopped() const;
|
||||
bool IStopped() const { return hsCheckBits(fState, kStopped); }
|
||||
void IRetry(float secs);
|
||||
virtual void IPlayNextIfMaster();
|
||||
|
||||
@ -87,14 +87,14 @@ protected:
|
||||
float IGetDelay(float len) const;
|
||||
|
||||
int IExcludeSelections(int ncmds);
|
||||
hsBool ISelectNext(int nAnim); // return false if we should stop, else set fCurrent to next index
|
||||
bool ISelectNext(int nAnim); // return false if we should stop, else set fCurrent to next index
|
||||
|
||||
// Once fCurrent is set to the next animation index to play,
|
||||
// IPlayNext() does whatever it takes to actually play it.
|
||||
virtual void IPlayNext() = 0;
|
||||
|
||||
// We only act in response to messages.
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; }
|
||||
virtual bool IEval(double secs, float del, uint32_t dirty) { return false; }
|
||||
|
||||
public:
|
||||
plRandomCommandMod();
|
||||
@ -103,23 +103,23 @@ public:
|
||||
CLASSNAME_REGISTER( plRandomCommandMod );
|
||||
GETINTERFACE_ANY( plRandomCommandMod, plSingleModifier );
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* pMsg);
|
||||
virtual bool MsgReceive(plMessage* pMsg);
|
||||
|
||||
virtual void Read(hsStream* s, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* s, hsResMgr* mgr);
|
||||
|
||||
// Export only
|
||||
void SetMode(uint8_t m) { fMode = m; }
|
||||
uint8_t GetMode() const { return fMode; }
|
||||
uint8_t GetMode() const { return fMode; }
|
||||
|
||||
void SetState(uint8_t s) { fState = s; }
|
||||
uint8_t GetState() const { return fState; }
|
||||
uint8_t GetState() const { return fState; }
|
||||
|
||||
void SetMinDelay(float f) { fMinDelay = f; }
|
||||
float GetMinDelay() const { return fMinDelay; }
|
||||
void SetMinDelay(float f) { fMinDelay = f; }
|
||||
float GetMinDelay() const { return fMinDelay; }
|
||||
|
||||
void SetMaxDelay(float f) { fMaxDelay = f; }
|
||||
float GetMaxDelay() const { return fMaxDelay; }
|
||||
void SetMaxDelay(float f) { fMaxDelay = f; }
|
||||
float GetMaxDelay() const { return fMaxDelay; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -107,7 +107,7 @@ void plStereizer::Write(hsStream* stream, hsResMgr* mgr)
|
||||
fInitPos.Write(stream);
|
||||
}
|
||||
|
||||
hsBool plStereizer::MsgReceive(plMessage* msg)
|
||||
bool plStereizer::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plListenerMsg* listenMsg = plListenerMsg::ConvertNoRef(msg);
|
||||
if( listenMsg )
|
||||
@ -119,12 +119,12 @@ hsBool plStereizer::MsgReceive(plMessage* msg)
|
||||
return plSingleModifier::MsgReceive(msg);
|
||||
}
|
||||
|
||||
hsBool plStereizer::IEval(double secs, float del, uint32_t dirty)
|
||||
bool plStereizer::IEval(double secs, float del, uint32_t dirty)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool plStereizer::Stereize()
|
||||
bool plStereizer::Stereize()
|
||||
{
|
||||
plSceneObject* targ = GetTarget();
|
||||
if( !targ )
|
||||
@ -286,7 +286,7 @@ plCoordinateInterface* plStereizer::IGetParent() const
|
||||
// Or in simpler terms, I want to do it one way, Brice wants to do
|
||||
// it another, and since either would work for this, we're waiting
|
||||
// for a tie breaker case that gives one way or the other an advantage.
|
||||
hsBool plStereizer::CheckForMaster()
|
||||
bool plStereizer::CheckForMaster()
|
||||
{
|
||||
ISetHasMaster(false);
|
||||
plSceneObject* targ = GetTarget();
|
||||
|
@ -82,7 +82,7 @@ protected:
|
||||
hsVector3 fListDirection;
|
||||
hsVector3 fListUp;
|
||||
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty);
|
||||
virtual bool IEval(double secs, float del, uint32_t dirty);
|
||||
|
||||
hsPoint3 IGetLocalizedPos(const hsVector3& posToList, float distToList) const;
|
||||
hsPoint3 IGetAmbientPos() const;
|
||||
@ -92,7 +92,7 @@ protected:
|
||||
|
||||
plCoordinateInterface* IGetParent() const;
|
||||
|
||||
void ISetHasMaster(hsBool on) { if(on)SetFlag(kHasMaster); else ClearFlag(kHasMaster); }
|
||||
void ISetHasMaster(bool on) { if(on)SetFlag(kHasMaster); else ClearFlag(kHasMaster); }
|
||||
|
||||
public:
|
||||
plStereizer();
|
||||
@ -104,9 +104,9 @@ public:
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
|
||||
hsBool Stereize();
|
||||
bool Stereize();
|
||||
void SetFromListenerMsg(const plListenerMsg* listMsg);
|
||||
|
||||
void SetAmbientDist(float d) { fAmbientDist = d; }
|
||||
@ -124,8 +124,8 @@ public:
|
||||
void SetSepAngle(float rads);
|
||||
float GetSepAngle() const;
|
||||
|
||||
void SetAsLeftChannel(hsBool on) { if(on)SetFlag(kLeftChannel); else ClearFlag(kLeftChannel); }
|
||||
hsBool IsLeftChannel() const { return HasFlag(kLeftChannel); }
|
||||
void SetAsLeftChannel(bool on) { if(on)SetFlag(kLeftChannel); else ClearFlag(kLeftChannel); }
|
||||
bool IsLeftChannel() const { return HasFlag(kLeftChannel); }
|
||||
|
||||
void SetParentInitPos(const hsPoint3& pos) { fInitPos = pos; }
|
||||
const hsPoint3& GetParentInitPos() const { return fInitPos; }
|
||||
@ -133,8 +133,8 @@ public:
|
||||
void SetWorldInitPos(const hsPoint3& pos);
|
||||
hsPoint3 GetWorldInitPos() const;
|
||||
|
||||
hsBool CheckForMaster();
|
||||
hsBool HasMaster() const { return HasFlag(kHasMaster); }
|
||||
bool CheckForMaster();
|
||||
bool HasMaster() const { return HasFlag(kHasMaster); }
|
||||
};
|
||||
|
||||
#endif // plStereizer_inc
|
@ -129,12 +129,12 @@ void plViewFaceModifier::SetTarget(plSceneObject* so)
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plArmatureUpdateMsg::Index(), GetKey());
|
||||
}
|
||||
|
||||
hsBool plViewFaceModifier::IEval(double secs, float del, uint32_t dirty)
|
||||
bool plViewFaceModifier::IEval(double secs, float del, uint32_t dirty)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool plViewFaceModifier::IFacePoint(plPipeline* pipe, const hsPoint3& at)
|
||||
bool plViewFaceModifier::IFacePoint(plPipeline* pipe, const hsPoint3& at)
|
||||
{
|
||||
#if 1 // BOUNDSTEST
|
||||
extern int mfCurrentTest;
|
||||
@ -272,7 +272,7 @@ hsBool plViewFaceModifier::IFacePoint(plPipeline* pipe, const hsPoint3& at)
|
||||
#include "plProfile.h"
|
||||
plProfile_CreateTimer("ViewFacing", "RenderSetup", ViewFace);
|
||||
|
||||
hsBool plViewFaceModifier::MsgReceive(plMessage* msg)
|
||||
bool plViewFaceModifier::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plRenderMsg* rend = plRenderMsg::ConvertNoRef(msg);
|
||||
|
||||
@ -438,7 +438,7 @@ plViewFaceModifier::FollowMode plViewFaceModifier::GetFollowMode() const
|
||||
|
||||
}
|
||||
|
||||
void plViewFaceModifier::SetOffset(const hsVector3& off, hsBool local)
|
||||
void plViewFaceModifier::SetOffset(const hsVector3& off, bool local)
|
||||
{
|
||||
fOffset = off;
|
||||
if( local )
|
||||
|
@ -83,8 +83,8 @@ protected:
|
||||
|
||||
hsBounds3Ext fMaxBounds;
|
||||
|
||||
virtual hsBool IFacePoint(plPipeline* pipe, const hsPoint3& at);
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty);
|
||||
virtual bool IFacePoint(plPipeline* pipe, const hsPoint3& at);
|
||||
virtual bool IEval(double secs, float del, uint32_t dirty);
|
||||
|
||||
enum RefType
|
||||
{
|
||||
@ -106,7 +106,7 @@ public:
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
|
||||
// ViewFace specific
|
||||
void SetScale(const hsVector3& s) { fScale = s; }
|
||||
@ -116,7 +116,7 @@ public:
|
||||
|
||||
void SetMaxBounds(const hsBounds3Ext& bnd);
|
||||
const hsBounds3Ext& GetMaxBounds() const { return fMaxBounds; }
|
||||
hsBool HaveMaxBounds() const { return HasFlag(kMaxBounds); }
|
||||
bool HaveMaxBounds() const { return HasFlag(kMaxBounds); }
|
||||
|
||||
enum FollowMode
|
||||
{
|
||||
@ -129,12 +129,12 @@ public:
|
||||
FollowMode GetFollowMode() const;
|
||||
plSceneObject* GetFollowObject() const { return fFaceObj; }
|
||||
|
||||
void SetOffsetActive(hsBool on) { if(on) SetFlag(kOffset); else ClearFlag(kOffset); }
|
||||
hsBool GetOffsetActive() const { return HasFlag(kOffset); }
|
||||
void SetOffsetActive(bool on) { if(on) SetFlag(kOffset); else ClearFlag(kOffset); }
|
||||
bool GetOffsetActive() const { return HasFlag(kOffset); }
|
||||
|
||||
void SetOffset(const hsVector3& off, hsBool local=true);
|
||||
void SetOffset(const hsVector3& off, bool local=true);
|
||||
const hsVector3& GetOffset() const { return fOffset; }
|
||||
hsBool GetOffsetLocal() const { return HasFlag(kOffsetLocal); }
|
||||
bool GetOffsetLocal() const { return HasFlag(kOffsetLocal); }
|
||||
};
|
||||
|
||||
#endif // plViewFaceModifier_inc
|
||||
|
@ -59,9 +59,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plAvatar/plArmatureMod.h"
|
||||
#include "plAvatar/plAvCallbackAction.h"
|
||||
|
||||
hsBool plListener::fPrintDbgInfo = false;
|
||||
bool plListener::fPrintDbgInfo = false;
|
||||
|
||||
hsBool plListener::IEval(double secs, float del, uint32_t dirty)
|
||||
bool plListener::IEval(double secs, float del, uint32_t dirty)
|
||||
{
|
||||
// if (!plgAudioSys::Active())
|
||||
// return true;
|
||||
@ -204,7 +204,7 @@ hsBool plListener::IEval(double secs, float del, uint32_t dirty)
|
||||
return true;
|
||||
}
|
||||
|
||||
void plListener::ISetRef( const plKey &ref, hsBool binding, int type )
|
||||
void plListener::ISetRef( const plKey &ref, bool binding, int type )
|
||||
{
|
||||
if( binding )
|
||||
hsgResMgr::ResMgr()->AddViaNotify( ref, new plGenRefMsg( GetKey(), plGenRefMsg::kOnReplace, -1, type ), plRefFlags::kPassiveRef );
|
||||
@ -243,12 +243,12 @@ void plListener::ICheckAudio( void ) const
|
||||
plgAudioSys::SetMuted( true );
|
||||
}
|
||||
|
||||
hsBool plListener::MsgReceive(plMessage* msg)
|
||||
bool plListener::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plSetListenerMsg *setMsg = plSetListenerMsg::ConvertNoRef( msg );
|
||||
if( setMsg != nil )
|
||||
{
|
||||
hsBool useVCam;
|
||||
bool useVCam;
|
||||
|
||||
if( setMsg->GetType() & plSetListenerMsg::kVCam )
|
||||
{
|
||||
|
@ -58,9 +58,9 @@ public:
|
||||
CLASSNAME_REGISTER( plListener );
|
||||
GETINTERFACE_ANY( plListener, plSingleModifier );
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
|
||||
static void ShowDebugInfo( hsBool s ) { fPrintDbgInfo = s; }
|
||||
static void ShowDebugInfo( bool s ) { fPrintDbgInfo = s; }
|
||||
|
||||
// Get info for which object these things are attached to - camera or refObject
|
||||
uint8_t GetAttachedPosType() { return (uint8_t)fPosRatio; }
|
||||
@ -83,13 +83,13 @@ protected:
|
||||
|
||||
plVirtualCam1* fVCam;
|
||||
|
||||
float fPosRatio, fFacingRatio, fVelRatio; // 0 is vCam, 1 is refObject
|
||||
hsBool fInitMe;
|
||||
float fPosRatio, fFacingRatio, fVelRatio; // 0 is vCam, 1 is refObject
|
||||
bool fInitMe;
|
||||
|
||||
static hsBool fPrintDbgInfo;
|
||||
static bool fPrintDbgInfo;
|
||||
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty);
|
||||
void ISetRef( const plKey &ref, hsBool binding, int type );
|
||||
virtual bool IEval(double secs, float del, uint32_t dirty);
|
||||
void ISetRef( const plKey &ref, bool binding, int type );
|
||||
void ICheckAudio( void ) const;
|
||||
|
||||
void IEnsureVCamValid( void );
|
||||
|
@ -317,7 +317,7 @@ void plRandomSoundMod::Write(hsStream *s, hsResMgr *mgr)
|
||||
}
|
||||
}
|
||||
|
||||
void plRandomSoundMod::ForceSoundLoadState( hsBool loaded )
|
||||
void plRandomSoundMod::ForceSoundLoadState( bool loaded )
|
||||
{
|
||||
uint16_t i, j;
|
||||
|
||||
@ -370,7 +370,7 @@ void plRandomSoundMod::ForceSoundLoadState( hsBool loaded )
|
||||
}
|
||||
|
||||
// Overload this to handle volume changes
|
||||
hsBool plRandomSoundMod::MsgReceive(plMessage* msg)
|
||||
bool plRandomSoundMod::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plAnimCmdMsg* anim = plAnimCmdMsg::ConvertNoRef(msg);
|
||||
if( anim )
|
||||
|
@ -72,7 +72,7 @@ protected:
|
||||
plRandomSoundModGroup *fGroups;
|
||||
std::vector<uint16_t> fActiveList; // list of sounds we're allowed to choose
|
||||
int fOldPriority; // old sound priority
|
||||
hsBool fFirstTimePlay;
|
||||
bool fFirstTimePlay;
|
||||
|
||||
virtual void IPlayNext();
|
||||
virtual void IPlayNextIfMaster();
|
||||
@ -93,8 +93,8 @@ public:
|
||||
|
||||
void SetCurrentGroup(uint16_t group);
|
||||
|
||||
void ForceSoundLoadState( hsBool loaded );
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
void ForceSoundLoadState( bool loaded );
|
||||
bool MsgReceive(plMessage* msg);
|
||||
float GetVolume();
|
||||
|
||||
// EXPORT ONLY
|
||||
|
@ -57,7 +57,7 @@ plCameraProxy::~plCameraProxy()
|
||||
{
|
||||
}
|
||||
|
||||
hsBool plCameraProxy::Init(plVirtualCam1* aud)
|
||||
bool plCameraProxy::Init(plVirtualCam1* aud)
|
||||
{
|
||||
plProxyGen::Init(aud);
|
||||
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
plCameraProxy();
|
||||
virtual ~plCameraProxy();
|
||||
|
||||
hsBool Init(plVirtualCam1* aud);
|
||||
bool Init(plVirtualCam1* aud);
|
||||
plSceneNode* node;
|
||||
};
|
||||
|
||||
|
@ -72,7 +72,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plAvatar/plAvBrainHuman.h"
|
||||
#include "plNetClient/plNetClientMgr.h"
|
||||
|
||||
hsBool plCameraBrain1_FirstPerson::fDontFade = false;
|
||||
bool plCameraBrain1_FirstPerson::fDontFade = false;
|
||||
float plCameraBrain1::fFallAccel = 20.0f;
|
||||
float plCameraBrain1::fFallDecel = 5.0f;
|
||||
float plCameraBrain1::fFallVelocity = 50.0f;
|
||||
@ -153,7 +153,7 @@ void plCameraBrain1::AddTarget()
|
||||
}
|
||||
|
||||
// called when we are pushed on top of the camera stack (or re-activated by another popping off directly above)
|
||||
void plCameraBrain1::Push(hsBool recenter)
|
||||
void plCameraBrain1::Push(bool recenter)
|
||||
{
|
||||
if (fFlags.IsBitSet(kRailComponent))
|
||||
{
|
||||
@ -203,7 +203,7 @@ void plCameraBrain1::SetZoomParams(float max, float min, float rate)
|
||||
|
||||
// periodic update - forced means we are forcing an update at a non-normal time to "prime" the camera
|
||||
// into position before it renders the first time (hence the fake 10 second frame delta)
|
||||
void plCameraBrain1::Update(hsBool forced)
|
||||
void plCameraBrain1::Update(bool forced)
|
||||
{
|
||||
double secs = hsTimer::GetDelSysSeconds();
|
||||
if (forced)
|
||||
@ -259,7 +259,7 @@ void plCameraBrain1::IAnimateFOV(double time)
|
||||
// move the camera's origin point (not where it is looking) toward where it is going
|
||||
void plCameraBrain1::IMoveTowardGoal(double elapsedTime)
|
||||
{
|
||||
hsBool current = plVirtualCam1::Instance()->IsCurrentCamera(GetCamera());
|
||||
bool current = plVirtualCam1::Instance()->IsCurrentCamera(GetCamera());
|
||||
|
||||
if (fFlags.IsBitSet(kCutPos) || fFlags.IsBitSet(kNonPhys) || !current)
|
||||
{
|
||||
@ -334,7 +334,7 @@ void plCameraBrain1::SetMovementFlag(int f)
|
||||
|
||||
void plCameraBrain1::IPointTowardGoal(double elapsedTime)
|
||||
{
|
||||
hsBool current = plVirtualCam1::Instance()->IsCurrentCamera(GetCamera());
|
||||
bool current = plVirtualCam1::Instance()->IsCurrentCamera(GetCamera());
|
||||
|
||||
if (fFlags.IsBitSet(kCutPOA) || fFlags.IsBitSet(kNonPhys) || !current)
|
||||
{
|
||||
@ -452,7 +452,7 @@ float plCameraBrain1::IClampVelocity(hsVector3* vel, float maxSpeed, double elap
|
||||
return distMoved;
|
||||
}
|
||||
|
||||
hsBool plCameraBrain1::IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal)
|
||||
bool plCameraBrain1::IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal)
|
||||
{
|
||||
if (decelSpeed == 0)
|
||||
// no deceleration
|
||||
@ -535,7 +535,7 @@ void plCameraBrain1::Write(hsStream* stream, hsResMgr* mgr)
|
||||
stream->WriteLEFloat(fZoomMin);
|
||||
stream->WriteLEFloat(fZoomMax);
|
||||
}
|
||||
hsBool plCameraBrain1::MsgReceive(plMessage* msg)
|
||||
bool plCameraBrain1::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plCameraMsg* pCamMsg = plCameraMsg::ConvertNoRef(msg);
|
||||
if (pCamMsg)
|
||||
@ -743,7 +743,7 @@ plCameraBrain1_Drive::~plCameraBrain1_Drive()
|
||||
}
|
||||
|
||||
|
||||
void plCameraBrain1_Drive::Push(hsBool recenter)
|
||||
void plCameraBrain1_Drive::Push(bool recenter)
|
||||
{
|
||||
plCameraBrain1::Push(recenter);
|
||||
plInputManager::SetRecenterMouse(true);
|
||||
@ -757,7 +757,7 @@ void plCameraBrain1_Drive::Pop()
|
||||
//
|
||||
// Update Method
|
||||
//
|
||||
void plCameraBrain1_Drive::Update(hsBool forced)
|
||||
void plCameraBrain1_Drive::Update(bool forced)
|
||||
{
|
||||
hsVector3 neg_up = -1 * fUp;
|
||||
fTargetMatrix.Make(&fGoal, &fPOAGoal, &neg_up);
|
||||
@ -882,7 +882,7 @@ void plCameraBrain1_Drive::Update(hsBool forced)
|
||||
fCamera->SetTargetPOA(fPOAGoal);
|
||||
}
|
||||
|
||||
hsBool plCameraBrain1_Drive::MsgReceive(plMessage* msg)
|
||||
bool plCameraBrain1_Drive::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plMouseEventMsg* pMouseMsg = plMouseEventMsg::ConvertNoRef(msg);
|
||||
if( pMouseMsg )
|
||||
@ -992,7 +992,7 @@ void plCameraBrain1_Avatar::Pop()
|
||||
plCameraBrain1::Pop();
|
||||
}
|
||||
|
||||
void plCameraBrain1_Avatar::Push(hsBool recenter)
|
||||
void plCameraBrain1_Avatar::Push(bool recenter)
|
||||
{
|
||||
bObscured = false;
|
||||
fFallTimer = 0.0f;
|
||||
@ -1003,7 +1003,7 @@ void plCameraBrain1_Avatar::Push(hsBool recenter)
|
||||
//
|
||||
// Update Method
|
||||
//
|
||||
void plCameraBrain1_Avatar::Update(hsBool forced)
|
||||
void plCameraBrain1_Avatar::Update(bool forced)
|
||||
{
|
||||
if (!GetSubject())
|
||||
return;
|
||||
@ -1139,7 +1139,7 @@ void plCameraBrain1_Avatar::IHandleObstacle()
|
||||
// swing around the 'obstacle'
|
||||
}
|
||||
|
||||
void plCameraBrain1_Avatar::ISendFadeMsg(hsBool fade)
|
||||
void plCameraBrain1_Avatar::ISendFadeMsg(bool fade)
|
||||
{
|
||||
if (plVirtualCam1::IsCurrentCamera(GetCamera()))
|
||||
{
|
||||
@ -1158,7 +1158,7 @@ void plCameraBrain1_Avatar::ISendFadeMsg(hsBool fade)
|
||||
}
|
||||
}
|
||||
|
||||
hsBool plCameraBrain1_Avatar::MsgReceive(plMessage* msg)
|
||||
bool plCameraBrain1_Avatar::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plLOSHitMsg *pLOSMsg = plLOSHitMsg::ConvertNoRef( msg );
|
||||
if( pLOSMsg )
|
||||
@ -1295,7 +1295,7 @@ plCameraBrain1_FirstPerson::~plCameraBrain1_FirstPerson()
|
||||
{
|
||||
}
|
||||
|
||||
hsBool plCameraBrain1_FirstPerson::MsgReceive(plMessage* msg)
|
||||
bool plCameraBrain1_FirstPerson::MsgReceive(plMessage* msg)
|
||||
{
|
||||
|
||||
plGenRefMsg* pRefMsg = plGenRefMsg::ConvertNoRef(msg);
|
||||
@ -1429,7 +1429,7 @@ void plCameraBrain1_FirstPerson::CalculatePosition()
|
||||
}
|
||||
|
||||
|
||||
void plCameraBrain1_FirstPerson::Push(hsBool recenter)
|
||||
void plCameraBrain1_FirstPerson::Push(bool recenter)
|
||||
{
|
||||
if (!GetSubject())
|
||||
return;
|
||||
@ -1490,7 +1490,7 @@ void plCameraBrain1_Fixed::Write(hsStream* stream, hsResMgr* mgr)
|
||||
mgr->WriteKey(stream, fTargetPoint);
|
||||
}
|
||||
|
||||
void plCameraBrain1_Fixed::Update(hsBool forced)
|
||||
void plCameraBrain1_Fixed::Update(bool forced)
|
||||
{
|
||||
double secs = hsTimer::GetDelSysSeconds();
|
||||
if (forced)
|
||||
@ -1563,7 +1563,7 @@ void plCameraBrain1_Fixed::CalculatePosition()
|
||||
{
|
||||
}
|
||||
|
||||
hsBool plCameraBrain1_Fixed::MsgReceive(plMessage* msg)
|
||||
bool plCameraBrain1_Fixed::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plGenRefMsg* pRefMsg = plGenRefMsg::ConvertNoRef(msg);
|
||||
if (pRefMsg)
|
||||
@ -1611,7 +1611,7 @@ plCameraBrain1_Circle::~plCameraBrain1_Circle()
|
||||
//
|
||||
//
|
||||
//
|
||||
void plCameraBrain1_Circle::Update(hsBool forced)
|
||||
void plCameraBrain1_Circle::Update(bool forced)
|
||||
{
|
||||
double secs = hsTimer::GetDelSysSeconds();
|
||||
if (forced)
|
||||
@ -1651,7 +1651,7 @@ void plCameraBrain1_Circle::Update(hsBool forced)
|
||||
//
|
||||
// keep us on the circle
|
||||
//
|
||||
hsPoint3 plCameraBrain1_Circle::MoveTowardsFromGoal(const hsPoint3* fromGoal, double secs, hsBool warp)
|
||||
hsPoint3 plCameraBrain1_Circle::MoveTowardsFromGoal(const hsPoint3* fromGoal, double secs, bool warp)
|
||||
{
|
||||
|
||||
if (fCurRad != fGoalRad)
|
||||
@ -1659,7 +1659,7 @@ hsPoint3 plCameraBrain1_Circle::MoveTowardsFromGoal(const hsPoint3* fromGoal, do
|
||||
float dist = hsABS(fGoalRad-fCurRad);
|
||||
|
||||
hsAssert(dist>=0 && dist<=kTwoPI, "illegal radian diff");
|
||||
hsBool mustWrap = (dist > M_PI); // go opposite direction for shortcut and wrap
|
||||
bool mustWrap = (dist > M_PI); // go opposite direction for shortcut and wrap
|
||||
|
||||
// compute speed
|
||||
float speed;
|
||||
@ -1676,7 +1676,7 @@ hsPoint3 plCameraBrain1_Circle::MoveTowardsFromGoal(const hsPoint3* fromGoal, do
|
||||
if (mustWrap)
|
||||
{
|
||||
fCurRad-=speed;
|
||||
hsBool didWrap=false;
|
||||
bool didWrap=false;
|
||||
while(fCurRad<0)
|
||||
{
|
||||
didWrap=true;
|
||||
@ -1697,7 +1697,7 @@ hsPoint3 plCameraBrain1_Circle::MoveTowardsFromGoal(const hsPoint3* fromGoal, do
|
||||
if (mustWrap)
|
||||
{
|
||||
fCurRad+=speed;
|
||||
hsBool didWrap=false;
|
||||
bool didWrap=false;
|
||||
while(fCurRad>kTwoPI)
|
||||
{
|
||||
didWrap=true;
|
||||
@ -1791,7 +1791,7 @@ void plCameraBrain1_Circle::Read(hsStream* stream, hsResMgr* mgr)
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), GetKey());
|
||||
}
|
||||
|
||||
hsBool plCameraBrain1_Circle::MsgReceive(plMessage* msg)
|
||||
bool plCameraBrain1_Circle::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plGenRefMsg* pRefMsg = plGenRefMsg::ConvertNoRef(msg);
|
||||
if (pRefMsg)
|
||||
|
@ -103,8 +103,8 @@ public:
|
||||
|
||||
const plCameraModifier1* GetCamera() { return fCamera; }
|
||||
|
||||
virtual void Update(hsBool forced = false);
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual void Update(bool forced = false);
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
|
||||
virtual plSceneObject* GetSubject();
|
||||
virtual void SetSubject(plSceneObject* sub);
|
||||
@ -116,15 +116,15 @@ public:
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
virtual hsBool GetFaded() { return false; }
|
||||
virtual hsBool SetFaded(hsBool b) { return false; }
|
||||
virtual bool GetFaded() { return false; }
|
||||
virtual bool SetFaded(bool b) { return false; }
|
||||
|
||||
hsBool HasMovementFlag(int f) { return fMoveFlags.IsBitSet(f); }
|
||||
bool HasMovementFlag(int f) { return fMoveFlags.IsBitSet(f); }
|
||||
void SetMovementFlag(int f);
|
||||
void ClearMovementFlag(int which) { fMoveFlags.ClearBit( which ); }
|
||||
void SetFlags(int i) { fFlags.SetBit(i); }
|
||||
void ClearFlags(int which) { fFlags.ClearBit( which ); }
|
||||
hsBool HasFlag(int f) { return fFlags.IsBitSet(f); }
|
||||
bool HasFlag(int f) { return fFlags.IsBitSet(f); }
|
||||
|
||||
void SetGoal(hsPoint3 pt) { fGoal = pt; }
|
||||
void SetPOAGoal(hsPoint3 pt) { fPOAGoal = pt; }
|
||||
@ -141,7 +141,7 @@ public:
|
||||
hsPoint3 GetGoal() { return fGoal; }
|
||||
hsPoint3 GetPOAGoal() { return fPOAGoal; }
|
||||
|
||||
virtual void Push(hsBool recenter = true);
|
||||
virtual void Push(bool recenter = true);
|
||||
virtual void Pop();
|
||||
|
||||
float GetVelocity() { return fVelocity; }
|
||||
@ -182,7 +182,7 @@ protected:
|
||||
double elapsedTime);
|
||||
|
||||
float IClampVelocity(hsVector3* vel, float maxSpeed, double elapsedTime);
|
||||
hsBool IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal);
|
||||
bool IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal);
|
||||
|
||||
plCameraModifier1* fCamera;
|
||||
plKey fSubjectKey;
|
||||
@ -225,11 +225,11 @@ class plCameraBrain1_Drive : public plCameraBrain1
|
||||
protected:
|
||||
hsPoint3 fDesiredPosition;
|
||||
hsPoint3 fFacingTarget;
|
||||
hsBool bUseDesiredFacing;
|
||||
bool bUseDesiredFacing;
|
||||
float deltaX;
|
||||
float deltaY;
|
||||
hsBool bDisregardY; // these are here to prevent
|
||||
hsBool bDisregardX; // the camera from jumping when the mouse cursor recenters / wraps around.
|
||||
bool bDisregardY; // these are here to prevent
|
||||
bool bDisregardX; // the camera from jumping when the mouse cursor recenters / wraps around.
|
||||
hsVector3 fUp;
|
||||
|
||||
public:
|
||||
@ -243,9 +243,9 @@ public:
|
||||
CLASSNAME_REGISTER( plCameraBrain1_Drive );
|
||||
GETINTERFACE_ANY( plCameraBrain1_Drive, plCameraBrain1 );
|
||||
|
||||
virtual void Update(hsBool forced = false);
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual void Push(hsBool recenter = true);
|
||||
virtual void Update(bool forced = false);
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
virtual void Push(bool recenter = true);
|
||||
virtual void Pop();
|
||||
|
||||
static float fAcceleration;
|
||||
@ -267,8 +267,8 @@ public:
|
||||
GETINTERFACE_ANY( plCameraBrain1_Avatar, plCameraBrain1 );
|
||||
|
||||
|
||||
virtual void Update(hsBool forced = false);
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual void Update(bool forced = false);
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
|
||||
virtual void CalculatePosition();
|
||||
hsVector3 GetOffset() { return fOffset; }
|
||||
@ -277,21 +277,21 @@ public:
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
virtual hsBool GetFaded() { return fFaded; }
|
||||
virtual hsBool SetFaded(hsBool b) { fFaded = b; return true; }
|
||||
virtual bool GetFaded() { return fFaded; }
|
||||
virtual bool SetFaded(bool b) { fFaded = b; return true; }
|
||||
|
||||
virtual void Pop();
|
||||
virtual void Push(hsBool recenter = true);
|
||||
virtual void Push(bool recenter = true);
|
||||
|
||||
protected:
|
||||
void ISendFadeMsg(hsBool fade);
|
||||
void ISendFadeMsg(bool fade);
|
||||
void IHandleObstacle();
|
||||
|
||||
hsPoint3 fHitPoint;
|
||||
hsVector3 fOffset;
|
||||
hsVector3 fHitNormal;
|
||||
hsBool bObscured;
|
||||
hsBool fFaded;
|
||||
bool bObscured;
|
||||
bool fFaded;
|
||||
plSceneObject* fObstacle;
|
||||
};
|
||||
|
||||
@ -307,12 +307,12 @@ public:
|
||||
GETINTERFACE_ANY( plCameraBrain1_FirstPerson, plCameraBrain1_Avatar );
|
||||
|
||||
virtual void CalculatePosition();
|
||||
virtual void Push(hsBool recenter = true);
|
||||
virtual void Push(bool recenter = true);
|
||||
virtual void Pop();
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
|
||||
// for console hack
|
||||
static hsBool fDontFade;
|
||||
static bool fDontFade;
|
||||
protected:
|
||||
plSceneObject* fPosNode;
|
||||
|
||||
@ -333,9 +333,9 @@ public:
|
||||
|
||||
void SetTargetPoint(plCameraModifier1* pt) { fTargetPoint = pt; }
|
||||
|
||||
virtual void Update(hsBool forced = false);
|
||||
virtual void Update(bool forced = false);
|
||||
void CalculatePosition();
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
@ -382,9 +382,9 @@ public:
|
||||
|
||||
virtual void Read(hsStream *stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream *stream, hsResMgr* mgr);
|
||||
virtual hsPoint3 MoveTowardsFromGoal(const hsPoint3* fromGoal, double secs, hsBool warp = false);
|
||||
virtual void Update(hsBool forced = false);
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual hsPoint3 MoveTowardsFromGoal(const hsPoint3* fromGoal, double secs, bool warp = false);
|
||||
virtual void Update(bool forced = false);
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
|
||||
uint32_t GetCircleFlags() { return fCircleFlags; }
|
||||
hsPoint3* GetCenter() { return &fCenter; } // use GetCenterPoint
|
||||
@ -396,7 +396,7 @@ public:
|
||||
void SetCircleFlags(uint32_t f) { fCircleFlags|=f; }
|
||||
void SetCenter(hsPoint3* ctr) { fCenter = *ctr; } // Circle lies in the plane z = ctr->z
|
||||
void SetRadius(float radius) { fRadius = radius; }
|
||||
void SetFarCircleCam(hsBool farType) { if (farType) fCircleFlags |= kFarthest; else fCircleFlags &= ~kFarthest; }
|
||||
void SetFarCircleCam(bool farType) { if (farType) fCircleFlags |= kFarthest; else fCircleFlags &= ~kFarthest; }
|
||||
void SetCenterObjectKey(plKey k);
|
||||
void SetPOAObject(plSceneObject* pObj) { fPOAObj = pObj; }
|
||||
|
||||
|
@ -137,34 +137,34 @@ plSceneObject* plCameraModifier1::GetSubject()
|
||||
return fSubObj;
|
||||
}
|
||||
|
||||
void plCameraModifier1::SetFOVw(float f, hsBool fUpdateVCam)
|
||||
void plCameraModifier1::SetFOVw(float f, bool fUpdateVCam)
|
||||
{
|
||||
fFOVw = f;
|
||||
if (plVirtualCam1::Instance() && fUpdateVCam)
|
||||
plVirtualCam1::SetFOV(fFOVw, fFOVh, this);
|
||||
}
|
||||
|
||||
void plCameraModifier1::SetFOVh(float f, hsBool fUpdateVCam)
|
||||
void plCameraModifier1::SetFOVh(float f, bool fUpdateVCam)
|
||||
{
|
||||
fFOVh = f;
|
||||
if (plVirtualCam1::Instance() && fUpdateVCam)
|
||||
plVirtualCam1::SetFOV(fFOVw, fFOVh, this);
|
||||
}
|
||||
|
||||
hsBool plCameraModifier1::SetFaded(hsBool b)
|
||||
bool plCameraModifier1::SetFaded(bool b)
|
||||
{
|
||||
if (GetBrain())
|
||||
return GetBrain()->SetFaded(b);
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool plCameraModifier1::GetFaded()
|
||||
bool plCameraModifier1::GetFaded()
|
||||
{
|
||||
if (GetBrain())
|
||||
return GetBrain()->GetFaded();
|
||||
return false;
|
||||
}
|
||||
hsBool plCameraModifier1::MsgReceive(plMessage* msg)
|
||||
bool plCameraModifier1::MsgReceive(plMessage* msg)
|
||||
{
|
||||
if (GetBrain())
|
||||
GetBrain()->MsgReceive(msg);
|
||||
@ -257,7 +257,7 @@ void plCameraModifier1::Update()
|
||||
GetBrain()->AddTarget(); // update the brain's target
|
||||
}
|
||||
|
||||
hsBool moveInSub = !(GetBrain()->HasFlag(plCameraBrain1::kIgnoreSubworldMovement));
|
||||
bool moveInSub = !(GetBrain()->HasFlag(plCameraBrain1::kIgnoreSubworldMovement));
|
||||
|
||||
if (moveInSub && GetBrain()->GetSubject())
|
||||
{
|
||||
@ -330,9 +330,9 @@ void plCameraModifier1::Read(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
|
||||
plKey key = mgr->ReadKey(stream);
|
||||
hsBool cutpos = stream->ReadBool();
|
||||
hsBool cutpoa = stream->ReadBool();
|
||||
hsBool ignore = stream->ReadBool();
|
||||
bool cutpos = stream->ReadBool();
|
||||
bool cutpoa = stream->ReadBool();
|
||||
bool ignore = stream->ReadBool();
|
||||
float v = stream->ReadLEScalar();
|
||||
float a = stream->ReadLEScalar();
|
||||
float d = stream->ReadLEScalar();
|
||||
@ -424,7 +424,7 @@ void plCameraModifier1::Write(hsStream* stream, hsResMgr* mgr)
|
||||
stream->WriteBool(fResetAnimOnPop);
|
||||
}
|
||||
|
||||
void plCameraModifier1::Push(hsBool recenter)
|
||||
void plCameraModifier1::Push(bool recenter)
|
||||
{
|
||||
if (fAnimated)
|
||||
{
|
||||
|
@ -72,9 +72,9 @@ struct CamTrans
|
||||
}
|
||||
plKey fTransTo;
|
||||
|
||||
hsBool fCutPos;
|
||||
hsBool fCutPOA;
|
||||
hsBool fIgnore;
|
||||
bool fCutPos;
|
||||
bool fCutPOA;
|
||||
bool fIgnore;
|
||||
float fAccel;
|
||||
float fDecel;
|
||||
float fVelocity;
|
||||
@ -96,7 +96,7 @@ class plCameraModifier1 : public plSingleModifier
|
||||
protected:
|
||||
|
||||
void Output();
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; }
|
||||
virtual bool IEval(double secs, float del, uint32_t dirty) { return true; }
|
||||
|
||||
public:
|
||||
|
||||
@ -106,7 +106,7 @@ public:
|
||||
CLASSNAME_REGISTER( plCameraModifier1 );
|
||||
GETINTERFACE_ANY( plCameraModifier1, plSingleModifier );
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
|
||||
void Initialize();
|
||||
virtual void Update();
|
||||
@ -130,10 +130,10 @@ public:
|
||||
void SetSubworldPOA(hsPoint3 pos) { fLastSubPOA = pos; }
|
||||
float GetFOVw() { return fFOVw; }
|
||||
float GetFOVh() { return fFOVh; }
|
||||
void SetFOVw(float f, hsBool fUpdateVCam = true);
|
||||
void SetFOVh(float f, hsBool fUpdateVCam = true);
|
||||
hsBool GetInSubworld() { return fInSubLastUpdate; }
|
||||
void InSubworld(hsBool b) { fInSubLastUpdate = b; }
|
||||
void SetFOVw(float f, bool fUpdateVCam = true);
|
||||
void SetFOVh(float f, bool fUpdateVCam = true);
|
||||
bool GetInSubworld() { return fInSubLastUpdate; }
|
||||
void InSubworld(bool b) { fInSubLastUpdate = b; }
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
void AddTrans(CamTrans* t) { fTrans.Append(t); }
|
||||
@ -142,14 +142,14 @@ public:
|
||||
void SetSubject(plSceneObject* pObj);
|
||||
plSceneObject* GetSubject();
|
||||
|
||||
virtual void Push(hsBool recenter = true);
|
||||
virtual void Push(bool recenter = true);
|
||||
virtual void Pop();
|
||||
|
||||
virtual hsBool GetFaded();
|
||||
virtual hsBool SetFaded(hsBool b);
|
||||
virtual bool GetFaded();
|
||||
virtual bool SetFaded(bool b);
|
||||
|
||||
hsBool IsAnimated() { return fAnimated; }
|
||||
void SetAnimCommands(hsBool a, hsBool b, hsBool c) { fStartAnimOnPush = a; fStopAnimOnPop = b; fResetAnimOnPop = c; }
|
||||
bool IsAnimated() { return fAnimated; }
|
||||
void SetAnimCommands(bool a, bool b, bool c) { fStartAnimOnPush = a; fStopAnimOnPop = b; fResetAnimOnPop = c; }
|
||||
|
||||
private:
|
||||
hsPoint3 fFrom;
|
||||
@ -161,11 +161,11 @@ private:
|
||||
float fFOVh;
|
||||
hsTArray<plMessage*> fMessageQueue;
|
||||
hsTArray<plCameraMsg*> fFOVInstructions;
|
||||
hsBool fAnimated, fStartAnimOnPush, fStopAnimOnPop, fResetAnimOnPop;
|
||||
bool fAnimated, fStartAnimOnPush, fStopAnimOnPop, fResetAnimOnPop;
|
||||
hsPoint3 fLastSubPos;
|
||||
hsPoint3 fLastSubPOA;
|
||||
hsBool fInSubLastUpdate;
|
||||
hsBool fUpdateBrainTarget; // sometimes our target isn't loaded yet, so wait to update the brain til later
|
||||
bool fInSubLastUpdate;
|
||||
bool fUpdateBrainTarget; // sometimes our target isn't loaded yet, so wait to update the brain til later
|
||||
};
|
||||
|
||||
|
||||
|
@ -56,7 +56,7 @@ float plInterestingModifier::fInterestRadius = 100.0f;
|
||||
float plInterestingModifier::fInterestWeight = 1.0f;
|
||||
|
||||
|
||||
hsBool plInterestingModifier::IEval(double secs, float del, uint32_t dirty)
|
||||
bool plInterestingModifier::IEval(double secs, float del, uint32_t dirty)
|
||||
{
|
||||
for (int i=0; i < GetNumTargets(); i++)
|
||||
{
|
||||
|
@ -67,13 +67,13 @@ protected:
|
||||
static float fInterestRadius;
|
||||
static float fInterestWeight;
|
||||
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty);
|
||||
virtual bool IEval(double secs, float del, uint32_t dirty);
|
||||
|
||||
public:
|
||||
plInterestingModifier(){ fType = kTypeInteresting;}
|
||||
virtual ~plInterestingModifier(){;}
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg) {return false;}
|
||||
virtual bool MsgReceive(plMessage* msg) {return false;}
|
||||
|
||||
CLASSNAME_REGISTER( plInterestingModifier );
|
||||
GETINTERFACE_ANY( plInterestingModifier, plSingleModifier );
|
||||
|
@ -90,9 +90,9 @@ float plVirtualCam1::fFOVw = 45.0f;
|
||||
float plVirtualCam1::fFOVh = 33.75f;
|
||||
float plVirtualCam1::fHither = 0.3f;
|
||||
float plVirtualCam1::fYon = 500.0f;
|
||||
hsBool plVirtualCam1::printFOV = false;
|
||||
hsBool plVirtualCam1::fUseAccelOverride = 1;
|
||||
hsBool plVirtualCam1::freeze = 0;
|
||||
bool plVirtualCam1::printFOV = false;
|
||||
bool plVirtualCam1::fUseAccelOverride = 1;
|
||||
bool plVirtualCam1::freeze = 0;
|
||||
//float plVirtualCam1::fAccel = 5.0f;
|
||||
//float plVirtualCam1::fDecel = 5.0f;
|
||||
//float plVirtualCam1::fVel = 10.0f;
|
||||
@ -101,9 +101,9 @@ float plVirtualCam1::fDecel = 50.0f;
|
||||
float plVirtualCam1::fVel = 100.0f;
|
||||
float plVirtualCam1::fPanResponseTime = 3.0f;
|
||||
float plVirtualCam1::fFallTimerDelay = 0.25f;
|
||||
hsBool plVirtualCam1::alwaysCutForColin = false;
|
||||
hsBool plVirtualCam1::WalkPan3rdPerson = false;
|
||||
hsBool plVirtualCam1::StayInFirstPersonForever = false;
|
||||
bool plVirtualCam1::alwaysCutForColin = false;
|
||||
bool plVirtualCam1::WalkPan3rdPerson = false;
|
||||
bool plVirtualCam1::StayInFirstPersonForever = false;
|
||||
float plVirtualCam1::fAspectRatio = fFOVw / fFOVh;
|
||||
|
||||
// #define STATUS_LOG
|
||||
@ -121,7 +121,7 @@ void plVirtualCam1::AddMsgToLog(const char* msg)
|
||||
#endif
|
||||
}
|
||||
|
||||
hsBool plVirtualCam1::IsCurrentCamera(const plCameraModifier1* mod)
|
||||
bool plVirtualCam1::IsCurrentCamera(const plCameraModifier1* mod)
|
||||
{
|
||||
if (plVirtualCam1::Instance())
|
||||
{
|
||||
@ -392,7 +392,7 @@ void plVirtualCam1::SetPipeline(plPipeline* p)
|
||||
SetRender(false);
|
||||
}
|
||||
|
||||
void plVirtualCam1::Reset(hsBool bRender)
|
||||
void plVirtualCam1::Reset(bool bRender)
|
||||
{
|
||||
if (fPythonOverride)
|
||||
fPythonOverride = nil;
|
||||
@ -455,7 +455,7 @@ plCameraModifier1* plVirtualCam1::GetCurrentCamera()
|
||||
return nil;
|
||||
}
|
||||
|
||||
hsBool plVirtualCam1::Is1stPersonCamera()
|
||||
bool plVirtualCam1::Is1stPersonCamera()
|
||||
{
|
||||
if (GetCurrentStackCamera() == fDriveCamera)
|
||||
return false;
|
||||
@ -508,7 +508,7 @@ void plVirtualCam1::SetCutNextTrans()
|
||||
#endif
|
||||
}
|
||||
|
||||
void plVirtualCam1::SetRender(hsBool render)
|
||||
void plVirtualCam1::SetRender(bool render)
|
||||
{
|
||||
fFlags.SetBit(kRender,render);
|
||||
if (render)
|
||||
@ -532,7 +532,7 @@ void plVirtualCam1::SetRender(hsBool render)
|
||||
}
|
||||
|
||||
// hack, hack, hack
|
||||
hsBool plVirtualCam1::RestoreFromName(const plString& name)
|
||||
bool plVirtualCam1::RestoreFromName(const plString& name)
|
||||
{
|
||||
for(plSOVec::iterator it = fCamerasLoaded.begin(); it != fCamerasLoaded.end(); ++it)
|
||||
{
|
||||
@ -777,7 +777,7 @@ void plVirtualCam1::IUpdate()
|
||||
|
||||
for (plCameraVec::iterator i = fCameraStack.begin(); i != fCameraStack.end(); ++i)
|
||||
{
|
||||
hsBool update = true;
|
||||
bool update = true;
|
||||
for (plCameraVec::iterator j = (i+1); j != fCameraStack.end(); ++j)
|
||||
{
|
||||
if (*i != *j)
|
||||
@ -954,7 +954,7 @@ void plVirtualCam1::FirstPersonOverride()
|
||||
}
|
||||
}
|
||||
|
||||
hsBool plVirtualCam1::MsgReceive(plMessage* msg)
|
||||
bool plVirtualCam1::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plPlayerPageMsg* pPMsg = plPlayerPageMsg::ConvertNoRef(msg);
|
||||
if (pPMsg)
|
||||
@ -1356,7 +1356,7 @@ hsBool plVirtualCam1::MsgReceive(plMessage* msg)
|
||||
if (pCam->GetTriggerer() && pCam->GetTriggerer() != plNetClientApp::GetInstance()->GetLocalPlayerKey())
|
||||
return true;
|
||||
{
|
||||
hsBool bDef = pCam->Cmd(plCameraMsg::kSetAsPrimary);
|
||||
bool bDef = pCam->Cmd(plCameraMsg::kSetAsPrimary);
|
||||
plKey pCamKey = pCam->GetNewCam();
|
||||
if (pCamKey)
|
||||
{
|
||||
@ -1504,7 +1504,7 @@ void plVirtualCam1::AddCameraToStack(plCameraModifier1* pCam)
|
||||
hsgResMgr::ResMgr()->AddViaNotify(pCam->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefCamera), plRefFlags::kPassiveRef);
|
||||
}
|
||||
|
||||
void plVirtualCam1::PushCamera(plCameraModifier1* pCam, hsBool bDefault)
|
||||
void plVirtualCam1::PushCamera(plCameraModifier1* pCam, bool bDefault)
|
||||
{
|
||||
// pushing the same camera, folks?
|
||||
if (pCam == GetCurrentStackCamera())
|
||||
@ -1696,7 +1696,7 @@ void plVirtualCam1::PopCamera(plCameraModifier1* pCam)
|
||||
}
|
||||
|
||||
// are we mouse-looking?
|
||||
hsBool mLook = false;
|
||||
bool mLook = false;
|
||||
if (pCam->GetBrain() && pCam->GetBrain()->HasMovementFlag(S_SET_FREELOOK))
|
||||
mLook = true;
|
||||
|
||||
|
@ -121,7 +121,7 @@ public:
|
||||
void SetPipeline(plPipeline* p);
|
||||
void Init();
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
static void SetFOV(float w, float h);
|
||||
static void SetFOV(float w, float h, plCameraModifier1* pCam);
|
||||
static void SetDepth(float h, float y);
|
||||
@ -133,14 +133,14 @@ public:
|
||||
static void SetAspectRatio(float aspect) { fAspectRatio = aspect; }
|
||||
static float GetAspectRatio() { return fAspectRatio; }
|
||||
|
||||
hsBool InTransition() { return fTransPos != POS_TRANS_OFF; }
|
||||
bool InTransition() { return fTransPos != POS_TRANS_OFF; }
|
||||
plCameraModifier1* GetCurrentCamera();
|
||||
plCameraModifier1* GetCurrentStackCamera();
|
||||
plCameraModifier1* GetTransitionCamera(){return fTransitionCamera;}
|
||||
hsBool Is1stPersonCamera();
|
||||
bool Is1stPersonCamera();
|
||||
|
||||
hsBool HasMovementFlag(int f) { return fMoveFlags.IsBitSet(f); }
|
||||
void SetMovementFlag(int f, hsBool on = true) { fMoveFlags.SetBit(f, on);}
|
||||
bool HasMovementFlag(int f) { return fMoveFlags.IsBitSet(f); }
|
||||
void SetMovementFlag(int f, bool on = true) { fMoveFlags.SetBit(f, on);}
|
||||
|
||||
hsPoint3 GetCameraPos() { return fOutputPos; }
|
||||
hsPoint3 GetCameraPOA() { return fOutputPOA; }
|
||||
@ -155,34 +155,34 @@ public:
|
||||
void RebuildStack(const plKey& key);
|
||||
|
||||
void SetFlags(int flag) { fFlags.SetBit(flag); }
|
||||
hsBool HasFlags(int flag) { return fFlags.IsBitSet(flag); }
|
||||
bool HasFlags(int flag) { return fFlags.IsBitSet(flag); }
|
||||
void ClearFlags(int flag) { fFlags.ClearBit(flag); }
|
||||
|
||||
// console command stuff
|
||||
static void Next();
|
||||
static void Prev();
|
||||
static void Deactivate();
|
||||
void CameraRegions(hsBool b) { fFlags.SetBit(kRegionIgnore,b); }
|
||||
void LogFOV(hsBool b) { printFOV = b; }
|
||||
void CameraRegions(bool b) { fFlags.SetBit(kRegionIgnore,b); }
|
||||
void LogFOV(bool b) { printFOV = b; }
|
||||
void Drive();
|
||||
void PushThirdPerson();
|
||||
|
||||
static void AddMsgToLog(const char* msg);
|
||||
static hsBool IsCurrentCamera(const plCameraModifier1* mod);
|
||||
static bool IsCurrentCamera(const plCameraModifier1* mod);
|
||||
void ClearStack();
|
||||
|
||||
void AddCameraLoaded(plSceneObject* pCam) { fCamerasLoaded.push_back(pCam); }
|
||||
hsBool RestoreFromName(const plString& name);
|
||||
bool RestoreFromName(const plString& name);
|
||||
void StartUnPan();
|
||||
// these are for console access
|
||||
static hsBool fUseAccelOverride, freeze, alwaysCutForColin, WalkPan3rdPerson,StayInFirstPersonForever;
|
||||
static bool fUseAccelOverride, freeze, alwaysCutForColin, WalkPan3rdPerson,StayInFirstPersonForever;
|
||||
static float fDecel, fAccel, fVel;
|
||||
static float fFallTimerDelay;
|
||||
|
||||
private:
|
||||
|
||||
void Reset(hsBool bRender);
|
||||
void PushCamera(plCameraModifier1* pCam, hsBool bDefault = false);
|
||||
void Reset(bool bRender);
|
||||
void PushCamera(plCameraModifier1* pCam, bool bDefault = false);
|
||||
void PopCamera(plCameraModifier1* pCam);
|
||||
void AddCameraToStack(plCameraModifier1* pCam);
|
||||
void PopAll();
|
||||
@ -190,7 +190,7 @@ private:
|
||||
void StartTransition(CamTrans* transition);
|
||||
void RunTransition();
|
||||
void FinishTransition();
|
||||
void SetRender(hsBool render);
|
||||
void SetRender(bool render);
|
||||
void IHandleCameraStatusLog(plCameraModifier1* pMod, int action);
|
||||
void ICreatePlate();
|
||||
void FreezeOutput(int frames) { fFreezeCounter = frames; } // I hate this and I hate myself for doing it
|
||||
@ -242,10 +242,10 @@ private:
|
||||
static float fFOVh, fFOVw;
|
||||
static float fHither, fYon;
|
||||
static plVirtualCam1* fInstance;
|
||||
static hsBool printFOV;
|
||||
static bool printFOV;
|
||||
static float fPanResponseTime;
|
||||
static float fAspectRatio;
|
||||
hsBool fForceCutOnce;
|
||||
bool fForceCutOnce;
|
||||
|
||||
};
|
||||
|
||||
|
@ -280,7 +280,7 @@ bool pfMarkerMgr::AreLocalMarkersShowing()
|
||||
return fShowingLocalMarkers;
|
||||
}
|
||||
|
||||
hsBool pfMarkerMgr::MsgReceive(plMessage* msg)
|
||||
bool pfMarkerMgr::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plEvalMsg* evalMsg = plEvalMsg::ConvertNoRef(msg);
|
||||
if (evalMsg)
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
static pfMarkerMgr* Instance();
|
||||
static void Shutdown();
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
bool MsgReceive(plMessage* msg);
|
||||
|
||||
void AddMarker(double x, double y, double z, uint32_t id, bool justCreated);
|
||||
void RemoveMarker(uint32_t id);
|
||||
|
@ -186,7 +186,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// plgAudioSys::SetMuted( false );
|
||||
//}
|
||||
//
|
||||
//hsBool plPlayerModifier::MsgReceive(plMessage* msg)
|
||||
//bool plPlayerModifier::MsgReceive(plMessage* msg)
|
||||
//{
|
||||
// plControlEventMsg* pCommandMsg = plControlEventMsg::ConvertNoRef(msg);
|
||||
// if (pCommandMsg)
|
||||
@ -228,9 +228,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// return plSingleModifier::MsgReceive(msg);
|
||||
//}
|
||||
//
|
||||
//hsBool plPlayerModifier::HandleControlInput(plControlEventMsg* pMsg)
|
||||
//bool plPlayerModifier::HandleControlInput(plControlEventMsg* pMsg)
|
||||
//{
|
||||
// hsBool ret=false;
|
||||
// bool ret=false;
|
||||
//
|
||||
// if (pMsg->ControlActivated() && (pMsg->GetControlCode() == B_CONTROL_ROTATE_RIGHT || pMsg->GetControlCode() == B_CONTROL_ROTATE_LEFT || pMsg->GetControlCode() == A_CONTROL_TURN))
|
||||
// {
|
||||
@ -256,7 +256,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// return ret;
|
||||
//}
|
||||
//
|
||||
//void plPlayerModifier::SetMoving(hsBool b)
|
||||
//void plPlayerModifier::SetMoving(bool b)
|
||||
//{
|
||||
// if (b != bMoving)
|
||||
// {
|
||||
@ -277,7 +277,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
//hsPoint3 forceRight(-200,0,0);
|
||||
//hsPoint3 forceUp(0,0,15);
|
||||
//
|
||||
//hsBool plPlayerModifier::IEval(double secs, float del, uint32_t dirty)
|
||||
//bool plPlayerModifier::IEval(double secs, float del, uint32_t dirty)
|
||||
//{
|
||||
// // setup for local player if necessary
|
||||
// if (HasFlag(kNeedsLocalSetup))
|
||||
@ -610,7 +610,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// return distMoved;
|
||||
//}
|
||||
//
|
||||
//hsBool32 plPlayerModifier::IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal)
|
||||
//bool32 plPlayerModifier::IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal)
|
||||
//{
|
||||
// if (decelSpeed == 0)
|
||||
// // no deceleration
|
||||
|
@ -100,9 +100,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// double elapsedTime);
|
||||
//
|
||||
// float IClampVelocity(hsVector3* vel, float maxSpeed, double elapsedTime);
|
||||
// hsBool32 IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal);
|
||||
// bool32 IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal);
|
||||
//
|
||||
// hsBool HasMovementFlag(int f) const { return fMoveFlags.IsBitSet(f); }
|
||||
// bool HasMovementFlag(int f) const { return fMoveFlags.IsBitSet(f); }
|
||||
// void SetMovementFlag(int f) { fMoveFlags.SetBit(f); }
|
||||
// void ClearMovementFlag(int which) { fMoveFlags.ClearBit( which ); }
|
||||
//
|
||||
@ -111,7 +111,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
//
|
||||
// void WarpToSpawnPoint() { SetFlag( kWantsToSpawn ); }
|
||||
//
|
||||
// hsBool bMoving;
|
||||
// bool bMoving;
|
||||
//
|
||||
// void IApplyForce(plSimulationInterface::plSimpleForce type, const Havok::Vector3 &vec);
|
||||
// void IDoLocalSetup(plSceneObject*);
|
||||
@ -124,17 +124,17 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// CLASSNAME_REGISTER( plPlayerModifier );
|
||||
// GETINTERFACE_ANY( plPlayerModifier, plSingleModifier );
|
||||
//
|
||||
// virtual hsBool MsgReceive(plMessage* msg);
|
||||
// virtual bool MsgReceive(plMessage* msg);
|
||||
// virtual void AddTarget(plSceneObject* so);
|
||||
// virtual void RemoveTarget(plSceneObject* so);
|
||||
//
|
||||
// hsBool HandleControlInput(plControlEventMsg* pMsg);
|
||||
// virtual hsBool IEval(double secs, float del, uint32_t dirty);
|
||||
// bool HandleControlInput(plControlEventMsg* pMsg);
|
||||
// virtual bool IEval(double secs, float del, uint32_t dirty);
|
||||
//
|
||||
// void SetMoving(hsBool b);
|
||||
// hsBool IsMoving() { return bMoving; }
|
||||
// void SetMoving(bool b);
|
||||
// bool IsMoving() { return bMoving; }
|
||||
//
|
||||
// hsBool HasFlag(int f) const { return fFlags.IsBitSet(f); }
|
||||
// bool HasFlag(int f) const { return fFlags.IsBitSet(f); }
|
||||
// void SetFlag(int f) { fFlags.SetBit(f); }
|
||||
// void ClearFlag(int which) { fFlags.ClearBit( which ); }
|
||||
//
|
||||
|
@ -58,7 +58,7 @@ plANDConditionalObject::~plANDConditionalObject()
|
||||
delete (fChildren[i]);
|
||||
}
|
||||
|
||||
hsBool plANDConditionalObject::MsgReceive(plMessage* msg)
|
||||
bool plANDConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plCondRefMsg* pCondMsg = plCondRefMsg::ConvertNoRef(msg);
|
||||
if (pCondMsg)
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
bool MsgReceive(plMessage* msg);
|
||||
void Evaluate();
|
||||
void Reset();
|
||||
|
||||
|
@ -52,7 +52,7 @@ plActivatorConditionalObject::plActivatorConditionalObject()
|
||||
SetFlag(kLocalElement); // since it relies on user input
|
||||
}
|
||||
|
||||
hsBool plActivatorConditionalObject::MsgReceive(plMessage* msg)
|
||||
bool plActivatorConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plActivatorMsg* pDetectorMsg = plActivatorMsg::ConvertNoRef(msg);
|
||||
if (pDetectorMsg)
|
||||
@ -130,7 +130,7 @@ hsBool plActivatorConditionalObject::MsgReceive(plMessage* msg)
|
||||
fLogicMod->GetNotify()->AddCollisionEvent(true, pDetectorMsg->fHitterObj, pDetectorMsg->fHiteeObj);
|
||||
}
|
||||
SetSatisfied(true);
|
||||
//hsBool netRequest = msg->HasBCastFlag(plMessage::kNetNonLocal);
|
||||
//bool netRequest = msg->HasBCastFlag(plMessage::kNetNonLocal);
|
||||
//fLogicMod->RequestTrigger(netRequest);
|
||||
fLogicMod->RequestTrigger(false);
|
||||
}
|
||||
@ -166,7 +166,7 @@ void plActivatorConditionalObject::SetActivatorKey(plKey k)
|
||||
// plActivatorActivatorConditional
|
||||
//
|
||||
|
||||
hsBool plActivatorActivatorConditionalObject::MsgReceive(plMessage* msg)
|
||||
bool plActivatorActivatorConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plNotifyMsg* pDetectorMsg = plNotifyMsg::ConvertNoRef(msg);
|
||||
if (pDetectorMsg)
|
||||
@ -190,7 +190,7 @@ hsBool plActivatorActivatorConditionalObject::MsgReceive(plMessage* msg)
|
||||
}
|
||||
|
||||
|
||||
hsBool plVolActivatorConditionalObject::MsgReceive(plMessage* msg)
|
||||
bool plVolActivatorConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plActivatorMsg* pDetectorMsg = plActivatorMsg::ConvertNoRef(msg);
|
||||
if (pDetectorMsg)
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
CLASSNAME_REGISTER( plActivatorConditionalObject );
|
||||
GETINTERFACE_ANY( plActivatorConditionalObject, plConditionalObject );
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
|
||||
void Evaluate(){;}
|
||||
void SetActivatorKey(plKey k);
|
||||
@ -83,7 +83,7 @@ public:
|
||||
CLASSNAME_REGISTER( plActivatorActivatorConditionalObject );
|
||||
GETINTERFACE_ANY( plActivatorActivatorConditionalObject, plActivatorConditionalObject );
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
|
||||
|
||||
};
|
||||
@ -98,7 +98,7 @@ public:
|
||||
CLASSNAME_REGISTER( plVolActivatorConditionalObject );
|
||||
GETINTERFACE_ANY( plVolActivatorConditionalObject, plActivatorConditionalObject );
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
|
||||
|
||||
};
|
||||
|
@ -54,7 +54,7 @@ fAction(kEventEnd)
|
||||
{
|
||||
}
|
||||
|
||||
hsBool plAnimationEventConditionalObject::MsgReceive(plMessage* msg)
|
||||
bool plAnimationEventConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plEventCallbackMsg* pMsg = plEventCallbackMsg::ConvertNoRef(msg);
|
||||
if (pMsg)
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
bool MsgReceive(plMessage* msg);
|
||||
|
||||
void Evaluate(){;}
|
||||
void Reset() { SetSatisfied(false); }
|
||||
|
@ -50,7 +50,7 @@ plControlEventConditionalObject::plControlEventConditionalObject()
|
||||
|
||||
}
|
||||
|
||||
hsBool plControlEventConditionalObject::MsgReceive(plMessage* msg)
|
||||
bool plControlEventConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plControlEventMsg* pControlMsg = plControlEventMsg::ConvertNoRef(msg);
|
||||
if( pControlMsg )
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
bool MsgReceive(plMessage* msg);
|
||||
|
||||
void Evaluate(){;}
|
||||
void Reset() { SetSatisfied(false); }
|
||||
|
@ -58,7 +58,7 @@ fDirectional(false)
|
||||
SetSatisfied(true);
|
||||
}
|
||||
|
||||
hsBool plFacingConditionalObject::MsgReceive(plMessage* msg)
|
||||
bool plFacingConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
}
|
||||
@ -78,7 +78,7 @@ void plFacingConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
|
||||
fDirectional = stream->ReadBool();
|
||||
}
|
||||
|
||||
hsBool plFacingConditionalObject::Verify(plMessage* msg)
|
||||
bool plFacingConditionalObject::Verify(plMessage* msg)
|
||||
{
|
||||
plActivatorMsg* pActivateMsg = plActivatorMsg::ConvertNoRef(msg);
|
||||
if (pActivateMsg && pActivateMsg->fHitterObj)
|
||||
|
@ -51,7 +51,7 @@ class plFacingConditionalObject : public plConditionalObject
|
||||
{
|
||||
protected:
|
||||
float fTolerance;
|
||||
hsBool fDirectional;
|
||||
bool fDirectional;
|
||||
|
||||
public:
|
||||
|
||||
@ -61,12 +61,12 @@ public:
|
||||
CLASSNAME_REGISTER( plFacingConditionalObject );
|
||||
GETINTERFACE_ANY( plFacingConditionalObject, plConditionalObject );
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
bool MsgReceive(plMessage* msg);
|
||||
|
||||
void SetTolerance(float d) { fTolerance = d; }
|
||||
void SetDirectional(hsBool d) { fDirectional = d; }
|
||||
void SetDirectional(bool d) { fDirectional = d; }
|
||||
|
||||
virtual hsBool Verify(plMessage* msg);
|
||||
virtual bool Verify(plMessage* msg);
|
||||
|
||||
void Evaluate(){;}
|
||||
void Reset() { SetSatisfied(true); }
|
||||
|
@ -50,7 +50,7 @@ plKeyPressConditionalObject::plKeyPressConditionalObject()
|
||||
SetFlag(kLocalElement); // since it relies on user input
|
||||
}
|
||||
|
||||
hsBool plKeyPressConditionalObject::MsgReceive(plMessage* msg)
|
||||
bool plKeyPressConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plKeyEventMsg* pKeyMsg = plKeyEventMsg::ConvertNoRef(msg);
|
||||
if( pKeyMsg )
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
bool MsgReceive(plMessage* msg);
|
||||
|
||||
void Evaluate(){;}
|
||||
void Reset() { SetSatisfied(false); }
|
||||
|
@ -50,7 +50,7 @@ plLocalPlayerInBoxConditionalObject::plLocalPlayerInBoxConditionalObject()
|
||||
SetFlag(kLocalElement); // since it relies on the local player
|
||||
}
|
||||
|
||||
hsBool plLocalPlayerInBoxConditionalObject::MsgReceive(plMessage* msg)
|
||||
bool plLocalPlayerInBoxConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
/*
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
CLASSNAME_REGISTER( plLocalPlayerInBoxConditionalObject );
|
||||
GETINTERFACE_ANY( plLocalPlayerInBoxConditionalObject, plConditionalObject );
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
bool MsgReceive(plMessage* msg);
|
||||
|
||||
void SetBox(plKey pKey) { fBox = pKey; }
|
||||
|
||||
|
@ -49,7 +49,7 @@ plLocalPlayerIntersectPlaneConditionalObject::plLocalPlayerIntersectPlaneConditi
|
||||
SetFlag(kLocalElement); // since it relies on the local player
|
||||
}
|
||||
|
||||
hsBool plLocalPlayerIntersectPlaneConditionalObject::MsgReceive(plMessage* msg)
|
||||
bool plLocalPlayerIntersectPlaneConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
/*
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user